gettext-setup 0.12 → 0.13
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/lib/tasks/gettext.rake +27 -4
- 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: c0f7e467d79154886b797367c614a87937e5b811
|
4
|
+
data.tar.gz: e9388332a6ccb61ab6b6df0e848283dff8a4cd1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e114576c5e3610e93f06a17fb63701154ca7677590d24773970bf3e5f7ab50e892a500a2f5fd7d454334e82bde60d312c1aa925c5e4475a2de69e9a97e80481d
|
7
|
+
data.tar.gz: c86d5fff6ada432f699afa9ad8fbeaf87f7d5b57c602c7271abb50c05702d285bf808b442b61c878db75959b558de244900e83a5645d19bec045da6ad2f8e563
|
data/lib/tasks/gettext.rake
CHANGED
@@ -32,8 +32,7 @@ namespace :gettext do
|
|
32
32
|
File.join(locale_path, GettextSetup.config['project_name'] + ".pot")
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
task :pot do
|
35
|
+
def generate_new_pot
|
37
36
|
config = GettextSetup.config
|
38
37
|
package_name = config['package_name']
|
39
38
|
project_name = config['project_name']
|
@@ -52,10 +51,34 @@ namespace :gettext do
|
|
52
51
|
"--package-version '#{version}' " +
|
53
52
|
"--copyright-holder='#{copyright_holder}' --copyright-year=#{Time.now.year} " +
|
54
53
|
"#{files_to_translate.join(" ")}")
|
55
|
-
puts "POT file locales/#{project_name}.pot has been updated"
|
56
54
|
end
|
57
55
|
|
58
|
-
desc "
|
56
|
+
desc "Generate a new POT file and replace old if strings changed"
|
57
|
+
task :update_pot do
|
58
|
+
if !File.exists? pot_file_path
|
59
|
+
puts "No existing POT file, generating new"
|
60
|
+
generate_new_pot
|
61
|
+
else
|
62
|
+
old_pot = pot_file_path + ".old"
|
63
|
+
File.rename(pot_file_path, old_pot)
|
64
|
+
generate_new_pot
|
65
|
+
if system("msgcmp --use-untranslated '#{old_pot}' '#{pot_file_path}'")
|
66
|
+
puts "No string changes detected, keeping old POT file"
|
67
|
+
File.rename(old_pot, pot_file_path)
|
68
|
+
else
|
69
|
+
File.delete(old_pot)
|
70
|
+
puts "String changes detected, replacing with updated POT file"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
desc "Generate POT file"
|
76
|
+
task :pot do
|
77
|
+
generate_new_pot
|
78
|
+
puts "POT file #{pot_file_path} has been generated"
|
79
|
+
end
|
80
|
+
|
81
|
+
desc "Update PO file for a specific language"
|
59
82
|
task :po, [:language] do |_, args|
|
60
83
|
language = args.language || ENV["LANGUAGE"]
|
61
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettext-setup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.13'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|