i18n_po_tools 0.9.1 → 0.10.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.
- checksums.yaml +5 -13
- data/Changelog.txt +15 -0
- data/Readme.md +23 -22
- data/Readme.ru.md +3 -2
- data/i18n_yml_tools.gemspec +5 -7
- data/lib/i18n_po_tools.rb +2 -1
- data/lib/i18n_po_tools/cli.rb +2 -0
- data/lib/i18n_po_tools/core_ext/dotted_hash.rb +1 -0
- data/lib/i18n_po_tools/data/plurals.rb +1 -1
- data/lib/i18n_po_tools/formats.rb +4 -0
- data/lib/i18n_po_tools/formats/android_format.rb +1 -0
- data/lib/i18n_po_tools/formats/base_format.rb +4 -0
- data/lib/i18n_po_tools/formats/basic_flat_yaml_format.rb +1 -0
- data/lib/i18n_po_tools/formats/csv_format.rb +1 -0
- data/lib/i18n_po_tools/formats/ios_format.rb +1 -0
- data/lib/i18n_po_tools/formats/po_format.rb +1 -0
- data/lib/i18n_po_tools/formats/properties_format.rb +21 -0
- data/lib/i18n_po_tools/formats/rails_yaml_format.rb +1 -0
- data/lib/i18n_po_tools/plural_message.rb +1 -0
- data/lib/i18n_po_tools/utils/data.rb +1 -0
- data/lib/i18n_po_tools/utils/ios_strings.rb +1 -0
- data/lib/i18n_po_tools/utils/locfile.rb +1 -0
- data/lib/i18n_po_tools/utils/po.rb +1 -0
- data/lib/i18n_po_tools/version.rb +2 -1
- metadata +35 -36
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NDJlZDEzOWQ3YzBlZWMxODgzMWQ1MDk1OTdmZTM1YTg0ZTI5ODIzYQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1a3097c68e8cadfa401d32f7e661252ef25156d3
|
4
|
+
data.tar.gz: 5c5c3b02fe625a453b5dafd46dd5db890e4a163b
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NzY2NzNkMjg3YTc5ZGVhNDY0YTIyYjc5YzhlMWRlMzU4MGUxMmRmNzM2NjA5
|
11
|
-
OWU1MzBhNTE5MjJhMDNjZjFkZmJjZDlhNDFlNjZhNTM0NTFiOTE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTIwN2QzZmExNDEwNjM4NTVkMWY0ZTlmNmY2ZjNlYTk3NDM3MjYwMTFkYWFh
|
14
|
-
ODY4OTk1ZWM2MmY2OGMwMWI3ZGI2YmM5ZTdlYzAwMTRhMDcxZDM4MDBkNjU2
|
15
|
-
MTY1MjhmMDM1ZTY2OTVhMjQyMjhhOTQ4N2MyNWY3YzM2MDE0YmM=
|
6
|
+
metadata.gz: 5c30634239bc62560db75176d9fc00e8232fdabe259f45fcd5a50d9e4eb29a3e1830cd8a75da480bbca3a15a8a6f0bd1c079b390a65fb43cdf24ac44f889fce5
|
7
|
+
data.tar.gz: 65c7795d800cea29a921e4dab538446d0e5ed2392aacb4dc995a552ecb5fcb78d8df3eb48e48da1e5bac688b6e8fc4ac6c3a1ecd034d813650bb5731b13698ff
|
data/Changelog.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
Changelog
|
2
|
+
----------
|
3
|
+
|
4
|
+
|
5
|
+
TODO: 1.0.0
|
6
|
+
==================
|
7
|
+
+ Support for plural messages in rails_yaml format.
|
8
|
+
+ Translate Readme.txt and Design.txt to English
|
9
|
+
+ Add examples and docs for Locfile
|
10
|
+
|
11
|
+
|
12
|
+
0.10.0 [2015-05-28]
|
13
|
+
==================
|
14
|
+
- Output dirs autocreation.
|
15
|
+
- Added Java properties format.
|
1
16
|
|
2
17
|
|
3
18
|
0.9.1 [2014-09-23]
|
data/Readme.md
CHANGED
@@ -3,11 +3,12 @@
|
|
3
3
|
Utils to convert translations from source formats to PO/POT Gettex and vise versa. It allows to separate translations from development of apps.
|
4
4
|
|
5
5
|
Supported input/output formats:
|
6
|
-
* [iOS and OS X String Resources]
|
7
|
-
* [Android String XML]
|
8
|
-
* [Gettext PO/POT]
|
9
|
-
* [Rails YAML]
|
6
|
+
* [iOS and OS X String Resources](http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html) (format: ios)
|
7
|
+
* [Android String XML](http://developer.android.com/guide/topics/resources/string-resource.html) (format: android)
|
8
|
+
* [Gettext PO/POT](http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/PO-Files.html) (format:po and pot)
|
9
|
+
* [Rails YAML](http://guides.rubyonrails.org/i18n.html) (format: rails-yaml)
|
10
10
|
* Basic flat YAML (format: flat-yaml)
|
11
|
+
* [Java properties](http://en.wikipedia.org/wiki/.properties) (format: properties)
|
11
12
|
* CVS for easy exchange with other apps (format: csv-yaml)
|
12
13
|
|
13
14
|
Direct converation between any formats supported.
|
@@ -16,7 +17,7 @@ About design decision you can read in the Design.txt.
|
|
16
17
|
|
17
18
|
Rails YAML and PO supports plural forms of messages. Example: 1 message, 2 messages.
|
18
19
|
|
19
|
-
Sorry, more info only in Russian in the Readme.
|
20
|
+
Sorry, more info only in Russian in the Readme.ru.md file.
|
20
21
|
|
21
22
|
|
22
23
|
## Installation
|
@@ -38,34 +39,34 @@ Or install it yourself as:
|
|
38
39
|
|
39
40
|
Command: i18n-po [OPTIONS]
|
40
41
|
|
41
|
-
Options
|
42
|
+
Options:
|
42
43
|
-i, --input FILENAME input filename (default STDIN)
|
43
44
|
-b, --base FILENAME base language input filename (only for po output mode)
|
44
45
|
-o, --output FILENAME output filename (default STDOUT)
|
45
46
|
-f, --from FORMAT input file format (default is autodetect by ext)
|
46
|
-
(rails_yaml, flat_yaml, po, pot, ios, android, csv)
|
47
|
+
(rails_yaml, flat_yaml, po, pot, ios, android, properties, csv)
|
47
48
|
-t, --to FORMAT output file format (default is autodetect by ext)
|
48
|
-
(rails_yaml, flat_yaml, po, pot, ios, android, csv)
|
49
|
+
(rails_yaml, flat_yaml, po, pot, ios, android, properties, csv)
|
49
50
|
-l, --language LANGUAGE input file language (only for po or rails_yaml output mode)
|
50
51
|
-h, --help help
|
51
52
|
|
52
|
-
Examples:
|
53
|
-
1) First import (generation of PO file) from Rails YAML file:
|
54
|
-
i18n-po --input ~/projects/rails_app/config/locales/devise.en.yml --language en \
|
55
|
-
|
56
|
-
|
53
|
+
Examples:
|
54
|
+
1) First import (generation of PO file) from Rails YAML file:
|
55
|
+
i18n-po --input ~/projects/rails_app/config/locales/devise.en.yml --language en \
|
56
|
+
--base ~/projects/rails_app/config/locales/devise.ru.yml \
|
57
|
+
--output ~/projects/translations/rails_app/devise.en.po
|
57
58
|
|
58
|
-
2) Generation of translation template (POT file) from Rails YAML file:
|
59
|
-
i18n-po --input ~/projects/rails_app/config/locales/devise.ru.yml \
|
60
|
-
|
59
|
+
2) Generation of translation template (POT file) from Rails YAML file:
|
60
|
+
i18n-po --input ~/projects/rails_app/config/locales/devise.ru.yml \
|
61
|
+
--output ~/projects/translations/rails_app/devise.en.pot
|
61
62
|
|
62
|
-
3) Generation of Rails YAML file from PO file:
|
63
|
-
i18n-po --input ~/projects/translations/rails_app/devise.en.po --language en \
|
64
|
-
|
63
|
+
3) Generation of Rails YAML file from PO file:
|
64
|
+
i18n-po --input ~/projects/translations/rails_app/devise.en.po --language en \
|
65
|
+
--output ~/projects/rails_app/config/locales/devise.en.yml
|
65
66
|
|
66
|
-
4) Translation convertation from iOS to Android format:
|
67
|
-
i18n-po --input ~/projects/ios_app/Localizable.strings \
|
68
|
-
|
67
|
+
4) Translation convertation from iOS to Android format:
|
68
|
+
i18n-po --input ~/projects/ios_app/Localizable.strings \
|
69
|
+
--output ~/projects/android_app/en/strings.xml
|
69
70
|
|
70
71
|
|
71
72
|
## Contributing
|
data/Readme.ru.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
* [Gettext PO/POT][http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/PO-Files.html] (формат: po или pot)
|
9
9
|
* [Rails YAML][http://guides.rubyonrails.org/i18n.html] (формат: rails-yaml)
|
10
10
|
* Простой плоский формат YAML (формат: flat-yaml)
|
11
|
+
* Java properties (формат: properties)
|
11
12
|
* CVS для упрощенного обмена с другими программами (формат: csv-yaml)
|
12
13
|
|
13
14
|
Возможна прямая конвертация между любыми поддерживаемыми форматами.
|
@@ -41,9 +42,9 @@ Rails YAML и PO поддерживают специальный вид стро
|
|
41
42
|
-b, --base FILENAME base language input filename (only for po output mode)
|
42
43
|
-o, --output FILENAME output filename (default STDOUT)
|
43
44
|
-f, --from FORMAT input file format (default is autodetect by ext)
|
44
|
-
(rails_yaml, flat_yaml, po, pot, ios, android, csv)
|
45
|
+
(rails_yaml, flat_yaml, po, pot, ios, android, properties, csv)
|
45
46
|
-t, --to FORMAT output file format (default is autodetect by ext)
|
46
|
-
(rails_yaml, flat_yaml, po, pot, ios, android, csv)
|
47
|
+
(rails_yaml, flat_yaml, po, pot, ios, android, properties, csv)
|
47
48
|
-l, --language LANGUAGE input file language (only for po or rails_yaml output mode)
|
48
49
|
-h, --help help
|
49
50
|
|
data/i18n_yml_tools.gemspec
CHANGED
@@ -15,13 +15,9 @@ Gem::Specification.new do |spec|
|
|
15
15
|
Utils to convert translations from source formats to PO/POT Gettex and vise versa.
|
16
16
|
It allows to separate translations from development of apps.
|
17
17
|
|
18
|
-
Supported input/output formats:
|
19
|
-
|
20
|
-
|
21
|
-
* Gettext PO/POT
|
22
|
-
* Rails YAML
|
23
|
-
* Basic flat YAML
|
24
|
-
* CVS for easy exchange with other apps
|
18
|
+
Supported input/output formats: iOS and OS X String Resources, Android String XML,
|
19
|
+
Gettext PO/POT, Rails YAML, Basic flat YAML, Java properties,
|
20
|
+
CVS for easy exchange with other apps.
|
25
21
|
|
26
22
|
Direct converation between any formats supported.
|
27
23
|
|
@@ -39,6 +35,8 @@ EOF
|
|
39
35
|
spec.add_runtime_dependency "get_pomo", "= 0.9.0"
|
40
36
|
#for blank?/present?
|
41
37
|
spec.add_runtime_dependency "activesupport", "~> 4.1.6"
|
38
|
+
#for Java .properties file format
|
39
|
+
spec.add_runtime_dependency "java-properties", "~> 0.0.2"
|
42
40
|
|
43
41
|
|
44
42
|
spec.add_development_dependency "bundler", "~> 1.3"
|
data/lib/i18n_po_tools.rb
CHANGED
@@ -11,7 +11,7 @@ require "i18n_po_tools/core_ext/dotted_hash"
|
|
11
11
|
require "i18n_po_tools/formats"
|
12
12
|
|
13
13
|
module I18nPoTools
|
14
|
-
FORMATS = %w[rails_yaml flat_yaml po pot ios android csv]
|
14
|
+
FORMATS = %w[rails_yaml flat_yaml po pot ios android properties csv]
|
15
15
|
|
16
16
|
EXT_TO_FORMAT = {
|
17
17
|
:yml => :rails_yaml,
|
@@ -19,6 +19,7 @@ module I18nPoTools
|
|
19
19
|
:pot => :pot,
|
20
20
|
:strings => :ios,
|
21
21
|
:xml => :android,
|
22
|
+
:properties => :properties,
|
22
23
|
:csv => :csv
|
23
24
|
}
|
24
25
|
end
|
data/lib/i18n_po_tools/cli.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'optparse'
|
2
3
|
|
3
4
|
module I18nPoTools
|
@@ -15,6 +16,7 @@ module I18nPoTools
|
|
15
16
|
opt.separator "* Gettext PO/POT"
|
16
17
|
opt.separator "* Rails YAML"
|
17
18
|
opt.separator "* Basic flat YAML"
|
19
|
+
opt.separator "* Java properties"
|
18
20
|
opt.separator "* CVS for easy exchange with other apps"
|
19
21
|
opt.separator ""
|
20
22
|
opt.separator "Direct converation between any formats supported."
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'i18n_po_tools/formats/base_format'
|
2
3
|
require 'i18n_po_tools/formats/rails_yaml_format'
|
3
4
|
require 'i18n_po_tools/formats/basic_flat_yaml_format'
|
4
5
|
require 'i18n_po_tools/formats/po_format'
|
5
6
|
require 'i18n_po_tools/formats/ios_format'
|
6
7
|
require 'i18n_po_tools/formats/android_format'
|
8
|
+
require 'i18n_po_tools/formats/properties_format'
|
7
9
|
require 'i18n_po_tools/formats/csv_format'
|
8
10
|
|
9
11
|
module I18nPoTools
|
@@ -23,6 +25,8 @@ module I18nPoTools
|
|
23
25
|
IosFormat.new
|
24
26
|
when :android
|
25
27
|
AndroidFormat.new
|
28
|
+
when :properties
|
29
|
+
PropertiesFormat.new
|
26
30
|
when :csv
|
27
31
|
CsvFormat.new
|
28
32
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'fileutils'
|
3
|
+
|
1
4
|
module I18nPoTools
|
2
5
|
module Formats
|
3
6
|
class BaseFormat
|
@@ -18,6 +21,7 @@ module I18nPoTools
|
|
18
21
|
end
|
19
22
|
|
20
23
|
def write_file(output_filename, data)
|
24
|
+
FileUtils.mkdir_p File.dirname(output_filename)
|
21
25
|
if output_filename.present?
|
22
26
|
File.open(output_filename, "w:"+file_encoding) do |f|
|
23
27
|
f << data
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'java-properties'
|
3
|
+
|
4
|
+
module I18nPoTools
|
5
|
+
module Formats
|
6
|
+
class PropertiesFormat < BaseFormat
|
7
|
+
def read(input_filename)
|
8
|
+
content = read_file(input_filename)
|
9
|
+
props = JavaProperties.parse(content)
|
10
|
+
h = {}
|
11
|
+
props.each{|key,value| h[key.to_s]=value }
|
12
|
+
h
|
13
|
+
end
|
14
|
+
|
15
|
+
def write(output_filename, data)
|
16
|
+
content = JavaProperties.generate(hash)
|
17
|
+
write_file(output_filename, content)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_po_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Stepin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -42,85 +42,83 @@ dependencies:
|
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.1.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.1.6
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: java-properties
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.2
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '1.3'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1.3'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: gem-release
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
|
-
description:
|
98
|
-
and vise versa.
|
99
|
-
|
111
|
+
description: |
|
112
|
+
Utils to convert translations from source formats to PO/POT Gettex and vise versa.
|
100
113
|
It allows to separate translations from development of apps.
|
101
114
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
* iOS and OS X String Resources
|
106
|
-
|
107
|
-
* Android String XML
|
108
|
-
|
109
|
-
* Gettext PO/POT
|
110
|
-
|
111
|
-
* Rails YAML
|
112
|
-
|
113
|
-
* Basic flat YAML
|
114
|
-
|
115
|
-
* CVS for easy exchange with other apps
|
116
|
-
|
115
|
+
Supported input/output formats: iOS and OS X String Resources, Android String XML,
|
116
|
+
Gettext PO/POT, Rails YAML, Basic flat YAML, Java properties,
|
117
|
+
CVS for easy exchange with other apps.
|
117
118
|
|
118
119
|
Direct converation between any formats supported.
|
119
120
|
|
120
|
-
|
121
121
|
Rails YAML and PO supports plural forms of messages.
|
122
|
-
|
123
|
-
'
|
124
122
|
email:
|
125
123
|
- igor_for_os@stepin.name
|
126
124
|
executables:
|
@@ -128,7 +126,7 @@ executables:
|
|
128
126
|
extensions: []
|
129
127
|
extra_rdoc_files: []
|
130
128
|
files:
|
131
|
-
- .gitignore
|
129
|
+
- ".gitignore"
|
132
130
|
- Changelog.txt
|
133
131
|
- Design.md
|
134
132
|
- Design.ru.md
|
@@ -151,6 +149,7 @@ files:
|
|
151
149
|
- lib/i18n_po_tools/formats/csv_format.rb
|
152
150
|
- lib/i18n_po_tools/formats/ios_format.rb
|
153
151
|
- lib/i18n_po_tools/formats/po_format.rb
|
152
|
+
- lib/i18n_po_tools/formats/properties_format.rb
|
154
153
|
- lib/i18n_po_tools/formats/rails_yaml_format.rb
|
155
154
|
- lib/i18n_po_tools/plural_message.rb
|
156
155
|
- lib/i18n_po_tools/utils/data.rb
|
@@ -168,12 +167,12 @@ require_paths:
|
|
168
167
|
- lib
|
169
168
|
required_ruby_version: !ruby/object:Gem::Requirement
|
170
169
|
requirements:
|
171
|
-
- -
|
170
|
+
- - ">="
|
172
171
|
- !ruby/object:Gem::Version
|
173
172
|
version: '0'
|
174
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
174
|
requirements:
|
176
|
-
- -
|
175
|
+
- - ">="
|
177
176
|
- !ruby/object:Gem::Version
|
178
177
|
version: '0'
|
179
178
|
requirements: []
|