Commit 69cc728d authored by Justin Domingue's avatar Justin Domingue Committed by GitHub

fix(i18n): various fixes and improvements (#1718)

* wrap sock around function component to get re-renders

* removed sourcelocale since we are using custom ids

* load locale data dynamically

* undo dev change

* ran yarn i18n:extract

* make SOCK component lower case

* fixed unmerged conflicts

* regenerated po for wallet.socks

* added loadLocaleData
parent a6bc7775
...@@ -18,5 +18,4 @@ module.exports = { ...@@ -18,5 +18,4 @@ module.exports = {
pseudoLocale: 'pseudo-en', pseudoLocale: 'pseudo-en',
rootDir: '.', rootDir: '.',
runtimeConfigModule: ['@lingui/core', 'i18n'], runtimeConfigModule: ['@lingui/core', 'i18n'],
sourceLocale: 'en',
} }
...@@ -123,11 +123,17 @@ function newTransactionsFirst(a: TransactionDetails, b: TransactionDetails) { ...@@ -123,11 +123,17 @@ function newTransactionsFirst(a: TransactionDetails, b: TransactionDetails) {
return b.addedTime - a.addedTime return b.addedTime - a.addedTime
} }
const SOCK = ( function Sock() {
<span role="img" aria-label="has socks emoji" style={{ marginTop: -4, marginBottom: -4 }}> return (
🧦 <span
</span> role="img"
) aria-label={t({ id: 'wallet.hasSocks', message: 'has socks emoji' })}
style={{ marginTop: -4, marginBottom: -4 }}
>
🧦
</span>
)
}
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
function StatusIcon({ connector }: { connector: AbstractConnector }) { function StatusIcon({ connector }: { connector: AbstractConnector }) {
...@@ -191,7 +197,7 @@ function Web3StatusInner() { ...@@ -191,7 +197,7 @@ function Web3StatusInner() {
</RowBetween> </RowBetween>
) : ( ) : (
<> <>
{hasSocks ? SOCK : null} {hasSocks ? <Sock /> : null}
<Text>{ENSName || shortenAddress(account)}</Text> <Text>{ENSName || shortenAddress(account)}</Text>
</> </>
)} )}
......
...@@ -7,9 +7,6 @@ import { ReactNode, useEffect } from 'react' ...@@ -7,9 +7,6 @@ import { ReactNode, useEffect } from 'react'
export const locales = ['en', 'pseudo-en', 'de', 'es-AR', 'es-US', 'it-IT', 'iw', 'ro', 'ru', 'vi', 'zh-CN', 'zh-TW'] export const locales = ['en', 'pseudo-en', 'de', 'es-AR', 'es-US', 'it-IT', 'iw', 'ro', 'ru', 'vi', 'zh-CN', 'zh-TW']
export const defaultLocale = 'en' export const defaultLocale = 'en'
// load locale data for each supported language
locales.forEach((locale) => i18n.loadLocaleData(locale, { plurals: () => null }))
const getDetectedLocale = () => { const getDetectedLocale = () => {
const detected = const detected =
detect( detect(
...@@ -21,6 +18,7 @@ const getDetectedLocale = () => { ...@@ -21,6 +18,7 @@ const getDetectedLocale = () => {
export async function dynamicActivate(locale: string) { export async function dynamicActivate(locale: string) {
const { messages } = await import(`@lingui/loader!./locales/${locale}.po`) const { messages } = await import(`@lingui/loader!./locales/${locale}.po`)
i18n.loadLocaleData(locale, { plurals: () => null })
i18n.load(locale, messages) i18n.load(locale, messages)
i18n.activate(locale) i18n.activate(locale)
} }
......
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "Connect to a wallet" ...@@ -770,6 +770,10 @@ msgstr "Connect to a wallet"
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "{0} ETH" msgstr "{0} ETH"
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr "has socks emoji"
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "You must connect an account." msgstr "You must connect an account."
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -6,6 +6,12 @@ msgstr "" ...@@ -6,6 +6,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n" "X-Generator: @lingui/cli\n"
"Language: pseudo-en\n" "Language: pseudo-en\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Plural-Forms: \n"
#: src/pages/AddLiquidity/index.tsx #: src/pages/AddLiquidity/index.tsx
msgid "addLiquidity.labels.currentPrice" msgid "addLiquidity.labels.currentPrice"
...@@ -764,6 +770,10 @@ msgstr "" ...@@ -764,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
...@@ -770,6 +770,10 @@ msgstr "" ...@@ -770,6 +770,10 @@ msgstr ""
msgid "wallet.ethBalance" msgid "wallet.ethBalance"
msgstr "" msgstr ""
#: src/components/Web3Status/index.tsx
msgid "wallet.hasSocks"
msgstr ""
#: src/pages/MigrateV2/MigrateV2Pair.tsx #: src/pages/MigrateV2/MigrateV2Pair.tsx
msgid "wallet.mustConnectAccount" msgid "wallet.mustConnectAccount"
msgstr "" msgstr ""
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment