Fix #109: connect --language and --country to export request options - #449
Open
jacalata wants to merge 3 commits into
Open
Fix #109: connect --language and --country to export request options#449jacalata wants to merge 3 commits into
jacalata wants to merge 3 commits into
Conversation
--language was already threading through to request_options.language on export, but --country never reached the REST API. tabcmd Classic combined the two into a BCP 47 locale like en-GB or de-DE so exports formatted numbers, dates, and currency for that region. - Add _resolve_locale() that joins language + country when both are set, falls back to language alone, and drops country-only (matching Classic which required --language with --country). - Route apply_png_options / apply_pdf_options / apply_csv_options through the helper. - Relax --country choices from language codes to any 2-letter code (upper-cased), so users can pass real country codes like GB, MX, BR. Fixes #109.
The docstring/PR body claimed --country alone was warned about, but the code silently dropped it. Thread the logger through _resolve_locale and emit a warning that names the ignored country code. Adds tests for both the warn-and-drop and don't-warn-when-language-is-set paths. Co-Authored-By: Claude Opus 4.7 (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.
Closes #109.
Motivation
--languagewas threading through torequest_options.languageonexport, but
--countrynever reached the REST API. Classic combinedthe two into a BCP 47 locale (
en-GB,de-DE,pt-BR) so exportsformatted numbers, dates, and currency for that region. tabcmd 2's
--countrywas cosmetic.Behavior change
For users:
_resolve_locale()joins--language+--countryinto alang-COUNTRYlocale string when both are set; falls back tolanguage alone if only that is supplied.
--countryalone now logs a WARNING that names the ignored countrycode and drops it (matching Classic which required
--languagewith--country). Previously silently dropped.--countrychoices relaxed from the incorrectly-populated languagecodes (
de|en|es|...) to any 2-letter code (upper-cased), so userscan actually pass
GB,MX,BR, etc.apply_png_options/apply_pdf_options/apply_csv_options.Test plan
tests/commands/test_datasources_and_workbooks_command.py— 8new tests cover combined locale for PNG/PDF/CSV, country-only drops
with a warning, language-only pass-through does not warn
🤖 Generated with Claude Code