Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: qa localisation #489

Merged
merged 16 commits into from
Jan 20, 2025
Prev Previous commit
Next Next commit
chore: fix comment and added RULES.md
khanti42 committed Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 1078736943fcc732abc7bc37bd0354bdd7fc85a7
22 changes: 22 additions & 0 deletions packages/starknet-snap/locales/RULES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Rules for Adding New Fields to the Language File

1. **Key Naming Convention:**
- Use **English text** to derive the key.
- The key should be **camelized** (first word lowercase, subsequent words capitalized).
- Keep the key to **no more than 5 words**.
- If the text in English is **shorter than 5 words**, camelize the entire phrase.
- For **longer text**, use a **concise and meaningful key** (this is a soft constraint).

2. **Dynamic Text Placeholders:**
- Use `{1}`, `{2}`, etc., for dynamic placeholders in messages.
- Example:
- `"visitCompanionDappAndUpgrade": { "message": "Visit the [companion dapp for Starknet]({1}) and click “Upgrade”.\nThank you!" }`
- Usage: `translate("visitCompanionDappAndUpgrade", "https://website.com")`

3. **Consistency:**
- Ensure key names are meaningful and reflect the message context.
- Avoid over-complicating keys; aim for clarity and simplicity.

---

These guidelines will ensure consistency and clarity when adding new fields to the language file.
8 changes: 4 additions & 4 deletions packages/starknet-snap/locales/en.json
Original file line number Diff line number Diff line change
@@ -115,10 +115,10 @@
"snapUpdate": {
"message": "Your Starknet Snap is now up-to-date!"
},
"starknetPrivateKeyDescription": {
"starknetPrivateKeyConfidential": {
"message": "Below is your Starknet Account private key. Keep it confidential."
},
"starknetPrivateKeyTitle": {
"starknetPrivateKey": {
"message": "Starknet Account Private Key"
},
"switchNetworkPrompt": {
@@ -142,10 +142,10 @@
"visitCompanionDappHomePage": {
"message": "Visit the [companion dapp for Starknet]({1}) to manage your account."
},
"visiteCompanionDappAndDeloy": {
"visitCompanionDappAndDeploy": {
"message": "Visit the [companion dapp for Starknet]({1}) to deploy your account.\nThank you!"
},
"visiteCompanionDappAndUpgrade": {
"visitCompanionDappAndUpgrade": {
"message": "Visit the [companion dapp for Starknet]({1}) and click “Upgrade”.\nThank you!"
},
"walletCompatibility": {
8 changes: 4 additions & 4 deletions packages/starknet-snap/locales/fr.json
Original file line number Diff line number Diff line change
@@ -115,10 +115,10 @@
"snapUpdate": {
"message": "Votre Starknet Snap est maintenant à jour !"
},
"starknetPrivateKeyDescription": {
"starknetPrivateKeyConfidential": {
"message": "Voici la clé privée de votre compte Starknet. Gardez-la confidentielle."
},
"starknetPrivateKeyTitle": {
"starknetPrivateKey": {
"message": "Clé privée du compte Starknet"
},
"switchNetworkPrompt": {
@@ -142,10 +142,10 @@
"visitCompanionDappHomePage": {
"message": "Visitez la [dapp compagnon pour Starknet]({1}) pour gérer votre compte."
},
"visiteCompanionDappAndDeloy": {
"visitCompanionDappAndDeploy": {
"message": "Visitez la [dapp compagnon pour Starknet]({1}) pour déployer votre compte.\nMerci !"
},
"visiteCompanionDappAndUpgrade": {
"visitCompanionDappAndUpgrade": {
"message": "Visitez la [dapp compagnon pour Starknet]({1}) et cliquez sur “Upgrade”.\nMerci !"
},
"walletCompatibility": {
Original file line number Diff line number Diff line change
@@ -38,8 +38,8 @@ export const DisplayPrivateKeyAlertUI: SnapComponent<
const translate = getTranslator();
return (
<Box>
<Heading>{translate('starknetPrivateKeyTitle')}</Heading>
<Text>{translate('starknetPrivateKeyDescription')}</Text>
<Heading>{translate('starknetPrivateKey')}</Heading>
<Text>{translate('starknetPrivateKeyConfidential')}</Text>
<Copyable value={privateKey} />
</Box>
);
4 changes: 2 additions & 2 deletions packages/starknet-snap/src/utils/snapUtils.ts
Original file line number Diff line number Diff line change
@@ -903,7 +903,7 @@ export async function showUpgradeRequestModal() {
const translate = getTranslator();
await alertDialog([
heading(translate('accountUpgradeMandatory')),
text(translate('visiteCompanionDapp', getDappUrl())),
text(translate('visitCompanionDappAndUpgrade', getDappUrl())),
]);
}

@@ -914,7 +914,7 @@ export async function showDeployRequestModal() {
const translate = getTranslator();
await alertDialog([
heading(translate('accountDeploymentMandatory')),
text(translate('visiteCompanionDappAndDeloy', getDappUrl())),
text(translate('visitCompanionDappAndDeploy', getDappUrl())),
]);
}