fix: support a non-English base language in localize & generate (#11) - #12
Merged
Conversation
The column layout is `label | description | meta | <source> | <locale> ...`, but the fourth (source) column was hard-coded to English: a sheet whose main language is `ru`, `de`, etc. was rejected as "not a localization sheet" and skipped entirely. - `isLocalizationHeader` now accepts any header whose fourth column resolves to a recognized language, so non-language data columns (reference tables, e.g. `Family`) are still rejected and left untouched. - The source language code is captured from the header and threaded through `LocalizeRow` into `buildLocalizationPrompt`, which now names the actual source language in the prompt and schema instead of hard-coding English. Closes #11 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up to the localize fix: the generation path had its own English assumption. `generate` hard-coded the `flutter gen-l10n` template to `<prefix>_en.arb`, so a bucket without an English column failed to generate. The template is now chosen per bucket via `selectTemplateArb` — English when present (unchanged), otherwise the first available ARB. Also bumps the version to 0.6.0, records both fixes in CHANGELOG.md, and adds CLAUDE.md documenting the release-hygiene requirement (version bump + CHANGELOG + `dart pub publish --dry-run`) that every task must satisfy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11.
The column layout is
label | description | meta | <source> | <locale> .... The fourth (source) column was assumed to be English, so a sheet whose base language wasru,de, etc. was mishandled. This affected both executables — they are separate code paths, so both are fixed.localize(lib/src/localize/)Previously
isLocalizationHeaderonly accepted an English fourth column, so arusource was rejected:isLocalizationHeadernow accepts any header whose fourth column resolves to a recognized language (resolveLanguageName != null). Non-language data columns (reference tables, e.g. aFamilycolumn) are still rejected, so those sheets are never overwritten.LocalizeRow.sourceCodeintobuildLocalizationPrompt, which now emitssource_language:/source_text:and names the actual source language in the prompt and JSON schema instead of hard-coding English. Defaults to English, so existing sheets are unchanged.generate(bin/generate.dart)generateLocalizationTablealready treated columns 3+ as ordinary locales (no English requirement), butgenerateFlutterLocalizationhard-coded theflutter gen-l10ntemplate to<prefix>_en.arb, so a bucket without an English column failed to generate.selectTemplateArbchooses the template per bucket: English when present (unchanged behaviour), otherwise the first available ARB — so a non-English base language generates too.Release / hygiene
CHANGELOG.md.CLAUDE.mddocumenting the release-hygiene requirement every task must satisfy (version bump + CHANGELOG +dart pub publish --dry-run).dart pub publish --dry-run→ 0 warnings.Tests
isLocalizationHeaderacceptsru/pt-BRsources; still rejects a non-language fourth column.extractEmptyCellscarries a non-EnglishsourceCode(incl. normalizingpt-BR→pt_BR) and reads the source text from the fourth column.buildLocalizationPromptnames a non-English source in the prompt and schema, and still defaults to English.selectTemplateArbprefers English, falls back for a non-English base, honours a custom prefix.dart analyzeclean.🤖 Generated with Claude Code