REPOSITORY CODING · MEDIUM
Implement regional locale fallback chains
Current-locale lookup works, but a missing regional translation immediately returns source text. Follow explicit locale parents and choose the first approved, current translation. Preserve the existing cycle guards and source fallback.
Architecture ExtensionTranslation project workbench
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
MEAN · 50 minute session
- Source keys match lowercase letters, digits, underscore, dot and hyphen, starting with a letter. Creating source requires revision=0; changing source requires its current revision and increments it. Saving identical source does not increment the revision.
- Text placeholders use {name}, where names start with a lowercase letter and contain letters, digits or underscores. Braces outside valid placeholders are errors. Translations must have the same placeholder names and occurrence counts as source; order may differ.
- Translate includes key, locale, actor, text, sourceRevision and expected translation revision (0 for new). Each accepted translation write increments its revision and starts unapproved. Source and translation revision conflicts reject the command without changing state.
- Approve includes key, locale, actor and current translation revision. The reviewer must differ from the translator. Translation sourceRevision must match the current source revision. Changing source dismisses all approvals; old translations remain visible for editing.
- Locales use language or language-region format, such as fr and fr-CA. Fallback links are explicit, single-parent and acyclic. A null parent removes a link. Resolve searches the requested locale then its chain for an approved current translation, finally using source text.
- Bundle returns sorted keys with their resolved text and origin. Snapshot returns sorted source keys, translations and fallback links. Each command commits atomically; failures leave that command state unchanged while the batch continues.
- This is a small workspace translation service, not a complete ICU MessageFormat implementation. It does not automatically infer regional fallbacks or perform machine translation.
MERN · 50 minute session
- Source keys match lowercase letters, digits, underscore, dot and hyphen, starting with a letter. Creating source requires revision=0; changing source requires its current revision and increments it. Saving identical source does not increment the revision.
- Text placeholders use {name}, where names start with a lowercase letter and contain letters, digits or underscores. Braces outside valid placeholders are errors. Translations must have the same placeholder names and occurrence counts as source; order may differ.
- Translate includes key, locale, actor, text, sourceRevision and expected translation revision (0 for new). Each accepted translation write increments its revision and starts unapproved. Source and translation revision conflicts reject the command without changing state.