Skip to content

Commit

Permalink
Merge pull request #2119 from oasisprotocol/lw/fix-translations
Browse files Browse the repository at this point in the history
Fix extracting translations
  • Loading branch information
lukaw3d authored Jan 30, 2025
2 parents d912c81 + 9e25e40 commit 5530919
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 28 deletions.
1 change: 1 addition & 0 deletions .changelog/2119.process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix extracting translations
6 changes: 2 additions & 4 deletions extension/src/ExtLedgerAccessPopup/ExtLedgerAccessPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ export function ExtLedgerAccessPopup() {
<img src={logotype} alt="Oasis" width="75" height="75" />
</Box>
<Header fill textAlign="center">
{t('ledger.extension.grantAccess', 'Grant access to your Ledger')}
{t('ledger.extension.grantAccess', 'Grant access to your USB Ledger')}
</Header>
<Box gap="medium">
<p>
{t('ledger.instructionSteps.connectUsbLedger', 'Connect your USB Ledger device to the computer')}
</p>
<p>{t('ledger.instructionSteps.connectUsbLedger', 'Connect your Ledger to this device via USB')}</p>

{connection === 'connecting' && (
<Box
Expand Down
10 changes: 8 additions & 2 deletions internals/extractMessages/i18next-scanner.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
const typescriptTransform = require('i18next-scanner-typescript')

module.exports = {
input: ['src/**/**.{js,jsx,ts,tsx}', '!**/node_modules/**', '!src/**/*.test.{ts,tsx}'],
input: [
'src/**/**.{js,jsx,ts,tsx}',
'!src/**/*.test.{ts,tsx}',
'extension/src/**/**.{js,jsx,ts,tsx}',
'!extension/src/**/*.test.{ts,tsx}',
'!**/node_modules/**',
],
output: './',
options: {
debug: false,
debug: true, // Warn about duplicate translation keys with differing texts.
removeUnusedKeys: true,
sort: true,
func: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"lint-changelog": "markdownlint --config .changelog/.markdownlint.yml .changelog/",
"changelog": "node ./internals/scripts/changelog.js",
"release-tag": "node ./internals/scripts/release-tag.js",
"extract-messages": "rm src/locales/en/translation.json && i18next-scanner --config=internals/extractMessages/i18next-scanner.config.js && node ./internals/scripts/normalize-translations.js ./src/locales/*/translation.json",
"extract-messages": "rm src/locales/en/translation.json && i18next-scanner --config=internals/extractMessages/i18next-scanner.config.js | grep -v 'Added a new translation key' && node ./internals/scripts/normalize-translations.js ./src/locales/*/translation.json",
"fix-grommet-icons-types": "node ./internals/scripts/fix-grommet-icons-types.js",
"print-extension-dev-csp": "node ./internals/scripts/print-extension-dev-csp.js",
"android": "yarn build && yarn cap sync android && yarn cap run android -l --external",
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe('The extension popup should load', () => {
await page.goto(`${extensionPopupURL}/open-wallet`)
const popupPromise = context.waitForEvent('page')
await page.getByRole('button', { name: /Ledger/i }).click()
await page.getByRole('button', { name: /Grant access to your Ledger/i }).click()
await page.getByRole('button', { name: /Grant access to your USB Ledger/i }).click()
const popup = await popupPromise
await popup.waitForLoadState()
await popup.getByRole('button', { name: /Connect Ledger device/i }).click()
Expand Down
4 changes: 2 additions & 2 deletions playwright/tests/syncTabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test.describe('syncTabs', () => {
await page.getByTestId('toolbar-contacts-tab').click()
await page.getByText('You have no contacts yet.')

await page.getByRole('button', { name: 'Add Contact' }).click()
await page.getByRole('button', { name: 'Add contact' }).click()
await page.getByPlaceholder('Name').fill('stakefish')
await page
.getByPlaceholder('Address', { exact: true })
Expand All @@ -167,7 +167,7 @@ test.describe('syncTabs', () => {
await tab2.getByTestId('account-selector').click()
await tab2.getByTestId('toolbar-contacts-tab').click()
await expect(tab2.getByTestId('account-choice')).toHaveCount(1)
await tab2.getByRole('button', { name: 'Add Contact' }).click()
await tab2.getByRole('button', { name: 'Add contact' }).click()
await tab2.getByPlaceholder('Name').fill('Foo')
await tab2
.getByPlaceholder('Address', { exact: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const AddContact = ({ setLayerVisibility }: AddContactProps) => {
return (
<LayerContainer hideLayer={() => setLayerVisibility(false)}>
<Tabs>
<Tab title={t('toolbar.contacts.add', 'Add Contact')} style={{ textTransform: 'capitalize' }}>
<Tab title={t('toolbar.contacts.add', 'Add contact')} style={{ textTransform: 'capitalize' }}>
<Box flex="grow" justify="center">
<ContactAccountForm
onCancel={() => setLayerVisibility(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ exports[`<Contacts /> should match snapshot 1`] = `
class="c13"
type="button"
>
Add Contact
Add contact
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('<Contacts />', () => {
it('should render unavailable state', () => {
renderComponent(configureAppStore({}))
expect(screen.getByText(/To start adding contacts create a profile while/)).toBeInTheDocument()
expect(screen.queryByText('Add Contact')).not.toBeInTheDocument()
expect(screen.queryByText('Add contact')).not.toBeInTheDocument()
expect(screen.getByRole('button', { name: 'opening a wallet' })).toBeInTheDocument()
})

Expand All @@ -68,13 +68,13 @@ describe('<Contacts />', () => {
it('should render empty state', () => {
renderComponent(store)
expect(screen.getByText('You have no contacts yet.')).toBeInTheDocument()
expect(screen.getByText('Add Contact')).toBeInTheDocument()
expect(screen.getByText('Add contact')).toBeInTheDocument()
expect(screen.queryByTestId('account-choice')).not.toBeInTheDocument()
})

it('should show Add Contact form overlay', async () => {
renderComponent(store)
await userEvent.click(screen.getByRole('button', { name: 'Add Contact' }))
await userEvent.click(screen.getByRole('button', { name: 'Add contact' }))
expect(screen.getByPlaceholderText('Name')).toBeInTheDocument()
expect(screen.getByPlaceholderText('Address')).toBeInTheDocument()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function FromBleLedger() {
<li>
{t('ledger.instructionSteps.deviceIsPaired', 'Make sure your Ledger is paired with this device')}
</li>
<li>{t('ledger.instructionSteps.closeLedgerLive', 'Close Ledger Live app on the device')}</li>
<li>{t('ledger.instructionSteps.closeLedgerLive', 'Close the Ledger Live app on your computer')}</li>
<li>{t('ledger.instructionSteps.openOasisApp', 'Open the Oasis app on your Ledger')}</li>
</ol>
<Box direction="row" margin={{ top: 'medium' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function FromPrivateKey(props: Props) {

<Box pad={{ vertical: 'medium' }}>
<Box direction="row" justify="between" margin={{ top: 'medium' }}>
<Button type="submit" label={t('openWallet.mnemonic.import', 'Import my account')} primary />
<Button type="submit" label={t('openWallet.mnemonic.import', 'Import my wallet')} primary />
</Box>
</Box>
</Form>
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/ParaTimesPage/getParaTimeName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { ParaTime } from '../../../config'
export const getParaTimeName = (t: TFunction, paraTime: ParaTime) => {
switch (paraTime) {
case ParaTime.Cipher:
// Discourage mistaken ParaTime deposits into Cipher accounts controlled
// by Binance. That requires contacting support to recover it.
return `${t('paraTimes.common.cipher', 'Cipher')} ${t(
'paraTimes.common.discouragedType',
// Discourage mistaken ParaTime deposits into Cipher accounts controlled
// by Binance. That requires contacting support to recover it.
'(experimental)',
)}`
case ParaTime.Emerald:
Expand Down
18 changes: 9 additions & 9 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
},
"appTitle": "ROSE Wallet",
"backends": {
"nexus": "Nexus API",
"oasismonitor": "Oasis Monitor API",
"oasisscanV2": "Oasis Scan API v2",
"nexus": "Nexus API"
"oasisscanV2": "Oasis Scan API v2"
},
"banner": {
"buildPreview": "Please note this is an experimental build of ROSE Wallet and your secrets are not safe. ONLY USE IT FOR TESTING.",
Expand Down Expand Up @@ -199,9 +199,9 @@
"feedback": "We’d love your feedback at <EmailLink>[email protected]</EmailLink>",
"github": "ROSE Wallet is <GithubLink>open source</GithubLink> and powered by",
"poweredBy": {
"nexus": "Nexus API & Oasis gRPC",
"oasismonitor": "Oasis Monitor API & Oasis gRPC",
"oasisscanV2": "Oasis Scan API v2 & Oasis gRPC",
"nexus": "Nexus API & Oasis gRPC"
"oasisscanV2": "Oasis Scan API v2 & Oasis gRPC"
},
"terms": "<TermsLink>Terms and Conditions</TermsLink>",
"version": "Version: <ReleaseLink/> (commit: <CommitLink/>) built at {{buildTime}}"
Expand Down Expand Up @@ -236,16 +236,16 @@
"closingPopup": "Closing... Please re-open the wallet app",
"connect": "Connect Ledger device",
"failed": "Connection failed",
"grantAccess": "Grant access to your Ledger",
"grantAccess": "Grant access to your USB Ledger",
"succeed": "Device connected"
},
"instructionSteps": {
"closeLedgerLive": "Close Ledger Live app on the computer",
"closeLedgerLive": "Close the Ledger Live app on your computer",
"connectBluetoothLedger": "Connect your Ledger to this device via Bluetooth",
"connectUsbLedger": "Connect your USB Ledger device to the computer",
"connectUsbLedger": "Connect your Ledger to this device via USB",
"deviceIsPaired": "Make sure your Ledger is paired with this device",
"header": "Steps:",
"openOasisApp": "Open the Oasis App on your Ledger device"
"openOasisApp": "Open the Oasis app on your Ledger"
},
"steps": {
"accessingLedger": "Connecting with Ledger device",
Expand Down Expand Up @@ -468,7 +468,7 @@
},
"toolbar": {
"contacts": {
"add": "Add Contact",
"add": "Add contact",
"address": "Address",
"cancel": "Cancel",
"delete": {
Expand Down

0 comments on commit 5530919

Please sign in to comment.