translation 1.6 → 1.7
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0e41e1529ebddeded105bf60eec7bfdc756be2e
|
4
|
+
data.tar.gz: c4ea9728e442d17c5616acce199d6a006ebd017c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc84c365831883325b8b20ea4e92c8e4d06ed2a035fcb30e36515e4ca29d2342cb7e0287ec02222b932c86fda1d0137e52b08a479284cc314312c011771a0445
|
7
|
+
data.tar.gz: 5cd68eb75c7c73023cd5592f99cb3ec87e1787134a10d0e14087ba43a9442e3784bb92f0c5f9aae18d0c0a1543f58ae04689fd1992170e1c877e3bda1430bedc
|
data/README.md
CHANGED
@@ -10,7 +10,9 @@ Add this gem to your [Rails](http://rubyonrails.org) app to translate it with [T
|
|
10
10
|
|
11
11
|
Add the gem to your project's Gemfile:
|
12
12
|
|
13
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'translation'
|
15
|
+
```
|
14
16
|
|
15
17
|
Then:
|
16
18
|
|
@@ -19,11 +21,13 @@ Then:
|
|
19
21
|
|
20
22
|
The initializer looks like this:
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
```ruby
|
25
|
+
TranslationIO.configure do |config|
|
26
|
+
config.api_key = 'some api key which is very long'
|
27
|
+
config.source_locale = 'en'
|
28
|
+
config.target_locales = ['fr', 'nl', 'de', 'es']
|
29
|
+
end
|
30
|
+
```
|
27
31
|
|
28
32
|
And finish by inititalizing your translation project with:
|
29
33
|
|
@@ -59,11 +63,13 @@ For these cases, you just have to add `disable_gettext` in the config file.
|
|
59
63
|
|
60
64
|
For example:
|
61
65
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
```ruby
|
67
|
+
TranslationIO.configure do |config|
|
68
|
+
...
|
69
|
+
config.disable_gettext = true
|
70
|
+
...
|
71
|
+
end
|
72
|
+
```
|
67
73
|
|
68
74
|
### Ignored YAML keys
|
69
75
|
|
@@ -72,20 +78,22 @@ You can use the `ignored_key_prefixes` for that.
|
|
72
78
|
|
73
79
|
For example:
|
74
80
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
```ruby
|
82
|
+
TranslationIO.configure do |config|
|
83
|
+
...
|
84
|
+
config.ignored_key_prefixes = [
|
85
|
+
'number.human.',
|
86
|
+
'admin.',
|
87
|
+
'errors.messages.',
|
88
|
+
'activerecord.errors.messages.',
|
89
|
+
'will_paginate.',
|
90
|
+
'helpers.page_entries_info.',
|
91
|
+
'views.pagination.',
|
92
|
+
'enumerize.visibility.'
|
93
|
+
]
|
94
|
+
...
|
95
|
+
end
|
96
|
+
```
|
89
97
|
|
90
98
|
### Custom localization key prefixes
|
91
99
|
|
@@ -105,28 +113,31 @@ to add some more, use the `localization_key_prefixes` option.
|
|
105
113
|
|
106
114
|
For example:
|
107
115
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
116
|
+
```ruby
|
117
|
+
TranslationIO.configure do |config|
|
118
|
+
...
|
119
|
+
config.localization_key_prefixes = ['my_gem.date.formats']
|
120
|
+
...
|
121
|
+
end
|
122
|
+
```
|
113
123
|
|
114
124
|
### Paths where locales are stored (not recommended)
|
115
125
|
|
116
126
|
You can specify where your GetText and YAML files are on disk:
|
117
127
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
128
|
+
```ruby
|
129
|
+
TranslationIO.configure do |config|
|
130
|
+
...
|
131
|
+
config.locales_path = 'some/path' # defaults to config/locales/gettext
|
132
|
+
config.yaml_locales_path = 'some/path' # defaults to config/locales
|
133
|
+
...
|
134
|
+
end
|
135
|
+
```
|
124
136
|
|
125
137
|
## Tests
|
126
138
|
|
127
139
|
To run the specs:
|
128
140
|
|
129
|
-
bundle
|
130
141
|
bundle exec rspec
|
131
142
|
|
132
143
|
## Credits
|
@@ -69,12 +69,15 @@ module TranslationIO
|
|
69
69
|
def self.top_comment
|
70
70
|
<<EOS
|
71
71
|
# THIS FILE CONTAINS LOCALIZATION KEYS : date and number formats, number precisions,
|
72
|
-
# number separators and all
|
72
|
+
# number separators and all non-textual values depending on the language.
|
73
73
|
# These values must not reach the translator, so they are separated in this file.
|
74
74
|
#
|
75
75
|
# More info here: https://translation.io/blog/gettext-is-better-than-rails-i18n#localization
|
76
76
|
#
|
77
|
-
# You can edit and/or add new keys here, they won't be touched by Translation.io.
|
77
|
+
# You can edit and/or add new localization keys here, they won't be touched by Translation.io.
|
78
|
+
#
|
79
|
+
# If you want to add a new localization key prefix, use the option described here:
|
80
|
+
# https://github.com/aurels/translation-gem#custom-localization-key-prefixes
|
78
81
|
#
|
79
82
|
EOS
|
80
83
|
end
|
@@ -76,6 +76,12 @@ module TranslationIO
|
|
76
76
|
BaseOperation::SaveSpecialYamlFilesStep.new(source_locale, target_locales, yaml_locales_path, yaml_file_paths).run
|
77
77
|
CleanupYamlFilesStep.new(source_locale, target_locales, yaml_file_paths, yaml_locales_path).run
|
78
78
|
BaseOperation::CreateNewMoFilesStep.new(locales_path).run
|
79
|
+
|
80
|
+
puts
|
81
|
+
puts "----------"
|
82
|
+
puts "If you're wondering why your YAML directory structure has changed so much,"
|
83
|
+
puts "please check this article: https://translation.io/blog/dealing-with-yaml-files-and-their-directory-structure"
|
84
|
+
puts "----------"
|
79
85
|
end
|
80
86
|
|
81
87
|
cleanup
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurelien Malisart
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gettext
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 3.
|
20
|
+
version: 3.2.2
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 3.
|
27
|
+
version: 3.2.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|