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

Merge lingui translations #293

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ build
!.commitlintrc.cjs
!.lintstagedrc
!knip.config.js
!tsup.config.ts
!tsup.config.ts
!lingui.config.js
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ -t 2 ]; then
exec >/dev/tty 2>&1
fi

pnpm lint-staged -c .lintstagedrc && pnpm files:check
pnpm lingui:extract && git add locales/* && pnpm lint-staged -c .lintstagedrc && pnpm files:check
12 changes: 5 additions & 7 deletions apps/bob-pay/lingui.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { LinguiConfig } from '@lingui/conf';

import linguiConfig from '../../lingui.config';

const config = {
locales: ['en', 'zh'] as const,
sourceLocale: 'en',
fallbackLocales: {
default: 'en'
},
...linguiConfig,
catalogs: [
{
path: 'src/locales/{locale}',
include: ['src/']
path: '../../locales/{locale}',
include: ['src/', '../bob-pay/src/']
}
]
} as const satisfies LinguiConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { usePrices } from '@gobob/hooks';
import { Flex, Span, useCurrencyFormatter, useLocale } from '@gobob/ui';
import { Item } from '@react-stately/collections';
import Big from 'big.js';
import { useEffect, useMemo, useState } from 'react';
import { useMemo, useState } from 'react';

import { ButtonGroup } from '../ButtonGroup';

Expand All @@ -25,12 +25,15 @@ const TokenButtonGroup = ({ isSelected, currency, balance, onSelectionChange }:
const { getPrice, data: pricesData } = usePrices();

const [key, setKey] = useState<string>();
const [prevIsSelected, setPrevIsSelected] = useState<boolean>(isSelected);

if (isSelected !== prevIsSelected) {
setPrevIsSelected(isSelected);

useEffect(() => {
if (!isSelected) {
setKey(undefined);
}
}, [isSelected]);
}

const amounts = useMemo(() => {
if (currency.symbol === 'WBTC') {
Expand Down
2 changes: 1 addition & 1 deletion apps/bob-pay/src/i18n/appRouterI18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type SupportedLocales = string;
async function loadCatalog(locale: SupportedLocales): Promise<{
[k: string]: Messages;
}> {
const { messages } = await import(`../locales/${locale}.po`);
const { messages } = await import(`../../../../locales/${locale}.po`);

return { [locale]: messages };
}
Expand Down
Loading
Loading