mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Remove the custom pluralisation rules in favor of rails_i18n and fix the RU language file a bit.
This commit is contained in:
parent
16b3de443d
commit
16e26de2c5
2 changed files with 2 additions and 37 deletions
|
|
@ -1,37 +0,0 @@
|
|||
module I18n::Backend::Pluralization
|
||||
# rules taken from : http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
|
||||
def pluralize(locale, entry, n)
|
||||
return entry unless entry.is_a?(Hash) && n
|
||||
if n == 0 && entry.has_key?(:zero)
|
||||
key = :zero
|
||||
else
|
||||
key = case locale
|
||||
when :pl # Polish
|
||||
n==1 ? :one : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? :few : :other
|
||||
when :cs, :sk # Czech, Slovak
|
||||
n==1 ? :one : (n>=2 && n<=4) ? :few : :other
|
||||
when :lt # Lithuanian
|
||||
n%10==1 && n%100!=11 ? :one : n%10>=2 && (n%100<10 || n%100>=20) ? :few : :other
|
||||
when :lv # Latvian
|
||||
n%10==1 && n%100!=11 ? :one : n != 0 ? :few : :other
|
||||
when :ru, :uk, :sr, :hr # Russian, Ukrainian, Serbian, Croatian
|
||||
n%10==1 && n%100!=11 ? :one : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? :few : :other
|
||||
when :sl # Slovenian
|
||||
n%100==1 ? :one : n%100==2 ? :few : n%100==3 || n%100==4 ? :many : :other
|
||||
when :ro # Romanian
|
||||
n==1 ? :one : (n==0 || (n%100 > 0 && n%100 < 20)) ? :few : :other
|
||||
when :gd # Gaeilge
|
||||
n==1 ? :one : n==2 ? :two : :other;
|
||||
# add another language if you like...
|
||||
else
|
||||
n==1 ? :one : :other # default :en
|
||||
end
|
||||
end
|
||||
key = :other if key == :few && !entry.has_key?(key) #fallback to :other if :few is missing
|
||||
raise InvalidPluralizationData.new(entry, n) unless entry.has_key?(key)
|
||||
entry[key]
|
||||
end
|
||||
end
|
||||
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
||||
|
|
@ -102,6 +102,7 @@ ru:
|
|||
one: действий
|
||||
few: действие
|
||||
many: действия
|
||||
other: действия
|
||||
add: Добавить
|
||||
ajaxError: От сервера была получена ошибка
|
||||
back: Назад
|
||||
|
|
@ -1079,6 +1080,7 @@ ru:
|
|||
one: Отложить на 1 день
|
||||
few: Отложить на %{count} дня
|
||||
many: Отложить на %{count} дней
|
||||
other: Отложить на %{count} дней
|
||||
deferred_actions_with: Отложенные действия с меткой '%{tag_name}'
|
||||
deferred_pending_actions: Отложенные/ожидающие действия
|
||||
deferred_tasks_title: TRACKS::Отложенные
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue