localio 0.2.1 → 0.2.2
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/.github/workflows/release.yml +42 -0
- data/AGENTS.md +1 -0
- data/CLAUDE.md +79 -0
- data/Gemfile.lock +1 -1
- data/lib/localio/version.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1f31b993473369d48f4c412c59ac04e9614ff3d0d614b68e041fa5856c91657
|
|
4
|
+
data.tar.gz: 502a7d85bb17426d0985328f89488de086fc08692be41c951dc22bc16a517bad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10742946a6d8928b4f636bdec770d31364281a4b5070537342656f376500e4a17322c89d8dc755ec91c48d0d0e8e0fe74535a799ee6d990e099b9ec02f9fda3a
|
|
7
|
+
data.tar.gz: c2135d3b03e5c82250715d03fc4c6354279bc08ec7394bf31ca4edc9b11535dc53efd1dcdafb5591a9be4c2900ce06da2d1325dd0aae8906c1d2263e618d59d7
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
name: Publish to RubyGems
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: "3.3"
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: bundle exec rspec
|
|
25
|
+
|
|
26
|
+
- name: Verify version matches tag
|
|
27
|
+
run: |
|
|
28
|
+
GEM_VERSION=$(ruby -r ./lib/localio/version -e 'puts Localio::VERSION')
|
|
29
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
30
|
+
if [ "$GEM_VERSION" != "$TAG_VERSION" ]; then
|
|
31
|
+
echo "::error::Version mismatch: gem=$GEM_VERSION tag=$TAG_VERSION"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
echo "Publishing localio v$GEM_VERSION"
|
|
35
|
+
|
|
36
|
+
- name: Build gem
|
|
37
|
+
run: gem build localio.gemspec
|
|
38
|
+
|
|
39
|
+
- name: Publish to RubyGems
|
|
40
|
+
run: gem push localio-*.gem
|
|
41
|
+
env:
|
|
42
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CLAUDE.md
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run all tests
|
|
9
|
+
bundle exec rspec
|
|
10
|
+
|
|
11
|
+
# Run a single spec file
|
|
12
|
+
bundle exec rspec spec/localio_spec.rb
|
|
13
|
+
|
|
14
|
+
# Run a single example by line number
|
|
15
|
+
bundle exec rspec spec/localio_spec.rb:42
|
|
16
|
+
|
|
17
|
+
# Standard gem tasks (build, install, release)
|
|
18
|
+
bundle exec rake
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## What This Gem Does
|
|
22
|
+
|
|
23
|
+
Localio reads translation data from spreadsheets (Google Drive, XLS, XLSX, CSV) and generates platform-specific localization files. Supported output platforms: Android (`strings.xml`), iOS/Swift (`.strings` + header/constants), JSON, Rails YAML, Java `.properties`, `.resx`, and Twine format.
|
|
24
|
+
|
|
25
|
+
The entry point is `bin/localize`, which reads a `Locfile` (Ruby DSL) from the current directory.
|
|
26
|
+
|
|
27
|
+
## Architecture
|
|
28
|
+
|
|
29
|
+
### Data Flow
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Locfile (DSL config)
|
|
33
|
+
→ Processor (reads spreadsheet source)
|
|
34
|
+
→ Filter (regex-based key filtering)
|
|
35
|
+
→ LocalizableWriter (dispatches to platform writer)
|
|
36
|
+
→ ERB templates → output files
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Key Abstractions
|
|
40
|
+
|
|
41
|
+
**`Locfile`** (`lib/localio/locfile.rb`) — DSL parser using `instance_eval`. Stores platform, source credentials, output path, formatter, and filters.
|
|
42
|
+
|
|
43
|
+
**`Processor`** (`lib/localio/processor.rb`) — Routes to the correct reader based on `:platform` config. Returns a hash of `language => [Segment]` pairs.
|
|
44
|
+
|
|
45
|
+
**`LocalizableWriter`** (`lib/localio/localizable_writer.rb`) — Routes to the correct writer class. Writers live in `lib/localio/writers/` and use ERB templates from `lib/localio/templates/`.
|
|
46
|
+
|
|
47
|
+
**`Segment`** — A single translation unit: `{key, value, language}`. **`Term`** — A key with a hash of all language values.
|
|
48
|
+
|
|
49
|
+
**`Filter`** (`lib/localio/filter.rb`) — Applied after loading; supports `:only` (allowlist) and `:except` (denylist) regex patterns.
|
|
50
|
+
|
|
51
|
+
**`Formatter`** (`lib/localio/formatter.rb`) — Transforms key names: `:smart`, `:snake_case`, `:camel_case`, `:none`.
|
|
52
|
+
|
|
53
|
+
### Spreadsheet Format Convention
|
|
54
|
+
|
|
55
|
+
Spreadsheets must follow a specific structure:
|
|
56
|
+
- A `[key]` marker row with language codes as column headers (default language marked with `*`)
|
|
57
|
+
- Data rows with key in column A, translations in subsequent columns
|
|
58
|
+
- An `[end]` marker row to stop parsing
|
|
59
|
+
- Optional `[comment]` rows for documentation (skipped during parsing)
|
|
60
|
+
|
|
61
|
+
### Adding a New Platform
|
|
62
|
+
|
|
63
|
+
1. Create `lib/localio/writers/<platform>_writer.rb` with a `write_localizables(holder, path)` class method
|
|
64
|
+
2. Create corresponding ERB template(s) in `lib/localio/templates/`
|
|
65
|
+
3. Add a case branch in `LocalizableWriter`
|
|
66
|
+
4. Add a case branch in the `platform` DSL accessor in `Locfile`
|
|
67
|
+
5. Add specs in `spec/writers/`
|
|
68
|
+
|
|
69
|
+
### Adding a New Source Format
|
|
70
|
+
|
|
71
|
+
1. Create `lib/localio/processors/<format>_processor.rb` with a `load_localizables(config)` class method returning `{language => [Segment]}`
|
|
72
|
+
2. Add a case branch in `Processor`
|
|
73
|
+
3. Add specs in `spec/processors/`
|
|
74
|
+
|
|
75
|
+
## Notes
|
|
76
|
+
|
|
77
|
+
- `String` is monkey-patched in `lib/localio/string_helper.rb` with color helpers and case-conversion methods used throughout
|
|
78
|
+
- The `ConfigStore` (`lib/localio/config_store.rb`) persists OAuth tokens/config to a local YAML file (`.localio.yml`)
|
|
79
|
+
- Tests use fixture spreadsheet files in `spec/` directories alongside spec files
|
data/Gemfile.lock
CHANGED
data/lib/localio/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nacho Lopez
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-02-24 00:00:00.000000000 Z
|
|
@@ -117,9 +117,12 @@ extensions: []
|
|
|
117
117
|
extra_rdoc_files: []
|
|
118
118
|
files:
|
|
119
119
|
- ".github/workflows/ci.yml"
|
|
120
|
+
- ".github/workflows/release.yml"
|
|
120
121
|
- ".gitignore"
|
|
121
122
|
- ".rspec"
|
|
122
123
|
- ".ruby-version"
|
|
124
|
+
- AGENTS.md
|
|
125
|
+
- CLAUDE.md
|
|
123
126
|
- CONTRIBUTING.md
|
|
124
127
|
- Gemfile
|
|
125
128
|
- Gemfile.lock
|
|
@@ -193,7 +196,7 @@ homepage: https://github.com/mrmans0n/localio
|
|
|
193
196
|
licenses:
|
|
194
197
|
- MIT
|
|
195
198
|
metadata: {}
|
|
196
|
-
post_install_message:
|
|
199
|
+
post_install_message:
|
|
197
200
|
rdoc_options: []
|
|
198
201
|
require_paths:
|
|
199
202
|
- lib
|
|
@@ -208,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
211
|
- !ruby/object:Gem::Version
|
|
209
212
|
version: '0'
|
|
210
213
|
requirements: []
|
|
211
|
-
rubygems_version: 3.
|
|
212
|
-
signing_key:
|
|
214
|
+
rubygems_version: 3.5.22
|
|
215
|
+
signing_key:
|
|
213
216
|
specification_version: 4
|
|
214
217
|
summary: Generates Android, iOS, Rails, JSON, Java Properties, and .NET ResX localization
|
|
215
218
|
files from spreadsheet sources.
|