missing_translation 0.4.2 → 0.4.4

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: dba71d70e2fdfd447e9970d93b7df7fb48c15d1ebc0786faa42485ffb69fd2cd
4
- data.tar.gz: 335d390b416fa5e6df1f69391d5c34a55740bef4f889705ff72083af2e4c6d9f
3
+ metadata.gz: ec408f8faa083105c47b0151f6bddd1a24b58c9853c4e66bbab8542ba798f265
4
+ data.tar.gz: 36b215d2b403265155d6f15ce3a4a16a4104c77f7972d06eef0825b4436ae761
5
5
  SHA512:
6
- metadata.gz: 3e932a04547c8e79061f6c85f8931b886f912ba455155c706a6cce5bb292bb528587c326440f370388115bac9b0aebccd6f2013faca13a5a7229706e35276d4d
7
- data.tar.gz: d02468ccc06101f8a3259e7f253283e80b30612abc1f3604b9fa77a39b14c90295d4250d603ba71e383cfb0d51523b3c94a511924036f644d00f57c1060a4d7f
6
+ metadata.gz: f6cd4983c6ea15efddc317f5837e51efc3114474c783ac757def910eb717d1cca624ce614a9bcb34fe761021673c8719e69a3853d50ca60553b66699e76f510b
7
+ data.tar.gz: '0188c5193a5b9d0a2afc679c9289886ec600c1b70409edb7daedd2623af72bcf0ee95d3b6bf738dfe6a4061bd78075404b2a8a0f22252b3e7f3a74ef05403369'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- missing_translation (0.4.2)
4
+ missing_translation (0.4.4)
5
5
  httparty (~> 0.18)
6
6
  thor (~> 1.1)
7
7
 
@@ -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
- File.write(filepath, translations.to_yaml)
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 $CHILD_STATUS.success? && status.empty?
10
-
11
- error = if $CHILD_STATUS.success?
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MissingTranslation
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.4"
5
5
  end
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.2
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-03 00:00:00.000000000 Z
11
+ date: 2024-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor