traduco 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/LICENSE +33 -0
- data/README.md +182 -0
- data/bin/traduco +8 -0
- data/library/traduco.rb +10 -0
- data/library/traduco/cli.rb +186 -0
- data/library/traduco/encoding.rb +20 -0
- data/library/traduco/formatters.rb +12 -0
- data/library/traduco/formatters/abstract.rb +164 -0
- data/library/traduco/formatters/android.rb +152 -0
- data/library/traduco/formatters/apple.rb +125 -0
- data/library/traduco/formatters/flash.rb +110 -0
- data/library/traduco/formatters/gettext.rb +98 -0
- data/library/traduco/formatters/jquery.rb +96 -0
- data/library/traduco/l10nfile.rb +209 -0
- data/library/traduco/runner.rb +301 -0
- data/test/fixtures/en-1.json +12 -0
- data/test/fixtures/en-1.po +16 -0
- data/test/fixtures/en-1.strings +10 -0
- data/test/fixtures/en-2.po +23 -0
- data/test/fixtures/fr-1.xml +10 -0
- data/test/fixtures/strings-1.txt +17 -0
- data/test/fixtures/strings-2.txt +5 -0
- data/test/fixtures/strings-3.txt +5 -0
- data/test/fixtures/test-output-1.txt +12 -0
- data/test/fixtures/test-output-2.txt +12 -0
- data/test/fixtures/test-output-3.txt +18 -0
- data/test/fixtures/test-output-4.txt +21 -0
- data/test/fixtures/test-output-5.txt +11 -0
- data/test/fixtures/test-output-6.txt +10 -0
- data/test/fixtures/test-output-7.txt +14 -0
- data/test/fixtures/test-output-8.txt +9 -0
- data/test/fixtures/test-output-9.txt +21 -0
- data/test/traduco_test.rb +98 -0
- metadata +125 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
[[Uncategorized]]
|
2
|
+
[key5]
|
3
|
+
en = A new string
|
4
|
+
|
5
|
+
[[My Strings]]
|
6
|
+
[key1]
|
7
|
+
en = key1-english
|
8
|
+
tags = tag1
|
9
|
+
comment = This is a comment
|
10
|
+
es = key1-spanish
|
11
|
+
fr = key1-french
|
12
|
+
[key2]
|
13
|
+
en = key2-english
|
14
|
+
tags = tag2
|
15
|
+
fr = key2-french
|
16
|
+
[key3]
|
17
|
+
en = key3-english
|
18
|
+
tags = tag1,tag2
|
19
|
+
es = key3-spanish
|
20
|
+
[key4]
|
21
|
+
en = key4-english
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!-- Android Strings File -->
|
3
|
+
<!-- Generated by Twine <%= Twine::VERSION %> -->
|
4
|
+
<!-- Language: en -->
|
5
|
+
<resources>
|
6
|
+
<!-- SECTION: My Strings -->
|
7
|
+
<string name="parameterized_string">The %1$s brown fox jumps over the %2$s dog %3$d times.</string>
|
8
|
+
<string name="percentage_string">This product is %d%% off.</string>
|
9
|
+
</resources>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
[[Uncategorized]]
|
2
|
+
[key5]
|
3
|
+
en = A new string
|
4
|
+
|
5
|
+
[[My Strings]]
|
6
|
+
[key1]
|
7
|
+
en = key1-english
|
8
|
+
tags = tag1
|
9
|
+
comment = This is a comment
|
10
|
+
es = key1-spanish
|
11
|
+
fr = key1-french
|
12
|
+
[key2]
|
13
|
+
en = key2-english
|
14
|
+
tags = tag2
|
15
|
+
fr = key2-french
|
16
|
+
[key3]
|
17
|
+
en = key3-english
|
18
|
+
tags = tag1,tag2
|
19
|
+
es = key3-spanish
|
20
|
+
[key4]
|
21
|
+
en = A multiline string\ncan occur
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'test/unit'
|
4
|
+
require 'traduco'
|
5
|
+
|
6
|
+
class TraducoTest < Test::Unit::TestCase
|
7
|
+
def test_generate_string_file_1
|
8
|
+
Dir.mktmpdir do |dir|
|
9
|
+
output_path = File.join(dir, 'fr.xml')
|
10
|
+
Traduco::Runner.run(%W(generate-string-file test/fixtures/strings-1.txt #{output_path} --include-untranslated))
|
11
|
+
assert_equal(ERB.new(File.read('test/fixtures/test-output-1.txt')).result, File.read(output_path))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_generate_string_file_2
|
16
|
+
Dir.mktmpdir do |dir|
|
17
|
+
output_path = File.join(dir, 'en.strings')
|
18
|
+
Traduco::Runner.run(%W(generate-string-file test/fixtures/strings-1.txt #{output_path} -t tag1))
|
19
|
+
assert_equal(ERB.new(File.read('test/fixtures/test-output-2.txt')).result, File.read(output_path))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_generate_string_file_3
|
24
|
+
Dir.mktmpdir do |dir|
|
25
|
+
output_path = File.join(dir, 'en.json')
|
26
|
+
Traduco::Runner.run(%W(generate-string-file test/fixtures/strings-1.txt #{output_path} -t tag1))
|
27
|
+
assert_equal(ERB.new(File.read('test/fixtures/test-output-5.txt')).result, File.read(output_path))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_generate_string_file_4
|
32
|
+
Dir.mktmpdir do |dir|
|
33
|
+
output_path = File.join(dir, 'en.strings')
|
34
|
+
Traduco::Runner.run(%W(generate-string-file test/fixtures/strings-2.txt #{output_path} -t tag1))
|
35
|
+
assert_equal(ERB.new(File.read('test/fixtures/test-output-6.txt')).result, File.read(output_path))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_generate_string_file_5
|
40
|
+
Dir.mktmpdir do |dir|
|
41
|
+
output_path = File.join(dir, 'en.po')
|
42
|
+
Traduco::Runner.run(%W(generate-string-file test/fixtures/strings-1.txt #{output_path} -t tag1))
|
43
|
+
assert_equal(ERB.new(File.read('test/fixtures/test-output-7.txt')).result, File.read(output_path))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_generate_string_file_6
|
48
|
+
Dir.mktmpdir do |dir|
|
49
|
+
output_path = File.join(dir, 'en.xml')
|
50
|
+
Traduco::Runner.run(%W(generate-string-file test/fixtures/strings-3.txt #{output_path}))
|
51
|
+
assert_equal(ERB.new(File.read('test/fixtures/test-output-8.txt')).result, File.read(output_path))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_consume_string_file_1
|
56
|
+
Dir.mktmpdir do |dir|
|
57
|
+
output_path = File.join(dir, 'strings.txt')
|
58
|
+
Traduco::Runner.run(%W(consume-string-file test/fixtures/strings-1.txt test/fixtures/fr-1.xml -o #{output_path} -l fr))
|
59
|
+
assert_equal(File.read('test/fixtures/test-output-3.txt'), File.read(output_path))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_consume_string_file_2
|
64
|
+
Dir.mktmpdir do |dir|
|
65
|
+
output_path = File.join(dir, 'strings.txt')
|
66
|
+
Traduco::Runner.run(%W(consume-string-file test/fixtures/strings-1.txt test/fixtures/en-1.strings -o #{output_path} -l en -a))
|
67
|
+
assert_equal(File.read('test/fixtures/test-output-4.txt'), File.read(output_path))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_consume_string_file_3
|
72
|
+
Dir.mktmpdir do |dir|
|
73
|
+
output_path = File.join(dir, 'strings.txt')
|
74
|
+
Traduco::Runner.run(%W(consume-string-file test/fixtures/strings-1.txt test/fixtures/en-1.json -o #{output_path} -l en -a))
|
75
|
+
assert_equal(File.read('test/fixtures/test-output-4.txt'), File.read(output_path))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_consume_string_file_4
|
80
|
+
Dir.mktmpdir do |dir|
|
81
|
+
output_path = File.join(dir, 'strings.txt')
|
82
|
+
Traduco::Runner.run(%W(consume-string-file test/fixtures/strings-1.txt test/fixtures/en-1.po -o #{output_path} -l en -a))
|
83
|
+
assert_equal(File.read('test/fixtures/test-output-4.txt'), File.read(output_path))
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_consume_string_file_5
|
88
|
+
Dir.mktmpdir do |dir|
|
89
|
+
output_path = File.join(dir, 'strings.txt')
|
90
|
+
Traduco::Runner.run(%W(consume-string-file test/fixtures/strings-1.txt test/fixtures/en-2.po -o #{output_path} -l en -a))
|
91
|
+
assert_equal(File.read('test/fixtures/test-output-9.txt'), File.read(output_path))
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_generate_report_1
|
96
|
+
Traduco::Runner.run(%w(generate-report test/fixtures/strings-1.txt))
|
97
|
+
end
|
98
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: traduco
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 9
|
8
|
+
- 0
|
9
|
+
version: 0.9.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Joseph Earl
|
13
|
+
- Sebastian Celis
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2013-07-02 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rubyzip
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 9
|
31
|
+
- 5
|
32
|
+
version: 0.9.5
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rake
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 9
|
45
|
+
- 2
|
46
|
+
version: 0.9.2
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
description: " Traduco is a command line tool for managing your strings and their translations.\n\n It is geared toward Mac OS X, iOS, and Android developers.\n"
|
50
|
+
email: traduco@mobiata.com
|
51
|
+
executables:
|
52
|
+
- traduco
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- Gemfile
|
59
|
+
- README.md
|
60
|
+
- LICENSE
|
61
|
+
- library/traduco/cli.rb
|
62
|
+
- library/traduco/encoding.rb
|
63
|
+
- library/traduco/formatters/abstract.rb
|
64
|
+
- library/traduco/formatters/android.rb
|
65
|
+
- library/traduco/formatters/apple.rb
|
66
|
+
- library/traduco/formatters/flash.rb
|
67
|
+
- library/traduco/formatters/gettext.rb
|
68
|
+
- library/traduco/formatters/jquery.rb
|
69
|
+
- library/traduco/formatters.rb
|
70
|
+
- library/traduco/l10nfile.rb
|
71
|
+
- library/traduco/runner.rb
|
72
|
+
- library/traduco.rb
|
73
|
+
- bin/traduco
|
74
|
+
- test/fixtures/en-1.json
|
75
|
+
- test/fixtures/en-1.po
|
76
|
+
- test/fixtures/en-1.strings
|
77
|
+
- test/fixtures/en-2.po
|
78
|
+
- test/fixtures/fr-1.xml
|
79
|
+
- test/fixtures/strings-1.txt
|
80
|
+
- test/fixtures/strings-2.txt
|
81
|
+
- test/fixtures/strings-3.txt
|
82
|
+
- test/fixtures/test-output-1.txt
|
83
|
+
- test/fixtures/test-output-2.txt
|
84
|
+
- test/fixtures/test-output-3.txt
|
85
|
+
- test/fixtures/test-output-4.txt
|
86
|
+
- test/fixtures/test-output-5.txt
|
87
|
+
- test/fixtures/test-output-6.txt
|
88
|
+
- test/fixtures/test-output-7.txt
|
89
|
+
- test/fixtures/test-output-8.txt
|
90
|
+
- test/fixtures/test-output-9.txt
|
91
|
+
- test/traduco_test.rb
|
92
|
+
has_rdoc: true
|
93
|
+
homepage: https://github.com/mobiata/traduco
|
94
|
+
licenses: []
|
95
|
+
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 1
|
107
|
+
- 8
|
108
|
+
- 7
|
109
|
+
version: 1.8.7
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
requirements: []
|
118
|
+
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.3.6
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Manage strings and their translations for your iOS and Android projects.
|
124
|
+
test_files:
|
125
|
+
- test/traduco_test.rb
|