missing_translation 0.4.2 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec408f8faa083105c47b0151f6bddd1a24b58c9853c4e66bbab8542ba798f265
|
4
|
+
data.tar.gz: 36b215d2b403265155d6f15ce3a4a16a4104c77f7972d06eef0825b4436ae761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6cd4983c6ea15efddc317f5837e51efc3114474c783ac757def910eb717d1cca624ce614a9bcb34fe761021673c8719e69a3853d50ca60553b66699e76f510b
|
7
|
+
data.tar.gz: '0188c5193a5b9d0a2afc679c9289886ec600c1b70409edb7daedd2623af72bcf0ee95d3b6bf738dfe6a4061bd78075404b2a8a0f22252b3e7f3a74ef05403369'
|
data/Gemfile.lock
CHANGED
@@ -20,7 +20,9 @@ module MissingTranslation
|
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "upload", 'Upload file in locale folder to missing translation'
|
23
|
+
method_option :locale, type: :string, default: nil, desc: "Locale to download"
|
23
24
|
def upload
|
25
|
+
locale = options[:locale]
|
24
26
|
file_extension = ""
|
25
27
|
config_folder = "./config/locales/#{file_extension}/*.yml"
|
26
28
|
file_pathnames = Dir[config_folder]
|
@@ -29,13 +31,18 @@ module MissingTranslation
|
|
29
31
|
configuration = Configuration.new
|
30
32
|
api = MissingTranslationApi.new(configuration.config[:key])
|
31
33
|
file_pathnames.each do |pathname|
|
34
|
+
next if locale && locale.present? && !pathname.include?("#{locale}.yml")
|
35
|
+
|
36
|
+
p "Uploading #{pathname}"
|
32
37
|
file = MissingTranslation::TranslationFile.new(pathname)
|
33
38
|
api.upload(file.language, file.group, file.to_json, "yaml")
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
42
|
desc "download", "Download all file from missing translation"
|
43
|
+
method_option :locale, type: :string, default: nil, desc: "Locale to download"
|
38
44
|
def download
|
45
|
+
locale = options[:locale]
|
39
46
|
MissingTranslation::Cli.new().sort
|
40
47
|
return if MissingTranslation::Util.uncommitted_changes?
|
41
48
|
|
@@ -45,6 +52,7 @@ module MissingTranslation
|
|
45
52
|
response = api.download("yaml")
|
46
53
|
response.each do |f|
|
47
54
|
file = MissingTranslation::TranslationFile.new
|
55
|
+
file.locale_prefix = configuration.config[:locale_prefix] || false
|
48
56
|
file.group = f["group"]
|
49
57
|
file.language = f["language"]
|
50
58
|
file.translations = f["keys"]
|
@@ -42,11 +42,15 @@ module MissingTranslation
|
|
42
42
|
|
43
43
|
def write(directory)
|
44
44
|
return nil unless translations
|
45
|
+
|
45
46
|
filename = [group, language, "yml"].compact.reject{|s| s.size <= 0}.join('.')
|
46
47
|
filepath = "#{directory}/#{filename}"
|
47
48
|
p "Writing file #{filepath}..."
|
48
|
-
|
49
|
-
|
49
|
+
if locale_prefix && translations.keys.length >= 1 && translations.keys.first != language
|
50
|
+
File.write(filepath, {language => translations}.to_yaml)
|
51
|
+
else
|
52
|
+
File.write(filepath, translations.to_yaml)
|
53
|
+
end
|
50
54
|
MissingTranslation::Util.sort_file(filepath)
|
51
55
|
end
|
52
56
|
|
@@ -6,14 +6,9 @@ module MissingTranslation
|
|
6
6
|
|
7
7
|
def self.uncommitted_changes?
|
8
8
|
status = `git status --porcelain`
|
9
|
-
return false if
|
10
|
-
|
11
|
-
|
12
|
-
"You have uncommitted code. Please commit or stash your changes before continuing"
|
13
|
-
else
|
14
|
-
"You do not have Git installed. Please install Git, and commit your changes before continuing"
|
15
|
-
end
|
16
|
-
p error
|
9
|
+
return false if status.empty?
|
10
|
+
|
11
|
+
puts "You have uncommitted code. Please commit or stash your changes before continuing"
|
17
12
|
true
|
18
13
|
end
|
19
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: missing_translation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Clercin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07
|
11
|
+
date: 2024-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|