Repository navigation
Localize welcome, command examples, errors, and theme previews - #212
Conversation
There was a problem hiding this comment.
🟡 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.Textnow resolves the banner throughCurrentUICulture, so this test will fail when it runs under a culture with a generated localized.ftlresource (for example, after the localization build step). Keep this test culture-independent by asserting only the version/placeholders/ANSI invariants, or compare againstMessageServicevalues 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.
Code Coverage OverviewLanguages: C# C# / code-coverage/dotnetThe overall line coverage in commit c31eef0 in the Show a line coverage summary of the most impacted files.
Updated |
There was a problem hiding this comment.
🔵 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 aJsonElement, soEnumerateArray()then throws the framework's unlocalizedInvalidOperationExceptioninstead of this localized scripting error. Checkcollection.ValueKind == JsonValueKind.Arrayin 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
|
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. |
There was a problem hiding this comment.
🔵 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
DescriptionnorDescriptionKey: theifbody 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
There was a problem hiding this comment.
🔵 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
DescriptionKeyproperty is the only member of this attribute without XML documentation, unlikeExampleandDescriptionimmediately above. Since this is now the metadata used by every built-in command, document that it is aMessageServicelocalization key so the API guidance is clear.
- Files reviewed: 87/87 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
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. |
There was a problem hiding this comment.
🔵 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
DescriptionKeyis now the required path for built-in examples, but this attribute's XML example above still demonstrates only the legacyDescriptionform, 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 howDescriptionKeyis used (and its precedence for compatibility).
tools/Localization/FluentCatalogConverter.cs:202 - The new
StringLiteralfallback is the path used by the welcome labels and most newly added messages, but the regression test only translates the literaltitle; 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
|
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. |
Summary
Extend the existing Fluent/OneLoc localization workflow to the welcome screen, command-example descriptions, scripting and endpoint-validation errors, and theme previews.
DescriptionKeymetadata, preserving executable examples and English wording. Keep literalDescriptionsupport for compatibility.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.