loco_strings 0.1.6 → 0.1.10

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: 83291f99249e590483aa4c51d5710eada7bc80a910048bf0ba20b66a25ff187f
4
- data.tar.gz: 11a3bbb921de0df05fe594518b98a254dc27531a8c312e383827090fb6816391
3
+ metadata.gz: b061caa0d3be5a87ac4b7b4fc582fcf032681c6adb49a08a3021fd7532d3fa9a
4
+ data.tar.gz: 4d56f9fee2da2095b7ac5e4c3bab7f801fc35bc3f5f309f21eca652ec8c3367f
5
5
  SHA512:
6
- metadata.gz: 36f248bd8877845fa3983df90cf0903ca7fb26df5fefaeff0a52c98a5b5393e0d1e9a7121bc068db6b0c169b78899796807dabc119c45616d5ce8d77096ba2e5
7
- data.tar.gz: 6df549b39d2ba998aff3899eb27729a988d428d76ad7c14789f5c0a1e64b920a1eb6f7f6a0051beb24754baf3825413fe2dad08519f6ffb02d7097af4255cb3b
6
+ metadata.gz: 513d4ed18c5d957ab767804435f778f972b0dedba7be684bbc5f1686f2795ddac18d188538748679d7ad51b72a8754f4b3f8f10734e49425c7cd28fc89819e09
7
+ data.tar.gz: 7a1c2a4dfef48987f13144be1c642c276239c9f81b79df4fef7f78e63e0937c25705f47ba25983f1ffe5edaa81cacf9b7db982801a7ecbc079a7b34ea3f4b392
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in loco_strings.gemspec
6
6
  gemspec
7
7
 
8
- gem "nokogiri", "~> 1.14", ">= 1.14.3"
8
+ gem "nokogiri", "~> 1.19", ">= 1.19.3"
9
9
 
10
10
  gem "rake", "~> 13.0"
11
11
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- loco_strings (0.1.4.1)
5
- nokogiri (~> 1.13, >= 1.13.8)
4
+ loco_strings (0.1.10)
5
+ nokogiri (~> 1.19, >= 1.19.3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -10,14 +10,16 @@ GEM
10
10
  ast (2.4.2)
11
11
  diff-lcs (1.5.0)
12
12
  json (2.6.3)
13
- nokogiri (1.14.3-x86_64-darwin)
13
+ nokogiri (1.19.3-arm64-darwin)
14
14
  racc (~> 1.4)
15
- nokogiri (1.14.3-x86_64-linux)
15
+ nokogiri (1.19.3-x86_64-darwin)
16
+ racc (~> 1.4)
17
+ nokogiri (1.19.3-x86_64-linux-gnu)
16
18
  racc (~> 1.4)
17
19
  parallel (1.23.0)
18
20
  parser (3.2.2.1)
19
21
  ast (~> 2.4.1)
20
- racc (1.6.2)
22
+ racc (1.8.1)
21
23
  rainbow (3.1.1)
22
24
  rake (13.0.6)
23
25
  regexp_parser (2.8.0)
@@ -51,12 +53,13 @@ GEM
51
53
  unicode-display_width (2.4.2)
52
54
 
53
55
  PLATFORMS
56
+ arm64-darwin-24
54
57
  x86_64-darwin-22
55
58
  x86_64-linux
56
59
 
57
60
  DEPENDENCIES
58
61
  loco_strings!
59
- nokogiri (~> 1.14, >= 1.14.3)
62
+ nokogiri (~> 1.19, >= 1.19.3)
60
63
  rake (~> 13.0)
61
64
  rspec (~> 3.0)
62
65
  rubocop (~> 1.21)
@@ -51,7 +51,7 @@ module LocoStrings
51
51
  @strings[key] = LocoString.new(key, key, value["comment"], "new") if val.nil?
52
52
  @strings[key].translatable = translatable
53
53
 
54
- decode_translations(key, value)
54
+ decode_translations(key, value, translatable)
55
55
  end
56
56
  end
57
57
 
@@ -100,9 +100,11 @@ module LocoStrings
100
100
  result
101
101
  end
102
102
 
103
- def decode_translations(key, value)
103
+ def decode_translations(key, value, translatable = true)
104
104
  @languages.each do |language|
105
105
  string = decode_string(key, value, language)
106
+ # Carry the shouldTranslate flag onto the per-language unit so it round-trips on encode.
107
+ string.translatable = translatable if string
106
108
  @translations[language] ||= {}
107
109
  @translations[language][key] = string
108
110
  end
@@ -44,6 +44,9 @@ module LocoStrings
44
44
  sorted_keys.each do |language|
45
45
  process_language(row, language, key)
46
46
  end
47
+ # Bare keys (no per-language unit, e.g. compiler-extracted source-only keys) have nothing for
48
+ # add_translation_flag to read — fall back to the source-string flag so shouldTranslate persists.
49
+ row["shouldTranslate"] = false if !row.key?("shouldTranslate") && @strings[key]&.translatable == false
47
50
  state = @extraction_states[key]
48
51
  return row if state.nil?
49
52
 
@@ -55,6 +55,11 @@ module LocoStrings
55
55
 
56
56
  def update_traslatability(key, translatable)
57
57
  @strings[key].translatable = translatable
58
+ # The encoder reads the flag from the per-language units, so set it there too.
59
+ @translations.each_value do |units|
60
+ unit = units[key]
61
+ unit.translatable = translatable if unit
62
+ end
58
63
  end
59
64
 
60
65
  def select_language(language)
@@ -120,7 +125,13 @@ module LocoStrings
120
125
  def make_variations(key, variant, value, comment = nil, state = nil, language = @language) # rubocop:disable Metrics/ParameterLists
121
126
  variants = @translations.dig(language, key)
122
127
 
123
- return make_strings(key, value, comment, state, language) if variants.is_a?(LocoString)
128
+ # Upgrade a plain (e.g. compiler-extracted) flat string into a plural variation set the first
129
+ # time a variant is written for it — carrying over its comment. Without this, writing a
130
+ # variation onto an extracted key would silently fall back to a flat string and drop the plural.
131
+ if variants.is_a?(LocoString)
132
+ state = "new" if state.nil?
133
+ return LocoVariantions.new(key, { variant => LocoString.new(variant, value, comment, state) }, variants.comment)
134
+ end
124
135
 
125
136
  if variants.nil?
126
137
  state = "new" if state.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LocoStrings
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.10"
5
5
  end
data/lib/loco_strings.rb CHANGED
@@ -46,7 +46,7 @@ module LocoStrings
46
46
  if strings.key? key
47
47
  strings[key].update(value, comment, state, translatable)
48
48
  else
49
- strings[key] = LocoString.new(key, value, comment, state, nil, translatable)
49
+ strings[key] = LocoString.new(key, value, comment, state, translatable)
50
50
  end
51
51
  end
52
52
 
data/loco_strings.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = "LocoStrings is a powerful and easy-to-use Ruby gem that simplifies the process of managing localization strings for iOS and Android apps. With LocoStrings, you can easily extract, organize, and update your app's localized strings in one place, making it easy to maintain consistency across all of your app's translations. LocoStrings supports multiple file formats, including XLIFF and CSV, and provides a simple and intuitive API for working with your app's strings in code. Whether you're a solo developer or part of a team, LocoStrings makes managing your app's localization a breeze."
15
15
  spec.homepage = "https://github.com/ftp27/loco_strings"
16
16
  spec.license = "MIT"
17
- spec.required_ruby_version = ">= 2.6.0"
17
+ spec.required_ruby_version = ">= 3.1.0"
18
18
 
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
20
  spec.metadata["source_code_uri"] = spec.homepage
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  # Uncomment to register a new dependency of your gem
34
- spec.add_dependency "nokogiri", "~> 1.13", ">= 1.13.8"
34
+ spec.add_dependency "nokogiri", "~> 1.19", ">= 1.19.3"
35
35
 
36
36
  # For more information and examples about making a new gem, check out our
37
37
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco_strings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksei Cherepanov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-06-07 00:00:00.000000000 Z
10
+ date: 2026-06-17 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nokogiri
@@ -16,20 +15,20 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1.13'
18
+ version: '1.19'
20
19
  - - ">="
21
20
  - !ruby/object:Gem::Version
22
- version: 1.13.8
21
+ version: 1.19.3
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - "~>"
28
27
  - !ruby/object:Gem::Version
29
- version: '1.13'
28
+ version: '1.19'
30
29
  - - ">="
31
30
  - !ruby/object:Gem::Version
32
- version: 1.13.8
31
+ version: 1.19.3
33
32
  description: LocoStrings is a powerful and easy-to-use Ruby gem that simplifies the
34
33
  process of managing localization strings for iOS and Android apps. With LocoStrings,
35
34
  you can easily extract, organize, and update your app's localized strings in one
@@ -69,7 +68,6 @@ metadata:
69
68
  homepage_uri: https://github.com/ftp27/loco_strings
70
69
  source_code_uri: https://github.com/ftp27/loco_strings
71
70
  rubygems_mfa_required: 'true'
72
- post_install_message:
73
71
  rdoc_options: []
74
72
  require_paths:
75
73
  - lib
@@ -77,15 +75,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
75
  requirements:
78
76
  - - ">="
79
77
  - !ruby/object:Gem::Version
80
- version: 2.6.0
78
+ version: 3.1.0
81
79
  required_rubygems_version: !ruby/object:Gem::Requirement
82
80
  requirements:
83
81
  - - ">="
84
82
  - !ruby/object:Gem::Version
85
83
  version: '0'
86
84
  requirements: []
87
- rubygems_version: 3.5.22
88
- signing_key:
85
+ rubygems_version: 3.6.2
89
86
  specification_version: 4
90
87
  summary: LocoStrings is a Ruby gem for working with iOS and Android localization strings.
91
88
  test_files: []