locale_sheet 0.6.0
locale_sheet: ^0.6.0 copied to clipboard
CLI and library that converts Excel localization sheets into ARB and other formats.
CHANGE LOG #
0.6.0 - 2026-09-07 #
- change:
ExcelParsernow uses a focused built-in XLSX reader instead of theexcelpackage at runtime. The optionaldecoderconstructor argument has been removed; code that injected anExceldecoder must pass XLSX bytes through the normal parser path or provide anExcelParserimplementation at the caller boundary. - change: runtime dependencies changed.
archive: ^3.6.1andxml: ^6.6.1are now runtime dependencies, andexcelis used only to build test fixtures. Applications that already depend onarchive: ^4.0.0orxml: ^7.0.0cannot resolve this version; the constraints stay narrow until the reader can be verified against those major versions. - fix: XLSX files containing duplicate entries in
sharedStrings.xmlno longer fail withNull check operator used on a null valueor shift subsequent cell values. Shared-string positions and duplicates are now preserved exactly while reading. - fix: numbers whose format contains a colour, currency, or condition section (for example
[Red]#,##0.00) are no longer misread as dates or times. Only the parts of a format code that specify a date or time are considered. - fix: date and time cells that use an East Asian builtin number format (
numFmtId27–36 and 50–58, such asyyyy"年"m"月"d"日") are converted like other date cells instead of being emitted as a raw serial number. - fix: worksheets that omit the optional row and cell position attributes (
row@r/c@r) are read in document order instead of being reported as an empty sheet. - fix: cells belonging to a shared formula now export their stored value instead of a bare
=. - fix: workbooks written with namespace prefixes (
<x:sheet>,<pkg:Relationship>) are read instead of failing with a sheet-not-found error that lists no sheets. - fix:
date1904="true"is recognised as the 1904 date system, so dates in such workbooks are no longer shifted by 1462 days. - fix: boolean cells written as
<v>true</v>are no longer reported asfalse. - fix: inline strings no longer include phonetic hints (
rPh) in their text, matching how shared strings are read. - fix: elapsed-time formats (
[h]:mm:ssandnumFmtId46) no longer wrap at 24 hours; 30 hours is exported as30:00:00. - fix: an out-of-range style index on a cell no longer escapes as a
RangeError; such cells are read without a number format.
0.5.0 - 2026-07-29 #
This release contains breaking changes. The change: entries below list them first.
- change: exit codes now follow the BSD
sysexits.hconvention and1is no longer used. Previously the same kind of mistake could produce either1or64depending on which exception type happened to surface — for example a missing--sheet-namegave64while a missing--description-headergave1. Now:64for command line errors,65for input that does not match what you asked for,66when the input cannot be read,73when the output cannot be written,70for unexpected internal errors (previously an uncaughtErrorexited255with no documented meaning). The line between64and65is whether the mistake can be seen without opening the input file. Scripts that branch on the exit code need updating; scripts that only check for zero are unaffected. - change: warnings now go to stderr instead of stdout, and the
WARNING:prefix is added by the log level rather than written into each message. This affects the duplicate-key, undeclared-placeholder and ineffective-option warnings. If you were grepping stdout forWARNING:, read stderr instead. Library users implementingLoggermust add awarnmethod. - change: the lists held by
LocalizationSheet(locales,entries,ignoredHeaders) are now unmodifiable. Code that mutated them in place must build a new sheet instead. - feat: add
--locales(and alocalesparameter onconvertExcelToArb/convertExcelBytesToArb) to name the locale columns explicitly, e.g.--locales en,ja. Automatic detection is permissive — any 2–8 letter header such asmemoornotequalifies as a locale — so sheets with extra columns previously produced files likeapp_memo.arb. A requested tag missing from the header row is now an error rather than a silently dropped language. Omitting the option keeps the previous behavior. - feat: the CLI now always logs which columns were selected as locales and which were ignored, and
LocalizationSheet.ignoredHeadersexposes the ignored headers to library users. - feat: add
ExcelParser.parseWorkbook, which returns the parsed sheet together with the name of the sheet it read and the names of all sheets in the workbook. The CLI uses it to decode the workbook once per run instead of twice.parseis unchanged and now delegates to it. Code that subclassedExcelParserto overrideparsemust overrideparseWorkbookinstead. - feat: expose
PlaceholderResolver, which detects undeclared placeholders in aLocalizationSheetand optionally adds them, returning a new sheet rather than modifying the input. The CLI now uses it instead of doing the work inline. - feat: warn when the same key appears in more than one row.
LocalizationSheet.duplicateKeysexposes the list for library users. Export behavior is unchanged (later rows still win per locale). - fix: reject locale columns that refer to the same locale instead of silently losing one of them.
zh-TWandzh_TW, orenandEN, both map to the same ARB filename, so the later column used to overwrite the earlier one. Case-only differences additionally produced different output on case-sensitive and case-insensitive filesystems. - fix: the CLI now fails with
65when the sheet has no locale columns, instead of reporting success after writing no files at all. The error names the ignored columns and points at--locales. The library API is unchanged and still accepts a sheet with no locales. - fix: running the CLI with no command at all now prints the usage to stderr and exits with
64instead of exiting0without doing anything. Asking for help explicitly (--help,help) still exits0. - fix:
ArbExporternow validates every locale before writing anything, so a rejected locale tag no longer leaves ARB files for the locales processed before it, and no longer creates the output directory. - fix:
LocalizationEntryequality andhashCodenow compare placeholders by value. Two entries holding identical placeholders previously never compared equal, because each comparison converted the placeholders to freshMapinstances. Entries without placeholders were unaffected. - docs: fix the Quick Start dependency snippet in
README.md/README_ja.md—locale_sheetwas not indented underdev_dependencies, so the snippet was invalid YAML as written. - docs: document the
--color/--no-coloroption, which was missing from the CLI option list in both READMEs. - docs: correct the
--description-headerdescription inREADME.md/README_ja.md— matching ignores surrounding whitespace and is case-insensitive, so calling it an "exact" match was wrong. - docs: sync
example/README.md/example/README_ja.mdwith the actualsample.xlsx— add the missinglikeFoodFluitrow (the placeholder sample) and replace the stale "columns: key, en, ja" summary. - chore: drop the
pathdependency, which was declared inpubspec.yamlbut never imported anywhere in the package.
0.4.0 - 2026-01-20 #
- feat: add auto-detect placeholders for the
exportcommand; new CLI options--auto-detect-placeholdersand--treat-undefined-placeholdersto control handling of undefined placeholders; updates to documentation and examples (#24) - feat: accumulate multiple placeholders detected in a single string during auto-detection (improves placeholder merging in exports)
- feat: update
example/sample.xlsxused by CLI and tests (#28)
0.3.0 - 2026-01-11 #
- feat: enhance CLI logging with color output and structured messages (#19)
- feat: add description header support in locale_sheet export (#17)
- chore: update Flutter SDK version to 3.38.6 (#15)
- docs: fix formatting in README and README_ja for consistency (#13)
- chore: agents and scripts improvements (#11)
- chore: standardize CLI/runtime messages to English; update README and tests accordingly (#10)
0.2.0 - 2026-01-10 #
0.1.1 - 2026-01-06 #
- Fixed: Quick Start in
README.md/README_ja.md— dependency example updated tolocale_sheet: ^0.1.1(previously^0.0.2).
0.1.0 - 2026-01-06 #
- Added CLI option
--default-locale(-d) to specify a fallback locale when translations are missing.- If
--default-localeis provided and the locale does not exist in the sheet, the command exits with code64and prints an error. - If
--default-localeis omitted, the CLI usesenif present in the sheet; otherwise it falls back to the first locale column. If no locale columns exist,enis used as a conservative default.
- If
- Threaded
defaultLocalethrough public API:convertExcelToArb/convertExcelBytesToArbnow accept adefaultLocaleparameter (default:'en'). LocalizationExporter.exportsignature now accepts a nameddefaultLocaleargument. Update custom exporters if you implement your own exporter.ArbExporternow falls back todefaultLocalefor missing translations.- Documentation: updated
README.mdandREADME_ja.mdwith examples and notes for--default-locale. - Tests: updated unit tests to reflect the new behavior.
0.0.1 #
- Initial version.