vocab 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vocab/application.rb +24 -3
- data/lib/vocab/cleaner/android.rb +15 -0
- data/lib/vocab/cleaner/base.rb +14 -0
- data/lib/vocab/cleaner/rails.rb +141 -0
- data/lib/vocab/cleaner.rb +7 -0
- data/lib/vocab/converter/base.rb +17 -0
- data/lib/vocab/converter/rails.rb +86 -0
- data/lib/vocab/converter.rb +6 -0
- data/lib/vocab/extractor/rails.rb +26 -10
- data/lib/vocab/merger/android.rb +39 -3
- data/lib/vocab/merger/rails.rb +18 -0
- data/lib/vocab/translator/rails.rb +4 -0
- data/lib/vocab/version.rb +1 -1
- data/lib/vocab.rb +9 -0
- data/spec/cleaner/android_spec.rb +0 -0
- data/spec/cleaner/base_spec.rb +19 -0
- data/spec/cleaner/rails_spec.rb +79 -0
- data/spec/converter/base_spec.rb +23 -0
- data/spec/converter/rails_spec.rb +32 -0
- data/spec/data/android/locales/values/strings.xml +1 -1
- data/spec/data/android/locales/values-fr/strings.xml +21 -0
- data/spec/data/rails/full/cn.full.yml +0 -0
- data/spec/data/rails/full/en.expected.yml +4 -0
- data/spec/data/rails/full/en.full.yml +4 -0
- data/spec/data/rails/full/es.expected.yml +8 -0
- data/spec/data/rails/full/es.full.yml +8 -0
- data/spec/data/rails/full/fr.expected.yml +5 -0
- data/spec/data/rails/full/fr.full.yml +11 -0
- data/spec/data/rails/full/test.diff.yml +4 -0
- data/spec/data/rails/xml/in_file.xml +16 -0
- data/spec/data/rails/xml/in_file.yml +19 -0
- data/spec/data/rails/xml/out_file_expected.xml +16 -0
- data/spec/data/rails/xml/out_file_expected.yml +19 -0
- data/spec/data/rails/xml/test_file.xml +16 -0
- data/spec/data/rails/xml/test_file.yml +19 -0
- data/spec/extractor/android_spec.rb +2 -2
- data/spec/extractor/rails_spec.rb +15 -0
- data/spec/merger/android_spec.rb +13 -0
- data/spec/merger/rails_spec.rb +7 -0
- data/spec/validator/android_spec.rb +2 -2
- data/vocab.gemspec +4 -0
- metadata +142 -11
@@ -0,0 +1,79 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Vocab::Cleaner::Rails" do
|
4
|
+
|
5
|
+
describe 'clean_file' do
|
6
|
+
|
7
|
+
before( :each ) do
|
8
|
+
@update_dir = "#{vocab_root}/spec/data/rails/full"
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'replaces hex codes with symbols' do
|
12
|
+
file = "#{@update_dir}/es.full.yml"
|
13
|
+
cleaned_filename= "#{@update_dir}/es.full.clean.yml"
|
14
|
+
Vocab::Cleaner::Rails.clean_file( file )
|
15
|
+
expected = File.read( "#{@update_dir}/es.expected.yml" )
|
16
|
+
output = File.open( cleaned_filename, "r:UTF-8" ).read
|
17
|
+
output.strip.should eql( expected.strip )
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'replaces Windows-1252 codes with translatable UTF-8 codes' do
|
21
|
+
file = "#{@update_dir}/en.full.yml"
|
22
|
+
cleaned_filename= "#{@update_dir}/en.full.clean.yml"
|
23
|
+
Vocab::Cleaner::Rails.clean_file( file )
|
24
|
+
expected = File.read( "#{@update_dir}/en.expected.yml" )
|
25
|
+
output = File.open( cleaned_filename, "r:UTF-8" ).read
|
26
|
+
output.strip.should eql( expected.strip )
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'replaces HTML entity codes with symbols' do
|
30
|
+
file = "#{@update_dir}/fr.full.yml"
|
31
|
+
cleaned_filename = "#{@update_dir}/fr.full.clean.yml"
|
32
|
+
Vocab::Cleaner::Rails.clean_file( file )
|
33
|
+
expected = File.read( "#{@update_dir}/fr.expected.yml" )
|
34
|
+
output = File.open( cleaned_filename, "r:UTF-8" ).read
|
35
|
+
output.strip.should eql( expected.strip )
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'removes keys with empty values' do
|
39
|
+
file = "#{@update_dir}/fr.full.yml"
|
40
|
+
cleaned_filename = "#{@update_dir}/fr.full.clean.yml"
|
41
|
+
Vocab::Cleaner::Rails.clean_file( file )
|
42
|
+
output = File.open( cleaned_filename, "r:UTF-8" ).read
|
43
|
+
output.should_not include( "error_facebook:", "collection_controller:", "error_collection" )
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'names clean diff files correctly' do
|
47
|
+
file = "#{@update_dir}/test.diff.yml"
|
48
|
+
cleaned_filename = "#{@update_dir}/test.diff.clean.yml"
|
49
|
+
Vocab::Cleaner::Rails.clean_file( file )
|
50
|
+
File.should exist( cleaned_filename )
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'removes blacklisted keys' do
|
54
|
+
file = "#{@update_dir}/fr.full.yml"
|
55
|
+
cleaned_filename = "#{@update_dir}/fr.full.clean.yml"
|
56
|
+
Vocab::Cleaner::Rails.clean_file( file )
|
57
|
+
output = File.open( cleaned_filename, "r:UTF-8" ).read
|
58
|
+
output.should_not include( "active_record" )
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'files_to_clean' do
|
63
|
+
|
64
|
+
before( :each ) do
|
65
|
+
@update_dir = "#{vocab_root}/spec/data/rails/full"
|
66
|
+
@path = "#{vocab_root}/spec/data/rails/full"
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'finds translation files to clean' do
|
70
|
+
expected = [ "#{@update_dir}/es.full.yml",
|
71
|
+
"#{@update_dir}/cn.full.yml",
|
72
|
+
"#{@update_dir}/fr.full.yml",
|
73
|
+
"#{@update_dir}/en.full.yml",
|
74
|
+
"#{@update_dir}/test.diff.yml" ]
|
75
|
+
Vocab::Cleaner::Rails.files_to_clean( @path ).should =~ ( expected )
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Vocab::Converter::Base" do
|
4
|
+
|
5
|
+
describe 'convert_xml_to_yml' do
|
6
|
+
|
7
|
+
it 'Displays a message if no xml to yml conversion is available' do
|
8
|
+
Vocab.ui.should_receive( :say ).with( "No conversion available" )
|
9
|
+
Vocab::Converter::Base.convert_xml_to_yml()
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'convert_yml_to_xml' do
|
15
|
+
|
16
|
+
it 'Displays a message if no yml to xml conversion is available' do
|
17
|
+
Vocab.ui.should_receive( :say ).with( "No conversion available" )
|
18
|
+
Vocab::Converter::Base.convert_yml_to_xml()
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
|
4
|
+
describe "Vocab::Converter::Rails" do
|
5
|
+
|
6
|
+
before( :each ) do
|
7
|
+
@test_dir = "#{vocab_root}/spec/data/rails/xml"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'convert_xml_to_yml' do
|
11
|
+
it 'converts and xml file to a yml file' do
|
12
|
+
xml_file = "#{@test_dir}/in_file.xml"
|
13
|
+
yml_file = "#{@test_dir}/in_file.yml"
|
14
|
+
Vocab::Converter::Rails.convert_xml_to_yml( xml_file )
|
15
|
+
expected = File.read( "#{@test_dir}/out_file_expected.yml" )
|
16
|
+
output = File.open( yml_file, "r:UTF-8" ).read
|
17
|
+
output.strip.should eql( expected.strip )
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'convert_yml_to_xml' do
|
22
|
+
it 'converts an yml file to xml' do
|
23
|
+
yml_file = "#{@test_dir}/test_file.yml"
|
24
|
+
xml_file = "#{@test_dir}/test_file.xml"
|
25
|
+
Vocab::Converter::Rails.convert_yml_to_xml( yml_file )
|
26
|
+
expected = File.read( "#{@test_dir}/out_file_expected.xml" )
|
27
|
+
output = File.open( xml_file, "r:UTF-8" ).read
|
28
|
+
output.strip.should eql( expected.strip )
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<!-- This is a comment -->
|
6
6
|
<string name="app_current">current</string>
|
7
7
|
<string name="cancel">Cancel</string>
|
8
|
-
<string name="delete">Delete</string>
|
8
|
+
<string name="delete">Delete %1$d</string>
|
9
9
|
<string name="not_in_es">This key not in spanish</string>
|
10
10
|
<string name="debug_key">Should be ignored</string>
|
11
11
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<resources>
|
3
|
+
<string name="app_name">Le Kid Mode</string>
|
4
|
+
<string name="pd_app_name">Le Parent Dashboard</string>
|
5
|
+
<!-- This is a comment -->
|
6
|
+
<string name="app_current">le current</string>
|
7
|
+
<string name="cancel">Cancel</string>
|
8
|
+
<string name="delete">Deletee %2$d</string>
|
9
|
+
<string name="not_in_es">This key not in spanish</string>
|
10
|
+
<string name="debug_key">Should be ignored</string>
|
11
|
+
|
12
|
+
<plurals name="user_count">
|
13
|
+
<item quantity="one">1 user</item>
|
14
|
+
<item quantity="many">%f users</item>
|
15
|
+
</plurals>
|
16
|
+
|
17
|
+
<plurals name="fish_count">
|
18
|
+
<item quantity="one">1 fish</item>
|
19
|
+
<item quantity="many">%d fish</item>
|
20
|
+
</plurals>
|
21
|
+
</resources>
|
File without changes
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
es:
|
3
|
+
controllers:
|
4
|
+
application_controller:
|
5
|
+
error_account_closed: "Su cuenta se ha cerrado. Comuníquese con support@zoodles.com para reactivarla."
|
6
|
+
error_facebook: "Acceso denegado para usuarios conectados a facebook"
|
7
|
+
collection_controller:
|
8
|
+
error_collection: "La colección solicitada no existe"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:es:
|
3
|
+
:controllers:
|
4
|
+
:application_controller:
|
5
|
+
:error_account_closed: "Su cuenta se ha cerrado. Comun\xC3\xADquese con support@zoodles.com para reactivarla."
|
6
|
+
:error_facebook: Acceso denegado para usuarios conectados a facebook
|
7
|
+
:collection_controller:
|
8
|
+
:error_collection: "La colecci\xC3\xB3n solicitada no existe"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<hash>
|
3
|
+
<en.air.launcher-swf.error-dlg-title>ネットワークの問題</en.air.launcher-swf.error-dlg-title>
|
4
|
+
<en.air.launcher-swf.error-install-failed>インストールに失敗しました。</en.air.launcher-swf.error-install-failed>
|
5
|
+
<en.air.launcher-swf.error-msg-server-connect>サーバーに接続できません。
|
6
|
+
しばらくしてからやり直してください。</en.air.launcher-swf.error-msg-server-connect>
|
7
|
+
<en.air.launcher-swf.error-msg-unknown>ズードルズ ブラウザをインストールできません。
|
8
|
+
しばらくしてからやり直してください。</en.air.launcher-swf.error-msg-unknown>
|
9
|
+
<en.air.launcher-swf.error-try-again>F5またはCmd+Rキーを押してやり直してください。</en.air.launcher-swf.error-try-again>
|
10
|
+
<en.air.launcher-swf.prompt-install>今すぐインストール</en.air.launcher-swf.prompt-install>
|
11
|
+
<en.air.launcher-swf.prompt-launch>ゲームを始める</en.air.launcher-swf.prompt-launch>
|
12
|
+
<en.air.launcher-swf.prompt-launching>起動中・・・</en.air.launcher-swf.prompt-launching>
|
13
|
+
<en.air.launcher-swf.prompt-open>ダイアログ画面が現れたら「開く」ボタンをクリックします</en.air.launcher-swf.prompt-open>
|
14
|
+
<en.air.launcher-swf.prompt-open-short>ポップアップで「開く」ボタンをクリックします</en.air.launcher-swf.prompt-open-short>
|
15
|
+
<en.air.launcher-swf.prompt-z2-game-install>ズードルズをインストール</en.air.launcher-swf.prompt-z2-game-install>
|
16
|
+
</hash>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
air:
|
4
|
+
launcher_swf:
|
5
|
+
error_dlg_title: ネットワークの問題
|
6
|
+
error_install_failed: インストールに失敗しました。
|
7
|
+
error_msg_server_connect: |-
|
8
|
+
サーバーに接続できません。
|
9
|
+
しばらくしてからやり直してください。
|
10
|
+
error_msg_unknown: |-
|
11
|
+
ズードルズ ブラウザをインストールできません。
|
12
|
+
しばらくしてからやり直してください。
|
13
|
+
error_try_again: F5またはCmd+Rキーを押してやり直してください。
|
14
|
+
prompt_install: 今すぐインストール
|
15
|
+
prompt_launch: ゲームを始める
|
16
|
+
prompt_launching: 起動中・・・
|
17
|
+
prompt_open: ダイアログ画面が現れたら「開く」ボタンをクリックします
|
18
|
+
prompt_open_short: ポップアップで「開く」ボタンをクリックします
|
19
|
+
prompt_z2_game_install: ズードルズをインストール
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<hash>
|
3
|
+
<en.air.launcher-swf.error-dlg-title>ネットワークの問題</en.air.launcher-swf.error-dlg-title>
|
4
|
+
<en.air.launcher-swf.error-install-failed>インストールに失敗しました。</en.air.launcher-swf.error-install-failed>
|
5
|
+
<en.air.launcher-swf.error-msg-server-connect>サーバーに接続できません。
|
6
|
+
しばらくしてからやり直してください。</en.air.launcher-swf.error-msg-server-connect>
|
7
|
+
<en.air.launcher-swf.error-msg-unknown>ズードルズ ブラウザをインストールできません。
|
8
|
+
しばらくしてからやり直してください。</en.air.launcher-swf.error-msg-unknown>
|
9
|
+
<en.air.launcher-swf.error-try-again>F5またはCmd+Rキーを押してやり直してください。</en.air.launcher-swf.error-try-again>
|
10
|
+
<en.air.launcher-swf.prompt-install>今すぐインストール</en.air.launcher-swf.prompt-install>
|
11
|
+
<en.air.launcher-swf.prompt-launch>ゲームを始める</en.air.launcher-swf.prompt-launch>
|
12
|
+
<en.air.launcher-swf.prompt-launching>起動中・・・</en.air.launcher-swf.prompt-launching>
|
13
|
+
<en.air.launcher-swf.prompt-open>ダイアログ画面が現れたら「開く」ボタンをクリックします</en.air.launcher-swf.prompt-open>
|
14
|
+
<en.air.launcher-swf.prompt-open-short>ポップアップで「開く」ボタンをクリックします</en.air.launcher-swf.prompt-open-short>
|
15
|
+
<en.air.launcher-swf.prompt-z2-game-install>ズードルズをインストール</en.air.launcher-swf.prompt-z2-game-install>
|
16
|
+
</hash>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
air:
|
4
|
+
launcher_swf:
|
5
|
+
error_dlg_title: ネットワークの問題
|
6
|
+
error_install_failed: インストールに失敗しました。
|
7
|
+
error_msg_server_connect: |-
|
8
|
+
サーバーに接続できません。
|
9
|
+
しばらくしてからやり直してください。
|
10
|
+
error_msg_unknown: |-
|
11
|
+
ズードルズ ブラウザをインストールできません。
|
12
|
+
しばらくしてからやり直してください。
|
13
|
+
error_try_again: F5またはCmd+Rキーを押してやり直してください。
|
14
|
+
prompt_install: 今すぐインストール
|
15
|
+
prompt_launch: ゲームを始める
|
16
|
+
prompt_launching: 起動中・・・
|
17
|
+
prompt_open: ダイアログ画面が現れたら「開く」ボタンをクリックします
|
18
|
+
prompt_open_short: ポップアップで「開く」ボタンをクリックします
|
19
|
+
prompt_z2_game_install: ズードルズをインストール
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<hash>
|
3
|
+
<en.air.launcher-swf.error-dlg-title>ネットワークの問題</en.air.launcher-swf.error-dlg-title>
|
4
|
+
<en.air.launcher-swf.error-install-failed>インストールに失敗しました。</en.air.launcher-swf.error-install-failed>
|
5
|
+
<en.air.launcher-swf.error-msg-server-connect>サーバーに接続できません。
|
6
|
+
しばらくしてからやり直してください。</en.air.launcher-swf.error-msg-server-connect>
|
7
|
+
<en.air.launcher-swf.error-msg-unknown>ズードルズ ブラウザをインストールできません。
|
8
|
+
しばらくしてからやり直してください。</en.air.launcher-swf.error-msg-unknown>
|
9
|
+
<en.air.launcher-swf.error-try-again>F5またはCmd+Rキーを押してやり直してください。</en.air.launcher-swf.error-try-again>
|
10
|
+
<en.air.launcher-swf.prompt-install>今すぐインストール</en.air.launcher-swf.prompt-install>
|
11
|
+
<en.air.launcher-swf.prompt-launch>ゲームを始める</en.air.launcher-swf.prompt-launch>
|
12
|
+
<en.air.launcher-swf.prompt-launching>起動中・・・</en.air.launcher-swf.prompt-launching>
|
13
|
+
<en.air.launcher-swf.prompt-open>ダイアログ画面が現れたら「開く」ボタンをクリックします</en.air.launcher-swf.prompt-open>
|
14
|
+
<en.air.launcher-swf.prompt-open-short>ポップアップで「開く」ボタンをクリックします</en.air.launcher-swf.prompt-open-short>
|
15
|
+
<en.air.launcher-swf.prompt-z2-game-install>ズードルズをインストール</en.air.launcher-swf.prompt-z2-game-install>
|
16
|
+
</hash>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
air:
|
4
|
+
launcher_swf:
|
5
|
+
error_dlg_title: ネットワークの問題
|
6
|
+
error_install_failed: インストールに失敗しました。
|
7
|
+
error_msg_server_connect: |-
|
8
|
+
サーバーに接続できません。
|
9
|
+
しばらくしてからやり直してください。
|
10
|
+
error_msg_unknown: |-
|
11
|
+
ズードルズ ブラウザをインストールできません。
|
12
|
+
しばらくしてからやり直してください。
|
13
|
+
error_try_again: F5またはCmd+Rキーを押してやり直してください。
|
14
|
+
prompt_install: 今すぐインストール
|
15
|
+
prompt_launch: ゲームを始める
|
16
|
+
prompt_launching: 起動中・・・
|
17
|
+
prompt_open: ダイアログ画面が現れたら「開く」ボタンをクリックします
|
18
|
+
prompt_open_short: ポップアップで「開く」ボタンをクリックします
|
19
|
+
prompt_z2_game_install: ズードルズをインストール
|
@@ -11,7 +11,7 @@ describe "Vocab::Extractor::Android" do
|
|
11
11
|
it "extracts hash of current string translations" do
|
12
12
|
actual = Vocab::Extractor::Android.current_strings( @locale )
|
13
13
|
actual.should eql( { "app_name" =>"Kid Mode",
|
14
|
-
"delete" =>"Delete",
|
14
|
+
"delete" =>"Delete %1$d",
|
15
15
|
"cancel" =>"Cancel",
|
16
16
|
"app_current"=>"current",
|
17
17
|
"pd_app_name"=>"Parent Dashboard",
|
@@ -103,7 +103,7 @@ describe "Vocab::Extractor::Android" do
|
|
103
103
|
it 'returns file names for completed translations' do
|
104
104
|
dir = "#{vocab_root}/spec/data/android/locales"
|
105
105
|
actual = Vocab::Extractor::Android.examples( dir )
|
106
|
-
actual.should
|
106
|
+
actual.should include( "tmp/translations/values-es" )
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'uses the conventional android locales directory by default' do
|
@@ -14,6 +14,21 @@ describe "Vocab::Extractor::Rails" do
|
|
14
14
|
|
15
15
|
end
|
16
16
|
|
17
|
+
describe 'extract_all' do
|
18
|
+
|
19
|
+
it 'writes the translation for each locale to its own file' do
|
20
|
+
translation = { :en => { :full => 'translation' } }
|
21
|
+
locales_path = "#{vocab_root}/spec/data/rails/locales"
|
22
|
+
result_dir = "#{vocab_root}/spec/tmp"
|
23
|
+
Vocab::Extractor::Rails.extract_all( locales_path, result_dir )
|
24
|
+
Dir.entries(result_dir).should include( "en.full.yml" )
|
25
|
+
Dir.entries(result_dir).should include( "es.full.yml" )
|
26
|
+
File.delete( "#{result_dir}/en.full.yml" )
|
27
|
+
File.delete( "#{result_dir}/es.full.yml")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
17
32
|
describe 'hasherize' do
|
18
33
|
|
19
34
|
it 'writes the diff in standard rails locale yaml format' do
|
data/spec/merger/android_spec.rb
CHANGED
@@ -37,7 +37,20 @@ describe "Vocab::Merger::Android" do
|
|
37
37
|
@merged['pd_app_name'].should eql( 'el Panel para padres bien' )
|
38
38
|
@merged['delete'].should eql( "La función Child Lock" )
|
39
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "check_matching_format_strings" do
|
43
|
+
it 'warns about format string changes in singular strings' do
|
44
|
+
@merger = Vocab::Merger::Android.new( @merge_dir, @update_dir )
|
45
|
+
Vocab.ui.should_receive( :warn ).with( "Format string mismatch for key delete while merging #{@merge_dir}/values-fr/strings.xml. \n English: Delete %1$d \n Translation: Deletee %2$d" )
|
46
|
+
@merger.check_matching_format_strings( 'delete', "Deletee %2$d", "#{@merge_dir}/values-fr/strings.xml", :string_format_changed? )
|
47
|
+
end
|
40
48
|
|
49
|
+
it 'warns about format string changes in plurals' do
|
50
|
+
@merger = Vocab::Merger::Android.new( @merge_dir, @update_dir )
|
51
|
+
Vocab.ui.should_receive( :warn ).with( "Format string mismatch for key user_count, quantity many while merging #{@merge_dir}/values-fr/strings.xml. \n English: %d users \n Translation: %f users" )
|
52
|
+
@merger.check_matching_format_strings( 'user_count', { "one" => "1 user", "many" => "%f users" }, "#{@merge_dir}/values-fr/strings.xml", :plural_format_changed? )
|
53
|
+
end
|
41
54
|
end
|
42
55
|
|
43
56
|
describe 'merge_file' do
|
data/spec/merger/rails_spec.rb
CHANGED
@@ -144,7 +144,14 @@ describe "Vocab::Merger::Rails" do
|
|
144
144
|
File.delete( spanish_file ) if File.exists?( spanish_file )
|
145
145
|
File.delete( english_file ) if File.exists?( english_file )
|
146
146
|
end
|
147
|
+
end
|
147
148
|
|
149
|
+
describe "check_matching_interpolations" do
|
150
|
+
it 'warns about interpolation changes' do
|
151
|
+
@merger = Vocab::Merger::Rails.new
|
152
|
+
Vocab.ui.should_receive( :warn ).with( "Interpolation mismatch for key test_key while merging test.yml. \n English: %{test_name} Translation: %{best_name}" )
|
153
|
+
@merger.check_matching_interpolations( 'test_key', "%{test_name}", "%{best_name}", "test.yml")
|
154
|
+
end
|
148
155
|
end
|
149
156
|
|
150
157
|
describe 'translation_locales' do
|
@@ -30,8 +30,8 @@ describe "Vocab::Validator::Android" do
|
|
30
30
|
describe 'files_to_validate' do
|
31
31
|
|
32
32
|
it 'returns the locale files to validate' do
|
33
|
-
|
34
|
-
@validator.files_to_validate.should
|
33
|
+
file = "#{@locales_dir}/values-es/strings.xml"
|
34
|
+
@validator.files_to_validate.should include( file )
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
data/vocab.gemspec
CHANGED
@@ -20,6 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
# specify any dependencies here; for example:
|
21
21
|
s.add_dependency "i18n"
|
22
22
|
s.add_dependency "nokogiri"
|
23
|
+
s.add_dependency "htmlentities", "~> 4.3.1"
|
24
|
+
s.add_dependency "ya2yaml"
|
25
|
+
s.add_dependency "active_support"
|
26
|
+
s.add_dependency "builder"
|
23
27
|
s.add_development_dependency "rspec", "~> 2.7.0"
|
24
28
|
s.add_development_dependency "simplecov"
|
25
29
|
# s.add_runtime_dependency "rest-client"
|