translation 1.33 → 1.35
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25024c8116a0d36bc5821cde349f43434bbe1e56b2e1d60ba022262c4a8d9b7f
|
4
|
+
data.tar.gz: c75ed4fe9ece108a76871d47fb606a0ab0551f53001b009ab0ae0069b0ec03dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7377de5d6b6133dca3cdb1ba8fbcd96e4d17c9c294ecff05c1233bc4f1936221b32f293c606298e24ca9b9408c9c4be2151e2c7114e26413bbf7996556b78adf
|
7
|
+
data.tar.gz: 84b2bda89cebcc32b655dd46210a8c4196e79a7e15588cb5c72956a9fe167d6cd9143d7d26e43064de790ad6671bf29030060fe8079127655123ae7516682dbe
|
@@ -34,19 +34,27 @@ module TranslationIO
|
|
34
34
|
# Create source locale PO file, with identical source and target
|
35
35
|
# => Useful for correct fallbacks (cf. discussion https://github.com/translation/rails/issues/48)
|
36
36
|
def create_source_po(text_domain)
|
37
|
-
source_locale = Locale::Tag.parse(@source_locale)
|
37
|
+
source_locale = Locale::Tag.parse(@source_locale)
|
38
38
|
|
39
39
|
pot_path = File.join(@locales_path, "#{text_domain}.pot")
|
40
|
-
po_path = File.join(@locales_path, source_locale, "#{text_domain}.po")
|
40
|
+
po_path = File.join(@locales_path, source_locale.to_s, "#{text_domain}.po")
|
41
41
|
|
42
42
|
FileUtils.mkdir_p(File.dirname(po_path))
|
43
43
|
FileUtils.rm(po_path) if File.exist?(po_path)
|
44
44
|
|
45
45
|
# Generate source PO from POT and parse it
|
46
|
-
GetText::Tools::MsgInit.run('-i', pot_path, '-o', po_path, '-l', source_locale, '--no-translator')
|
46
|
+
GetText::Tools::MsgInit.run('-i', pot_path, '-o', po_path, '-l', source_locale.to_s, '--no-translator')
|
47
47
|
po_entries = GetText::PO.new
|
48
48
|
GetText::POParser.new.parse(File.read(po_path), po_entries)
|
49
49
|
|
50
|
+
# With GetText after 3.3.9 and the introduction of optional `red-datasets` dependency, we need to complete the plural forms manually
|
51
|
+
# Source languages must have only 2 plural forms, and only 2 different pluralization rules exist for these languages
|
52
|
+
if %w(ak am as bn fa fr gu hi hy kn ln mg nso pa si ti zu).include?(source_locale.language)
|
53
|
+
po_entries[''].msgstr.gsub!('Plural-Forms: nplurals=; plural=;', 'Plural-Forms: nplurals=2; plural=n > 1;') # 0 and 1 are singular
|
54
|
+
else
|
55
|
+
po_entries[''].msgstr.gsub!('Plural-Forms: nplurals=; plural=;', 'Plural-Forms: nplurals=2; plural=n != 1;') # only 1 is singular
|
56
|
+
end
|
57
|
+
|
50
58
|
# Fill with same target as source and save it
|
51
59
|
po_entries.each do |po_entry|
|
52
60
|
if po_entry.msgid != '' # header
|
@@ -103,7 +103,7 @@ module TranslationIO
|
|
103
103
|
# Source yaml file like config/locales/en.yml
|
104
104
|
yaml_file_path = File.expand_path(File.join(TranslationIO.config.yaml_locales_path, "#{@source_locale}.yml"))
|
105
105
|
|
106
|
-
if File.
|
106
|
+
if File.exist?(yaml_file_path)
|
107
107
|
# Complete existing hash if YAML file already exists
|
108
108
|
existing_yaml_source = @yaml_sources.detect { |y_s| normalize_path(y_s[:yaml_file_path]) == normalize_path(yaml_file_path) }
|
109
109
|
yaml_flat_hash = existing_yaml_source[:yaml_flat_hash]
|
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.35'
|
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:
|
12
|
+
date: 2023-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gettext
|