Get more i18n fixed in for he locale. Include fallback to en locale and include pluralization mechanism

This commit is contained in:
Reinier Balt 2012-04-16 13:17:59 +02:00
parent 8ea90504c6
commit 72dbc169ab
20 changed files with 1839 additions and 1703 deletions

View file

@ -0,0 +1,36 @@
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
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)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -92,7 +92,10 @@ en:
third: Third
recurring_todos: Repeating Actions
actions: Actions
actions_midsentence: actions
actions_midsentence:
zero: actions
one: action
other: actions
add: Add
previous: Previous
show_all: Show all
@ -132,6 +135,10 @@ en:
errors_with_fields: "There were problems with the following fields:"
next: Next
todo: todo
note:
zero: no notes
one: 1 note
other: %{count} notes
context: Context
drag_handle: DRAG
description: Description
@ -143,7 +150,11 @@ en:
email: Email
search: Search
ajaxError: There was an error retrieving from server
days_midsentence: days
days_midsentence:
zero: days
one: day
other: days
deferred: deferred
not_available_abbr: "n/a"
data:
import_successful: Import was successful.
@ -584,6 +595,8 @@ en:
add_new_recurring: Add a new recurring action
edit_recurring_todo: Edit repeating action
no_incomplete_actions: There are no incomplete actions
see_all_completed: You can see all completed actions %{link}
all_completed_here: here
notes:
delete_confirmation: Are you sure that you want to delete the note '%{id}'?
delete_item_title: Delete item

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff