translation 0.9.6 → 0.9.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 +4 -4
- data/README.md +5 -5
- data/lib/translation_io/client/base_operation/save_special_yaml_files_step.rb +2 -4
- data/lib/translation_io/client.rb +1 -1
- data/lib/translation_io/config.rb +10 -8
- data/lib/translation_io/tasks.rb +8 -3
- data/lib/translation_io/yaml_entry.rb +21 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76f06309119b4856d8334ab42dd1a79600415e9b
|
4
|
+
data.tar.gz: 97ca726e59f4a331f41f03b6644b0c4accb09298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bee96e7ec136d640da01c9ea420f8c07f9d38ce40d73289059da10890a060345255b8f9d088e400223b492b49cc8a83aee60cfab8e521008c8ff12c198162ff
|
7
|
+
data.tar.gz: 50a456aab2431ca613b0233f92bb05ba8a4435fae29d26812b00d87b87d0bdfa9ebfbd0602e894fcb3e241e7e9e4db7924abdc2667d4b35840928987f9551f21
|
data/README.md
CHANGED
@@ -19,19 +19,19 @@ And finish by inititalizing your translation project with :
|
|
19
19
|
|
20
20
|
bundle exec rake translation:init
|
21
21
|
|
22
|
-
##
|
22
|
+
## Sync
|
23
23
|
|
24
24
|
To send new translatable keys/strings and get new translations from Translation.io, simply run :
|
25
25
|
|
26
26
|
bundle exec rake translation:sync
|
27
27
|
|
28
|
-
## Purge
|
28
|
+
## Sync and Purge
|
29
29
|
|
30
|
-
If you need to remove unused keys/strings from Translation.io using the current branch as reference :
|
30
|
+
If you also need to remove unused keys/strings from Translation.io using the current branch as reference :
|
31
31
|
|
32
|
-
bundle exec rake translation:
|
32
|
+
bundle exec rake translation:sync_and_purge
|
33
33
|
|
34
|
-
|
34
|
+
As the name says, this operation will also perform a sync at the same time.
|
35
35
|
|
36
36
|
Warning : all keys that are not present in the current branch will be **permanently deleted both on Translation.io and in your app**.
|
37
37
|
|
@@ -32,11 +32,9 @@ module TranslationIO
|
|
32
32
|
yaml_path = File.join(@yaml_locales_path, "localization.#{target_locale}.yml")
|
33
33
|
|
34
34
|
TranslationIO.info yaml_path, 2, 2
|
35
|
-
flat_translations = {}
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
flat_translations[target_key] = all_flat_special_translations[target_key]
|
36
|
+
flat_translations = all_flat_special_translations.select do |key|
|
37
|
+
TranslationIO::YamlEntry.from_locale?(key, target_locale) && !TranslationIO::YamlEntry.ignored?(key)
|
40
38
|
end
|
41
39
|
|
42
40
|
yaml_data = YAMLConversion.get_yaml_data_from_flat_translations(flat_translations)
|
@@ -6,17 +6,19 @@ module TranslationIO
|
|
6
6
|
attr_accessor :verbose
|
7
7
|
attr_accessor :test
|
8
8
|
attr_accessor :ignored_key_prefixes
|
9
|
+
attr_accessor :localization_key_prefixes
|
9
10
|
attr_accessor :charset
|
10
11
|
|
11
12
|
def initialize
|
12
|
-
self.locales_path
|
13
|
-
self.source_locale
|
14
|
-
self.target_locales
|
15
|
-
self.endpoint
|
16
|
-
self.verbose
|
17
|
-
self.test
|
18
|
-
self.ignored_key_prefixes
|
19
|
-
self.
|
13
|
+
self.locales_path = File.join('config', 'locales', 'gettext')
|
14
|
+
self.source_locale = :en
|
15
|
+
self.target_locales = []
|
16
|
+
self.endpoint = 'https://translation.io/api'
|
17
|
+
self.verbose = 1
|
18
|
+
self.test = false
|
19
|
+
self.ignored_key_prefixes = []
|
20
|
+
self.localization_key_prefixes = []
|
21
|
+
self.charset = 'UTF-8'
|
20
22
|
end
|
21
23
|
|
22
24
|
def pot_path
|
data/lib/translation_io/tasks.rb
CHANGED
@@ -2,9 +2,10 @@ require 'gettext/tools'
|
|
2
2
|
|
3
3
|
namespace :translation do
|
4
4
|
|
5
|
-
DESCRIPTIONS = {
|
6
|
-
:
|
7
|
-
:
|
5
|
+
DESCRIPTIONS = {
|
6
|
+
:init => "Initialize your Translation.io project",
|
7
|
+
:sync => "Send new translatable keys/strings and get new translations from Translation.io",
|
8
|
+
:sync_and_purge => "Remove unused keys/strings from Translation.io using the current branch as reference"
|
8
9
|
}
|
9
10
|
|
10
11
|
desc "Get configuration infos of Translation gem"
|
@@ -26,4 +27,8 @@ EOS
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
30
|
+
|
31
|
+
task :purge => :environment do
|
32
|
+
TranslationIO.info("Purge is deprecated, please use rake 'translation:sync_and_purge' instead.")
|
33
|
+
end
|
29
34
|
end
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module TranslationIO
|
2
|
-
module
|
2
|
+
module YamlEntry
|
3
|
+
|
4
|
+
IGNORED_KEY_PREFIXES = [
|
5
|
+
'faker.'
|
6
|
+
]
|
3
7
|
|
4
8
|
LOCALIZATION_KEY_PREFIXES = [
|
5
9
|
'date.formats',
|
@@ -13,7 +17,8 @@ module TranslationIO
|
|
13
17
|
'number.human.format',
|
14
18
|
'number.human.storage_units.format',
|
15
19
|
'number.human.decimal_units.format',
|
16
|
-
'number.human.decimal_units.units.unit'
|
20
|
+
'number.human.decimal_units.units.unit',
|
21
|
+
'i18n.transliterate'
|
17
22
|
]
|
18
23
|
|
19
24
|
class << self
|
@@ -34,15 +39,27 @@ module TranslationIO
|
|
34
39
|
end
|
35
40
|
|
36
41
|
def localization_prefix?(key)
|
37
|
-
|
42
|
+
localization_key_prefixes.any? do |prefix|
|
38
43
|
key_without_locale(key).start_with?(prefix)
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
42
47
|
private
|
43
48
|
|
49
|
+
def localization_key_prefixes
|
50
|
+
if TranslationIO.config
|
51
|
+
LOCALIZATION_KEY_PREFIXES + TranslationIO.config.localization_key_prefixes
|
52
|
+
else
|
53
|
+
LOCALIZATION_KEY_PREFIXES
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
44
57
|
def ignored_key_prefixes
|
45
|
-
|
58
|
+
if TranslationIO.config
|
59
|
+
IGNORED_KEY_PREFIXES + TranslationIO.config.ignored_key_prefixes
|
60
|
+
else
|
61
|
+
LOCALIZATION_KEY_PREFIXES
|
62
|
+
end
|
46
63
|
end
|
47
64
|
|
48
65
|
def key_without_locale(key)
|
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: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurelien Malisart
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gettext
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.2.
|
122
|
+
rubygems_version: 2.2.0
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Rails translation made _("simple") with YAML and GetText.
|