localio 0.2.2 → 0.2.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 +4 -4
- data/.ruby-version +1 -1
- data/CLAUDE.md +4 -4
- data/Gemfile.lock +16 -12
- data/README.md +37 -0
- data/lib/localio/version.rb +1 -1
- metadata +2 -6
- data/docs/plans/2026-02-23-modernization-design.md +0 -91
- data/docs/plans/2026-02-23-modernization.md +0 -1699
- data/docs/plans/2026-02-23-twine-writer-design.md +0 -72
- data/docs/plans/2026-02-23-twine-writer.md +0 -267
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5eb5417063807fd19963f7ae28327a1c323357430d3f2de7b55edd04391f06fa
|
|
4
|
+
data.tar.gz: b41c293c7ab8c37d640b3f33293d84da1c7f6795b2f46e82bc576cadee918aec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 826799ef9f0a850dfd85c1e21dced3b9130c299081053693a78d2c70e95119cda368c019822360880359f1b9a7e9e1313214a739289a14f930b6ba984a08c15a
|
|
7
|
+
data.tar.gz: 6f1e9c5137de4906e174d5ae410990db0afa0b333f5a62dd8decdb0a15091c4f6ee1c0c3c5f91ef87c5679d11876978bfdf0c0c6032e4910bf3c8afbbcc7307a
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.2.9
|
data/CLAUDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code)
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) and other AI assistants working on this repository.
|
|
4
4
|
|
|
5
5
|
## Commands
|
|
6
6
|
|
|
@@ -64,13 +64,13 @@ Spreadsheets must follow a specific structure:
|
|
|
64
64
|
2. Create corresponding ERB template(s) in `lib/localio/templates/`
|
|
65
65
|
3. Add a case branch in `LocalizableWriter`
|
|
66
66
|
4. Add a case branch in the `platform` DSL accessor in `Locfile`
|
|
67
|
-
5. Add specs in `spec/writers/`
|
|
67
|
+
5. Add specs in `spec/localio/writers/`
|
|
68
68
|
|
|
69
69
|
### Adding a New Source Format
|
|
70
70
|
|
|
71
71
|
1. Create `lib/localio/processors/<format>_processor.rb` with a `load_localizables(config)` class method returning `{language => [Segment]}`
|
|
72
72
|
2. Add a case branch in `Processor`
|
|
73
|
-
3. Add specs in `spec/processors/`
|
|
73
|
+
3. Add specs in `spec/localio/processors/`
|
|
74
74
|
|
|
75
75
|
## Notes
|
|
76
76
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
localio (0.2.
|
|
4
|
+
localio (0.2.4)
|
|
5
5
|
csv (~> 3.2)
|
|
6
6
|
google_drive (~> 3.0)
|
|
7
7
|
nokogiri (~> 1.16)
|
|
@@ -11,32 +11,36 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
addressable (2.
|
|
14
|
+
addressable (2.9.0)
|
|
15
15
|
public_suffix (>= 2.0.2, < 8.0)
|
|
16
16
|
base64 (0.3.0)
|
|
17
17
|
bigdecimal (4.0.1)
|
|
18
18
|
csv (3.3.5)
|
|
19
19
|
declarative (0.0.20)
|
|
20
20
|
diff-lcs (1.6.2)
|
|
21
|
-
faraday (1.
|
|
21
|
+
faraday (1.10.6)
|
|
22
22
|
faraday-em_http (~> 1.0)
|
|
23
23
|
faraday-em_synchrony (~> 1.0)
|
|
24
24
|
faraday-excon (~> 1.1)
|
|
25
|
-
faraday-httpclient (~> 1.0
|
|
25
|
+
faraday-httpclient (~> 1.0)
|
|
26
|
+
faraday-multipart (~> 1.0)
|
|
26
27
|
faraday-net_http (~> 1.0)
|
|
27
|
-
faraday-net_http_persistent (~> 1.
|
|
28
|
+
faraday-net_http_persistent (~> 1.0)
|
|
28
29
|
faraday-patron (~> 1.0)
|
|
29
30
|
faraday-rack (~> 1.0)
|
|
30
|
-
|
|
31
|
+
faraday-retry (~> 1.0)
|
|
31
32
|
ruby2_keywords (>= 0.0.4)
|
|
32
33
|
faraday-em_http (1.0.0)
|
|
33
34
|
faraday-em_synchrony (1.0.1)
|
|
34
35
|
faraday-excon (1.1.0)
|
|
35
36
|
faraday-httpclient (1.0.1)
|
|
37
|
+
faraday-multipart (1.2.0)
|
|
38
|
+
multipart-post (~> 2.0)
|
|
36
39
|
faraday-net_http (1.0.2)
|
|
37
40
|
faraday-net_http_persistent (1.2.0)
|
|
38
41
|
faraday-patron (1.0.0)
|
|
39
42
|
faraday-rack (1.0.0)
|
|
43
|
+
faraday-retry (1.0.4)
|
|
40
44
|
google-apis-core (0.11.3)
|
|
41
45
|
addressable (~> 2.5, >= 2.5.1)
|
|
42
46
|
googleauth (>= 0.16.2, < 2.a)
|
|
@@ -63,7 +67,7 @@ GEM
|
|
|
63
67
|
signet (~> 0.15)
|
|
64
68
|
httpclient (2.9.0)
|
|
65
69
|
mutex_m
|
|
66
|
-
jwt (2.10.
|
|
70
|
+
jwt (2.10.3)
|
|
67
71
|
base64
|
|
68
72
|
logger (1.7.0)
|
|
69
73
|
memoist (0.16.2)
|
|
@@ -72,15 +76,15 @@ GEM
|
|
|
72
76
|
multi_json (1.19.1)
|
|
73
77
|
multipart-post (2.4.1)
|
|
74
78
|
mutex_m (0.3.0)
|
|
75
|
-
nokogiri (1.19.
|
|
79
|
+
nokogiri (1.19.4)
|
|
76
80
|
mini_portile2 (~> 2.8.2)
|
|
77
81
|
racc (~> 1.4)
|
|
78
|
-
nokogiri (1.19.
|
|
82
|
+
nokogiri (1.19.4-arm64-darwin)
|
|
79
83
|
racc (~> 1.4)
|
|
80
|
-
nokogiri (1.19.
|
|
84
|
+
nokogiri (1.19.4-x86_64-linux-gnu)
|
|
81
85
|
racc (~> 1.4)
|
|
82
86
|
os (1.1.4)
|
|
83
|
-
public_suffix (7.0.
|
|
87
|
+
public_suffix (7.0.5)
|
|
84
88
|
racc (1.8.1)
|
|
85
89
|
rake (13.3.1)
|
|
86
90
|
representable (3.2.0)
|
|
@@ -104,7 +108,7 @@ GEM
|
|
|
104
108
|
rspec-support (3.13.7)
|
|
105
109
|
ruby-ole (1.2.13.1)
|
|
106
110
|
ruby2_keywords (0.0.5)
|
|
107
|
-
rubyzip (3.
|
|
111
|
+
rubyzip (3.6.0)
|
|
108
112
|
signet (0.21.0)
|
|
109
113
|
addressable (~> 2.8)
|
|
110
114
|
faraday (>= 0.17.5, < 3.a)
|
data/README.md
CHANGED
|
@@ -271,6 +271,43 @@ For example, if we wanted to override the default (english) and use spanish inst
|
|
|
271
271
|
platform :android, :override_default => 'es'
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
+
## Fastlane Integration
|
|
275
|
+
|
|
276
|
+
Use the [fastlane-plugin-localio](https://github.com/mrmans0n/fastlane-plugin-localio) plugin to run localio as part of your Fastlane workflow.
|
|
277
|
+
|
|
278
|
+
### Installation
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
fastlane add_plugin localio
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Usage
|
|
285
|
+
|
|
286
|
+
You can use an existing Locfile:
|
|
287
|
+
|
|
288
|
+
```ruby
|
|
289
|
+
lane :localize do
|
|
290
|
+
localio(locfile: "Locfile")
|
|
291
|
+
end
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Or configure everything inline:
|
|
295
|
+
|
|
296
|
+
```ruby
|
|
297
|
+
lane :localize do
|
|
298
|
+
localio(
|
|
299
|
+
platform: "android",
|
|
300
|
+
source: "xlsx",
|
|
301
|
+
source_path: "translations.xlsx",
|
|
302
|
+
source_sheet: "Sheet1",
|
|
303
|
+
output_path: "app/src/main/res",
|
|
304
|
+
formatting: "smart"
|
|
305
|
+
)
|
|
306
|
+
end
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
See the [plugin README](https://github.com/mrmans0n/fastlane-plugin-localio) for the full list of parameters and examples.
|
|
310
|
+
|
|
274
311
|
## Contributing
|
|
275
312
|
|
|
276
313
|
Please read the [contributing guide](https://github.com/mrmans0n/localio/blob/master/CONTRIBUTING.md).
|
data/lib/localio/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: localio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nacho Lopez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -130,10 +130,6 @@ files:
|
|
|
130
130
|
- README.md
|
|
131
131
|
- Rakefile
|
|
132
132
|
- bin/localize
|
|
133
|
-
- docs/plans/2026-02-23-modernization-design.md
|
|
134
|
-
- docs/plans/2026-02-23-modernization.md
|
|
135
|
-
- docs/plans/2026-02-23-twine-writer-design.md
|
|
136
|
-
- docs/plans/2026-02-23-twine-writer.md
|
|
137
133
|
- lib/localio.rb
|
|
138
134
|
- lib/localio/config_store.rb
|
|
139
135
|
- lib/localio/filter.rb
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Localio Modernization Design
|
|
2
|
-
|
|
3
|
-
**Date:** 2026-02-23
|
|
4
|
-
**Approach:** Option A — tests first, then dependency updates
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
Modernize the Localio gem in two phases:
|
|
9
|
-
|
|
10
|
-
1. Write a comprehensive RSpec test suite with fixtures and mocks
|
|
11
|
-
2. Update all dependencies to current versions and target Ruby 3.x, using the test suite as a safety net
|
|
12
|
-
|
|
13
|
-
## Phase 1: Test Suite
|
|
14
|
-
|
|
15
|
-
### Structure
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
spec/
|
|
19
|
-
spec_helper.rb
|
|
20
|
-
fixtures/
|
|
21
|
-
sample.csv # canonical test data: keys in 3 languages, special chars, comments, multi-level keys
|
|
22
|
-
sample.xlsx # small binary fixture
|
|
23
|
-
sample.xls # small binary fixture
|
|
24
|
-
localio/
|
|
25
|
-
term_spec.rb
|
|
26
|
-
segment_spec.rb
|
|
27
|
-
filter_spec.rb
|
|
28
|
-
formatter_spec.rb
|
|
29
|
-
template_handler_spec.rb
|
|
30
|
-
processors/
|
|
31
|
-
csv_processor_spec.rb
|
|
32
|
-
xlsx_processor_spec.rb
|
|
33
|
-
xls_processor_spec.rb
|
|
34
|
-
google_drive_processor_spec.rb # mocked worksheet interface
|
|
35
|
-
writers/
|
|
36
|
-
android_writer_spec.rb
|
|
37
|
-
ios_writer_spec.rb
|
|
38
|
-
swift_writer_spec.rb
|
|
39
|
-
json_writer_spec.rb
|
|
40
|
-
rails_writer_spec.rb
|
|
41
|
-
java_properties_writer_spec.rb
|
|
42
|
-
resx_writer_spec.rb
|
|
43
|
-
localio_spec.rb # end-to-end: CSV fixture → writer → verify output files
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Fixture Data
|
|
47
|
-
|
|
48
|
-
A single canonical `sample.csv` covers all test scenarios:
|
|
49
|
-
- Normal keys with translations in 3 languages
|
|
50
|
-
- Special characters: ampersands, ellipsis, printf format strings
|
|
51
|
-
- Comment rows
|
|
52
|
-
- Multi-level/nested keys (dot-separated) for JSON nesting tests
|
|
53
|
-
|
|
54
|
-
The same fixture data drives all processor and writer tests for consistency.
|
|
55
|
-
|
|
56
|
-
### Testing Strategy Per Layer
|
|
57
|
-
|
|
58
|
-
**Models (Term, Segment):** Construction, attribute access, `is_comment?` detection.
|
|
59
|
-
|
|
60
|
-
**Filter:** `only` and `except` with regex patterns against a fixed segment list.
|
|
61
|
-
|
|
62
|
-
**Formatter:** All 4 modes (`:smart`, `:none`, `:camel_case`, `:snake_case`) against varied key strings.
|
|
63
|
-
|
|
64
|
-
**Processors:**
|
|
65
|
-
- CSV/XLSX/XLS: Parse real fixture files, assert correct Term extraction, language detection, comment handling
|
|
66
|
-
- Google Drive: Mock the gem's worksheet interface, test the same parsing logic in isolation
|
|
67
|
-
|
|
68
|
-
**TemplateHandler:** Render ERB templates, write to `Dir.mktmpdir`, assert output matches expected content.
|
|
69
|
-
|
|
70
|
-
**Writers (all 7):** Feed a fixed Terms array → call writer → assert output files in a temp dir contain expected strings (spot-check key lines, not byte-perfect comparison).
|
|
71
|
-
|
|
72
|
-
**Pipeline (`localio_spec.rb`):** CSV fixture → Android + JSON writers → verify files exist with correct content.
|
|
73
|
-
|
|
74
|
-
### Key Test Helpers
|
|
75
|
-
- Shared `let(:terms)` factory via RSpec shared contexts
|
|
76
|
-
- `Dir.mktmpdir` for output isolation in all writer and template tests
|
|
77
|
-
- No network calls; Google Drive mocked at the worksheet interface level
|
|
78
|
-
|
|
79
|
-
## Phase 2: Dependency Updates
|
|
80
|
-
|
|
81
|
-
| Gem | Current | Target | Notes |
|
|
82
|
-
|-----|---------|--------|-------|
|
|
83
|
-
| `google_drive` | `~> 1.0` | `~> 3.0` | API changed; processor needs update |
|
|
84
|
-
| `spreadsheet` | `~> 1.0` | `~> 1.3` | Minor updates only |
|
|
85
|
-
| `simple_xlsx_reader` | `~> 1.0` | `~> 2.0` | Breaking changes in v2 |
|
|
86
|
-
| `nokogiri` | `~> 1.6` | `~> 1.16` | Mostly drop-in |
|
|
87
|
-
| `micro-optparse` | `~> 1.2` | remove → stdlib `optparse` | Unmaintained |
|
|
88
|
-
| `bundler` | `~> 1.3` | `~> 2.0` | Dev dep |
|
|
89
|
-
| Ruby | `>= 1.9.2` | `>= 3.0` | Gemspec update |
|
|
90
|
-
|
|
91
|
-
The green test suite from Phase 1 is the safety net — failures after dep updates pinpoint exactly what broke.
|