49. I18N-SPEC
github.com/tigrish/i18n-spec
describe "config/locales/en.yml" do
it { should be_parseable }
it { should have_valid_pluralization_keys }
it { should have_one_top_level_namespace }
it { should be_named_like_top_level_namespace }
it { should_not have_legacy_interpolations }
end
50. I18N-SPEC
github.com/tigrish/i18n-spec
describe "config/locales/en.yml" do
it { should be_parseable }
it { should have_valid_pluralization_keys }
it { should have_one_top_level_namespace }
it { should be_named_like_top_level_namespace }
it { should_not have_legacy_interpolations }
end
Dir.glob('config/locales/*.yml') do |locale_file|
describe "a locale file" do
it_behaves_like 'a valid locale file', locale_file
end
end
52. I18N-SPEC
github.com/tigrish/i18n-spec
describe "config/locales/fr.yml" do
it { should be_a_subset_of ‘config/locales/en.yml’ }
end
53. I18N-SPEC
github.com/tigrish/i18n-spec
describe "config/locales/fr.yml" do
it { should be_a_subset_of ‘config/locales/en.yml’ }
end
describe "config/locales/fr.yml" do
it {
should be_a_complete_translation_of ‘config/locales/en.yml’
}
end
71. if n % 10 == 1 && n % 100 != 11
:one
elsif [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100)
:few
elsif n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100)
:many
else
:other
end
0 : many 10 : many 20 : many 30 : many
1 : one 11 : many 21 : one 30.5 : other
2 : few 12 : many 22 : few
3 : few 13 : many 23 : few
4 : few 14 : many 24 : few
5 : many 15 : many 25 : many
6 : many 16 : many 26 : many
7 : many 17 : many 27 : many
8 : many 18 : many 28 : many
9 : many 19 : many 29 : many
72. kittens:
zero: Sorry, no kittens
other: %{count} kittens
73. <? if kittens.size > 0 ?>
<?= t :kittens,
kittens:
:count => kittens.size ?%>
zero: Sorry, no kittens
<? else ?>
other: %{count} kittens
<?= t :no_kittens ?%>
<? end ?>
74. <? if kittens.size > 0 ?>
<?= t :kittens,
kittens:
:count => kittens.size ?%>
zero: Sorry, no kittens
<? else ?>
other: %{count} kittens
<?= t :no_kittens ?%>
<? end ?>
kittens:
one: One kitten
other: %{count} kittens
75. <? if kittens.size > 0 ?>
<?= t :kittens,
kittens:
:count => kittens.size ?%>
zero: Sorry, no kittens
<? else ?>
other: %{count} kittens
<?= t :no_kittens ?%>
<? end ?>
kittens: kittens:
one: One kitten one: %{count} kitten
other: %{count} kittens other: %{count} kittens
- Anecdote sur le dessin\n- Here presented as two different people, but are often just 1 person\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
- I18n Project Vs. In project app\n
- I18n Project Vs. In project app\n
- I18n Project Vs. In project app\n
- I18n Project Vs. In project app\n
- I18n Project Vs. In project app\n
- Why do we need a default locale in the first place?\n - It&#x2019;s the base that all translations are created from\n
- Why do we need a default locale in the first place?\n - It&#x2019;s the base that all translations are created from\n
English is the universal language\n
English is the universal language\n
English is the universal language\n
NOthing is purer? right? WRONG!!\n
NOthing is purer? right? WRONG!!\n
- Rails says en even though it is really en-US.\n- Change happend end of 2008, at the time i18n didn&#x2019;t support language fallbacks\n- rails-i18n marks the different englishes\n- use whatever locale for your own projects, but en-US for OSS\n
\n
\n
\n
\n
A locale has a cultural or territorial component\nBrazilian portuguese, canadian french, swiss!\n
- There are of course a load of other backends\n- Implement your own by writing a get/set\n
- There are of course a load of other backends\n- Implement your own by writing a get/set\n
- There are of course a load of other backends\n- Implement your own by writing a get/set\n
- There are of course a load of other backends\n- Implement your own by writing a get/set\n
- Might have seen this upgrading to 1.9.2\n- Psych included in 1.9.2 and default\n- Conforms to YAML 1.0\n- Syck to be removed from 1.9.3\n
- Might have seen this upgrading to 1.9.2\n- Psych included in 1.9.2 and default\n- Conforms to YAML 1.0\n- Syck to be removed from 1.9.3\n
- rails-i18n is generated with Locale \n- is compatible since it&#x2019;s the output from Psych\n\n- it would be nice to be able to foresee these file problems\n- Syntax errors aren&#x2019;t the only problem (ex: indentation)\n
- rspec shared examples\n
- rspec shared examples\n
- Advantage is that I don&#x2019;t need to be able to read the locale file to know it&#x2019;s valid\n- It&#x2019;s integrated into my regular development workflow\n- autotest, guard, travis-ci\n
- Advantage is that I don&#x2019;t need to be able to read the locale file to know it&#x2019;s valid\n- It&#x2019;s integrated into my regular development workflow\n- autotest, guard, travis-ci\n
\n
\n
Looks i18n doesn&#x2019;t understand the proper grammer\n
Looks i18n doesn&#x2019;t understand the proper grammer\n
Looks i18n doesn&#x2019;t understand the proper grammer\n
\n
\n
\n
\n
\n
\n
You build the project and it creates ruby / yaml\n
You build the project and it creates ruby / yaml\n
- ruby-cldr formats for i18n\n- By inserting this into config/locales we get proper pluralization rules\n