breaking: change translation reserving keys for arguments - #110
Conversation
WalkthroughThis change updates the naming convention for localization keys related to command-line argument descriptions throughout the documentation, localization resource files, and codebase. The prefix for these keys is changed from "Option:" to "arg:". All relevant documentation, example JSON files, and test cases are updated to reflect this new convention. The constant defining the prefix is also updated in the source code. No changes are made to the logic, structure, or exported entities of the codebase, except for the constant value. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Localization
User->>CLI: Run command with arguments
CLI->>Localization: Request description for argument (uses "arg:" prefix)
Localization-->>CLI: Return localized description
CLI-->>User: Display argument description/help
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@gunshi/bone
@gunshi/definition
gunshi
@gunshi/plugin
@gunshi/plugin-completion
@gunshi/plugin-dryrun
@gunshi/plugin-global
@gunshi/plugin-i18n
@gunshi/plugin-renderer
@gunshi/resources
@gunshi/shared
commit: |
Deploying gunshi with
|
| Latest commit: |
fa46ecb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://df29fc57.gunshi.pages.dev |
| Branch Preview URL: | https://breaking-translation-reserve.gunshi.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
docs/guide/essentials/declarative-configuration.md(1 hunks)docs/guide/essentials/internationalization.md(9 hunks)playground/deno/locales/en-US.json(1 hunks)playground/deno/locales/ja-JP.json(1 hunks)playground/i18n/locales/en-US.json(1 hunks)playground/i18n/locales/ja-JP.json(1 hunks)src/constants.ts(1 hunks)src/context.test.ts(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (20)
playground/deno/locales/en-US.json (1)
4-5: Rename localization keys to use new prefixThe keys
"arg:name"and"arg:type"correctly replace the old"Option:"prefixed keys, and the associated values remain unchanged. This aligns with the updatedOPTION_PREFIX.docs/guide/essentials/declarative-configuration.md (1)
165-165: Update negatable option description referenceThe documentation now correctly references
arg:no-<optionName>instead ofOption:no-<optionName>for customizing negatable boolean option messages. This matches the new prefix convention.playground/i18n/locales/en-US.json (1)
4-5: Apply new prefix to internationalization keysThe JSON keys
"arg:name"and"arg:formal"properly adopt thearg:prefix, ensuring consistency across locale files. No changes needed for the values.playground/deno/locales/ja-JP.json (1)
2-5: Refine Japanese locale keys and descriptionsThe
"description"string has been improved for clarity, and the keys"arg:name"and"arg:type"correctly replace the oldOption:prefix. These updates maintain alignment with the overall prefix change.playground/i18n/locales/ja-JP.json (2)
2-2: Slight improvement in Japanese wording.The description has been slightly reworded from "国際化対応の挨拶アプリケーション" to "国際化対応した挨拶アプリケーション," which reads more naturally in Japanese.
4-5: Prefix change from "Option:" to "arg:" for command arguments.The localization keys for command arguments have been updated from the "Option:" prefix to "arg:" prefix, which aligns with the breaking change mentioned in the PR title. This is consistent with similar changes in other files.
docs/guide/essentials/internationalization.md (8)
40-42: Updated prefix from "Option:" to "arg:" in i18n examples.Command argument keys in the resource definitions are properly updated to use the new "arg:" prefix.
156-158: Updated prefix in locale file examples.The JSON sample for English locale files correctly reflects the new "arg:" prefix convention for command arguments.
168-170: Updated prefix in Japanese locale file examples.The JSON sample for Japanese locale files correctly uses the new "arg:" prefix convention.
250-251: Updated documentation for resource key naming conventions.The resource key naming conventions section has been appropriately updated to reflect the change from "Option Descriptions" to "Argument Descriptions" with guidance on using the new "arg:" prefix. The example for negatable arguments has also been adjusted accordingly.
271-274: Updated example pattern for resource key naming.The code example showing key naming conventions correctly uses the "arg:" prefix for target and verbose options, along with the negatable version.
428-430: Updated log statements in comprehensive example.The log statements in the complete example have been updated to use the new "arg:" prefix when accessing translations.
450-452: Updated example locale files in comprehensive example.The English locale file example at the end of the documentation is correctly updated to use the "arg:" prefix.
462-464: Updated Japanese locale file in comprehensive example.The Japanese locale file example at the end of the documentation is correctly updated to use the "arg:" prefix.
src/context.test.ts (6)
299-303: Updated test resource keys to use "arg:" prefix.The test resource object for Japanese locale now uses the "arg:" prefix for command argument keys, which is consistent with the breaking change introduced in this PR.
350-356: Updated test assertions to use new key format.The test assertions have been correctly updated to verify translations using the new "arg:" prefixed keys.
376-376: Updated MessageFormat2 adapter test to use "arg:" prefix.The resource object for MessageFormat2 translation adapter test has been correctly updated to use the "arg:" prefix.
415-416: Updated MessageFormat test to use the new key format.The MessageFormat test now correctly uses the "arg:foo" key both when creating the MessageFormat instance and when calling ctx.translate.
432-432: Updated Intlify MessageFormat test to use "arg:" prefix.The resource object for Intlify MessageFormat translation adapter test has been correctly updated to use the "arg:" prefix.
471-471: Updated Intlify MessageFormat assertion to use "arg:" prefix.The test assertion for Intlify MessageFormat translation now correctly uses the "arg:foo" key.
| export const BUILT_IN_PREFIX = '_' | ||
|
|
||
| export const OPTION_PREFIX = 'Option' | ||
| export const OPTION_PREFIX = 'arg' |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Update constant value for translation key prefix
The OPTION_PREFIX constant was correctly updated from 'Option' to 'arg' to reflect the new naming convention for argument keys. Please ensure there are no remaining occurrences of the old Option: prefix across the codebase.
🏁 Script executed:
#!/bin/bash
# Verify no stale "Option:" keys remain
rg -nF '"Option:' .Length of output: 21
🏁 Script executed:
#!/bin/bash
# Verify no stale "Option:" keys remain anywhere in the codebase
rg -nF "Option:" .Length of output: 196
Stale Option: occurrences found in playground/i18n/index.js
Please update these to use the new OPTION_PREFIX constant ('arg') or replace "Option:" with "arg:".
• playground/i18n/index.js:56
• playground/i18n/index.js:57
Suggested diff:
- console.log(`Name Option: ${ctx.translate('name')}`)
+ console.log(`Name ${OPTION_PREFIX}: ${ctx.translate('name')}`)
- console.log(`Formal Option: ${ctx.translate('formal')}`)
+ console.log(`Formal ${OPTION_PREFIX}: ${ctx.translate('formal')}`)Committable suggestion skipped: line range outside the PR's diff.
Description
Linked Issues
Additional context
Summary by CodeRabbit
Documentation
Style
Tests