translation 1.15 → 1.16
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 +3 -1
- data/lib/translation.rb +8 -0
- data/lib/translation_io/client/init_operation.rb +3 -2
- data/lib/translation_io/client/sync_operation.rb +3 -2
- data/lib/translation_io/config.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85368e64aaa3bd66d63d39df74a77323d9451a54
|
4
|
+
data.tar.gz: d520b13975dee1e2482da4503a5eaebf98fb3183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce9ec36848c6b50eebc1a1e48ef490c71c4cda86b42c1a733efe1aa0ff65ffbded82769166a572cc82f645a7b45b07861a4c0763ecc28fef731d005ba4af000
|
7
|
+
data.tar.gz: ab2028958e1fe9ecb110d4f3c4ddc3d11835d948a015c2e985e9654f1b6525a0daf6ac06c63498ee85bc07132f3138931f9297103376c9ae2f96f1886aff4730
|
data/README.md
CHANGED
@@ -311,7 +311,8 @@ end
|
|
311
311
|
|
312
312
|
If you are using GetText and you want to manage other file formats than:
|
313
313
|
|
314
|
-
* `rb`, `
|
314
|
+
* `rb`, `ruby` and `rabl` for Ruby.
|
315
|
+
* `erb` and `inky` for Ruby templating.
|
315
316
|
* `haml` and `mjmlhaml` for [HAML](http://haml.info/).
|
316
317
|
* `slim` and `mjmlslim` for [SLIM](http://slim-lang.com/).
|
317
318
|
|
@@ -321,6 +322,7 @@ Just add them in your configuration file like this:
|
|
321
322
|
TranslationIO.configure do |config|
|
322
323
|
...
|
323
324
|
config.source_formats << 'rb2'
|
325
|
+
config.erb_source_formats << 'erb2'
|
324
326
|
config.haml_source_formats << 'haml2'
|
325
327
|
config.slim_source_formats << 'slim2'
|
326
328
|
...
|
data/lib/translation.rb
CHANGED
@@ -36,6 +36,7 @@ module TranslationIO
|
|
36
36
|
unless @config.disable_gettext
|
37
37
|
require_gettext_dependencies
|
38
38
|
add_missing_locales
|
39
|
+
add_parser_for_erb_source_formats(@config.erb_source_formats)
|
39
40
|
|
40
41
|
if Rails.env.development?
|
41
42
|
GetText::TextDomainManager.cached = false
|
@@ -73,6 +74,13 @@ module TranslationIO
|
|
73
74
|
Locale::Info.three_languages['wen'] = Locale::Info::Language.new('', 'wen', 'I', 'L', 'Upper Sorbian')
|
74
75
|
end
|
75
76
|
|
77
|
+
def add_parser_for_erb_source_formats(new_erb_formats)
|
78
|
+
existing_extensions = GetText::ErbParser.instance_variable_get("@config")[:extnames]
|
79
|
+
new_extensions = new_erb_formats.collect { |ext| ".#{ext}" }
|
80
|
+
|
81
|
+
GetText::ErbParser.instance_variable_get("@config")[:extnames] = (existing_extensions + new_extensions).uniq
|
82
|
+
end
|
83
|
+
|
76
84
|
def info(message, level = 0, verbose_level = 0)
|
77
85
|
verbose = @config.try(:verbose) || 0
|
78
86
|
if verbose >= verbose_level
|
@@ -8,9 +8,10 @@ module TranslationIO
|
|
8
8
|
def run
|
9
9
|
config = TranslationIO.config
|
10
10
|
|
11
|
+
source_files = config.source_files
|
12
|
+
erb_source_files = config.erb_source_files
|
11
13
|
haml_source_files = config.haml_source_files
|
12
14
|
slim_source_files = config.slim_source_files
|
13
|
-
source_files = config.source_files
|
14
15
|
pot_path = config.pot_path
|
15
16
|
source_locale = config.source_locale
|
16
17
|
target_locales = config.target_locales
|
@@ -23,7 +24,7 @@ module TranslationIO
|
|
23
24
|
BaseOperation::DumpMarkupGettextKeysStep.new(slim_source_files, :slim).run
|
24
25
|
end
|
25
26
|
|
26
|
-
UpdatePotFileStep.new(pot_path, source_files).run(params)
|
27
|
+
UpdatePotFileStep.new(pot_path, source_files + erb_source_files).run(params)
|
27
28
|
UpdateAndCollectPoFilesStep.new(target_locales, pot_path, locales_path).run(params)
|
28
29
|
|
29
30
|
create_yaml_pot_files_step = CreateYamlPoFilesStep.new(source_locale, target_locales, yaml_file_paths)
|
@@ -10,9 +10,10 @@ module TranslationIO
|
|
10
10
|
|
11
11
|
config = TranslationIO.config
|
12
12
|
|
13
|
+
source_files = config.source_files
|
14
|
+
erb_source_files = config.erb_source_files
|
13
15
|
haml_source_files = config.haml_source_files
|
14
16
|
slim_source_files = config.slim_source_files
|
15
|
-
source_files = config.source_files
|
16
17
|
pot_path = config.pot_path
|
17
18
|
source_locale = config.source_locale
|
18
19
|
target_locales = config.target_locales
|
@@ -27,7 +28,7 @@ module TranslationIO
|
|
27
28
|
BaseOperation::DumpMarkupGettextKeysStep.new(slim_source_files, :slim).run
|
28
29
|
end
|
29
30
|
|
30
|
-
UpdatePotFileStep.new(pot_path, source_files).run(params)
|
31
|
+
UpdatePotFileStep.new(pot_path, source_files + erb_source_files).run(params)
|
31
32
|
CreateYamlPotFileStep.new(source_locale, yaml_file_paths).run(params)
|
32
33
|
|
33
34
|
if purge
|
@@ -11,6 +11,7 @@ module TranslationIO
|
|
11
11
|
attr_accessor :ignored_source_files
|
12
12
|
|
13
13
|
attr_accessor :source_formats
|
14
|
+
attr_accessor :erb_source_formats
|
14
15
|
attr_accessor :haml_source_formats
|
15
16
|
attr_accessor :slim_source_formats
|
16
17
|
|
@@ -38,7 +39,8 @@ module TranslationIO
|
|
38
39
|
self.ignored_source_paths = ['vendor/', 'tmp/']
|
39
40
|
self.ignored_source_files = [] # Files not parsed for GetText entries
|
40
41
|
|
41
|
-
self.source_formats = ['rb', '
|
42
|
+
self.source_formats = ['rb', 'ruby', 'rabl']
|
43
|
+
self.erb_source_formats = ['erb', 'inky']
|
42
44
|
self.haml_source_formats = ['haml', 'mjmlhaml']
|
43
45
|
self.slim_source_formats = ['slim', 'mjmlslim']
|
44
46
|
|
@@ -68,6 +70,10 @@ module TranslationIO
|
|
68
70
|
source_files_for_formats(source_formats)
|
69
71
|
end
|
70
72
|
|
73
|
+
def erb_source_files
|
74
|
+
source_files_for_formats(erb_source_formats)
|
75
|
+
end
|
76
|
+
|
71
77
|
def haml_source_files
|
72
78
|
source_files_for_formats(haml_source_formats)
|
73
79
|
end
|
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.16'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hoste
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gettext
|