Skip to content

Localize welcome, command examples, errors, and theme previews - #212

Merged
Mike Krüger (mkrueger) merged 8 commits into
mainfrom
dev/mkrueger/localize-welcome-banner
Sep 17, 2026
Merged

Mike Krüger (mkrueger) merged 8 commits into
mainfrom
dev/mkrueger/localize-welcome-banner

Conversation

@mkrueger

@mkrueger Mike Krüger (mkrueger) commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Extend the existing Fluent/OneLoc localization workflow to the welcome screen, command-example descriptions, scripting and endpoint-validation errors, and theme previews.

  • Replace hard-coded welcome labels, descriptions, resource labels, and the preview warning with 15 Fluent placeholders. Preserve ANSI artwork, executable examples, and URLs, and use a stacked layout that accommodates longer translations.
  • Migrate all 210 built-in command-example descriptions to stable DescriptionKey metadata, preserving executable examples and English wording. Keep literal Description support for compatibility.
  • Route scripting errors, endpoint-validation messages, and the positional error prefix through localization resources while preserving exception types and parameter names.
  • Localize theme-preview role labels and explanatory samples without translating command syntax or machine-readable identifiers.
  • Update the English source and OneLoc catalog, contributor guidance, and user documentation. Add rendering, help, error-contract, converter, and localization-key regression coverage.
  • Use English source text for missing translated catalog keys so pending translations do not block packaging. Unexpected keys and invalid supplied placeholders still fail validation.

Translation Delivery

New strings fall back to English until OneLoc delivers translations in a subsequent PR. Existing delivered entries that still contain English text also require a future OneLoc update; this PR does not replace the translated catalogs.

Generated locale-specific Fluent files, local migration scripts, and the German preview launcher are not included.

Follow-up to the first OneLoc delivery in #211.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Three unresolved moderate findings remain involving culture-dependent assertions and localized banner alignment.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request localizes the welcome screen and welcome command through Fluent/OneLoc, with English fallback for pending translations.

Changes:

  • Adds 15 localized welcome strings and placeholders.
  • Adds fallback and validation behavior for catalogs.
  • Adds regression tests and localization workflow documentation.
File summaries
File Reviewed changes and final comments
tools/Localization/FluentCatalogConverter.cs Adds English fallback for missing translations while preserving validation.
README.md Documents localized welcome behavior.
l10n/CosmosDBShell.json Synchronizes the localization source catalog.
docs/commands.md Documents welcome localization.
CosmosDBShell/lang/en.ftl Adds English welcome strings.
CosmosDBShell/cosmos_welcome.ans Uses localized placeholders. Moderate (3 votes): fixed offsets can misalign translated columns. Moderate (2 votes): fixed URL alignment can break with translated labels.
CosmosDBShell/Azure.Data.Cosmos.Shell.Core/WelcomeScreen.cs Resolves localized placeholders at render time.
CosmosDBShell.Tests/Localization/FluentCatalogConverterTests.cs Tests fallback and validation behavior.
CosmosDBShell.Tests/CommandTests/WelcomeCommandTests.cs Moderate (1 vote): hard-coded English assertions can fail under localized cultures.
CONTRIBUTING.md Documents the localization workflow.
Review details

Suppressed comments (1)

CosmosDBShell.Tests/CommandTests/WelcomeCommandTests.cs:20

  • WelcomeScreen.Text now resolves the banner through CurrentUICulture, so this test will fail when it runs under a culture with a generated localized .ftl resource (for example, after the localization build step). Keep this test culture-independent by asserting only the version/placeholders/ANSI invariants, or compare against MessageService values instead of hard-coded English labels.
        Assert.DoesNotContain("{{", WelcomeScreen.Text, StringComparison.Ordinal);
  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CosmosDBShell/cosmos_welcome.ans Resolved
Comment thread CosmosDBShell/cosmos_welcome.ans Resolved
@github-code-quality

github-code-quality Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall line coverage in commit c31eef0 in the dev/mkrueger/localiz... branch remains at 63%, unchanged from commit 615fe6e in the main branch.

Show a line coverage summary of the most impacted files.
File main 615fe6e dev/mkrueger/localiz... c31eef0 +/-
D:\a\CosmosDBSh...logConverter.cs 85% 86% +1%
D:\a\CosmosDBSh...ForStatement.cs 77% 79% +2%
D:\a\CosmosDBSh...ct\ShellJson.cs 98% 100% +2%
D:\a\CosmosDBSh...ectionString.cs 98% 100% +2%
D:\a\CosmosDBSh...elcomeScreen.cs 94% 96% +2%
D:\a\CosmosDBSh...llIdentifier.cs 96% 100% +4%
D:\a\CosmosDBSh...ShellDecimal.cs 67% 75% +8%
D:\a\CosmosDBSh...\ShellNumber.cs 90% 100% +10%
D:\a\CosmosDBSh...ct\ShellBool.cs 78% 89% +11%
D:\a\CosmosDBSh...ct\ShellText.cs 71% 93% +22%

Updated September 17, 2026 11:50 UTC

Copilot AI review requested due to automatic review settings September 15, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed localization, fallback behavior, tests, and documentation have no unresolved blocking issues.

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 0 new
  • Review effort level: Lite
Copilot AI review requested due to automatic review settings September 15, 2026 08:30
@mkrueger Mike Krüger (mkrueger) changed the title Localize welcome banner and allow pending translations Sep 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

ForStatement needs an explicit array-kind check to prevent unlocalized EnumerateArray() exceptions for non-array JSON values.

Review details

Suppressed comments (1)

CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/Statement/ForStatement.cs:99

  • This only rejects values that cannot be represented as JsonElement; a JSON object or scalar is still a JsonElement, so EnumerateArray() then throws the framework's unlocalized InvalidOperationException instead of this localized scripting error. Check collection.ValueKind == JsonValueKind.Array in this guard so every non-array input uses the new message.
  • Files reviewed: 77/77 changed files
  • Comments generated: 0 new
  • Review effort level: Lite
Copilot AI review requested due to automatic review settings September 15, 2026 09:27
@mkrueger

Copy link
Copy Markdown
Collaborator Author

Added an array-kind check in ForStatement so non-array JSON values use the localized collection error. Added regression cases for objects, strings, numbers, booleans, and null.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The localization-key audit can miss examples without descriptions, and several scripting conversion errors remain hard-coded English.

Review details

Suppressed comments (2)

CosmosDBShell.Tests/LocalizationKeyAuditTests.cs:73

  • This audit still passes when a built-in example has neither Description nor DescriptionKey: the if body is skipped for a null key. That means a future example can silently lose its help description without failing the regression test; require a non-null key before checking that it is defined and resolves.
                if (example.DescriptionKey is not null)
                {
                    Assert.Contains(example.DescriptionKey, definedKeys);
                    Assert.False(string.IsNullOrWhiteSpace(MessageService.GetString(example.DescriptionKey)));
                }

CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/Expression/JsonExpression.cs:61

  • This localizes only the empty-key case, but the same script expression still throws hard-coded English conversion errors at lines 89-154 (for JSON, integer, decimal, boolean, and string conversions), and other parser paths have similar literals. Those errors remain untranslated for common scripting failures, so the stated scripting-error localization is incomplete; route the remaining user-facing exceptions through resources or narrow the documented scope.
  • Files reviewed: 78/78 changed files
  • Comments generated: 0 new
  • Review effort level: Lite
Copilot AI review requested due to automatic review settings September 15, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The broad localization scope spans 87 reviewed files and merits final human review; one documentation nit remains.

Review details

Suppressed comments (1)

CosmosDBShell/Azure.Data.Cosmos.Shell.Core/CosmosExampleAttribute.cs:53

  • The new DescriptionKey property is the only member of this attribute without XML documentation, unlike Example and Description immediately above. Since this is now the metadata used by every built-in command, document that it is a MessageService localization key so the API guidance is clear.
  • Files reviewed: 87/87 changed files
  • Comments generated: 0 new
  • Review effort level: Lite
@mkrueger

Copy link
Copy Markdown
Collaborator Author

The audit now requires a nonempty DescriptionKey for every built-in example. Moved the remaining parser conversion errors, filter type error, and unsupported unary-operator message into localization resources, preserving diagnostic values and JSON parse details. Added regression coverage for the conversion messages.

Copilot AI review requested due to automatic review settings September 15, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The broad localization changes have unresolved review findings and warrant final human review.

Review details

Suppressed comments (2)

CosmosDBShell/Azure.Data.Cosmos.Shell.Core/CosmosExampleAttribute.cs:53

  • The new DescriptionKey is now the required path for built-in examples, but this attribute's XML example above still demonstrates only the legacy Description form, and the new property has no XML documentation. Generated API/docs guidance would therefore continue steering contributors toward literal descriptions despite the audit and CONTRIBUTING.md requiring localization keys; update the example and document how DescriptionKey is used (and its precedence for compatibility).
    tools/Localization/FluentCatalogConverter.cs:202
  • The new StringLiteral fallback is the path used by the welcome labels and most newly added messages, but the regression test only translates the literal title; its missing entries are pattern/select messages. Add a case where a simple source key is absent from the catalog and assert that the English literal is emitted, so a regression in this branch cannot silently block pending translations.
  • Files reviewed: 87/87 changed files
  • Comments generated: 0 new
  • Review effort level: Lite
@mkrueger

Copy link
Copy Markdown
Collaborator Author

Updated the attribute examples to use DescriptionKey and documented its precedence over the legacy Description property. Added a missing literal-string case to the fallback regression test and asserted that it emits the English source text.

@mkrueger
Mike Krüger (mkrueger) merged commit 0180771 into main Sep 17, 2026
11 checks passed
@mkrueger
Mike Krüger (mkrueger) deleted the dev/mkrueger/localize-welcome-banner branch September 17, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants