use ts files for translations

This commit is contained in:
Paul Miller
2023-07-08 15:00:12 -05:00
parent a5bbbf0c46
commit 1f31ca4c3a
8 changed files with 798 additions and 608 deletions

View File

@@ -24,12 +24,12 @@
"eslint-plugin-import": "2.27.5",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-solid": "0.11.0",
"postcss": "^8.4.24",
"postcss": "^8.4.25",
"prettier": "^2.8.8",
"solid-start-node": "^0.2.26",
"tailwindcss": "^3.3.2",
"typescript": "^4.9.5",
"vite": "^4.3.9",
"vite": "^4.4.2",
"vite-plugin-pwa": "^0.14.7",
"vite-plugin-wasm": "^3.2.2",
"workbox-window": "^6.6.0"
@@ -46,8 +46,7 @@
"@thisbeyond/solid-select": "^0.14.0",
"class-variance-authority": "^0.4.0",
"i18next": "^22.5.1",
"i18next-browser-languagedetector": "^7.0.2",
"i18next-http-backend": "^2.2.1",
"i18next-browser-languagedetector": "^7.1.0",
"nostr-tools": "^1.11.1",
"qr-scanner": "^1.4.2",
"solid-js": "^1.7.7",

1222
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +1,39 @@
import i18next from 'i18next';
import HttpApi from 'i18next-http-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
const i18n = i18next
.use(HttpApi)
.use(LanguageDetector)
.init({
fallbackLng: 'en',
preload: ['en'],
load: 'languageOnly',
ns: ['translations'],
defaultNS: 'translations',
fallbackNS: false,
debug: true,
detection: {
order: ['querystring', 'navigator', 'htmlTag'],
lookupQuerystring: 'lang',
import { use } from "i18next";
// FIXME: this doesn't work when deployed
// import HttpApi from 'i18next-http-backend';
import LanguageDetector from "i18next-browser-languagedetector";
import en from "~/i18n/en/translations";
import pt from "~/i18n/pt/translations";
const i18n = use(LanguageDetector).init(
{
fallbackLng: "en",
preload: ["en"],
load: "languageOnly",
ns: ["translations"],
defaultNS: "translations",
fallbackNS: false,
debug: true,
detection: {
order: ["querystring", "navigator", "htmlTag"],
lookupQuerystring: "lang"
},
resources: {
en: {
translations: en
},
pt: {
translations: pt
}
}
// FIXME: this doesn't work when deployed
// backend: {
// loadPath: 'src/i18n/{{lng}}/{{ns}}.json',
// }
},
backend: {
loadPath: 'src/i18n/{{lng}}/{{ns}}.json',
(err, _t) => {
// Do we actually wanna log something in case of an unsupported language?
if (err) return console.error(err);
}
}, (err, t) => {
// Do we actually wanna log something in case of an unsupported language?
if (err) return console.error(err)
});
);
export default i18n;

View File

@@ -1,19 +0,0 @@
{
"create_an_issue": "Create an issue",
"view_all": "View all",
"receive_some_sats_to_get_started": "Receive some sats to get started",
"send_bitcoin": "Send Bitcoin",
"view_transaction": "View Transaction",
"amount_editable_first_payment_10k_or_greater": "Your first lightning receive needs to be 10,000 sats or greater. A setup fee will be deducted from the requested amount.",
"why?": "Why?",
"more_info_modal_p1": "Mutiny is a self-custodial wallet. To initiate a lightning payment we must open a lightning channel, which requires a minimum amount and a setup fee.",
"more_info_modal_p2": "Future payments, both send and recieve, will only incur normal network fees and a nominal service fee unless your channel runs out of inbound capacity.",
"learn_more_about_liquidity": "Learn more about liquidity",
"set_amount": "Set amount",
"whats_with_the_fees": "What's with the fees?",
"private_tags": "Private tags",
"receive_add_the_sender": "Add the sender for your records",
"continue": "Continue",
"receive_bitcoin": "Receive Bitcoin",
"keep_mutiny_open": "Keep Mutiny open to complete the payment."
}

View File

@@ -0,0 +1,22 @@
export default {
create_an_issue: "Create an issue",
view_all: "View all",
receive_some_sats_to_get_started: "Receive some sats to get started",
send_bitcoin: "Send Bitcoin",
view_transaction: "View Transaction",
amount_editable_first_payment_10k_or_greater:
"Your first lightning receive needs to be 10,000 sats or greater. A setup fee will be deducted from the requested amount.",
"why?": "Why?",
more_info_modal_p1:
"Mutiny is a self-custodial wallet. To initiate a lightning payment we must open a lightning channel, which requires a minimum amount and a setup fee.",
more_info_modal_p2:
"Future payments, both send and recieve, will only incur normal network fees and a nominal service fee unless your channel runs out of inbound capacity.",
learn_more_about_liquidity: "Learn more about liquidity",
set_amount: "Set amount",
whats_with_the_fees: "What's with the fees?",
private_tags: "Private tags",
receive_add_the_sender: "Add the sender for your records",
continue: "Continue",
receive_bitcoin: "Receive Bitcoin",
keep_mutiny_open: "Keep Mutiny open to complete the payment."
};

View File

@@ -1,18 +0,0 @@
{
"create_an_issue": "Crie uma issue",
"view_all": "Ver todas",
"receive_some_sats_to_get_started": "Receba alguns satoshis para começar",
"send_bitcoin": "Enviar Bitcoin",
"view_transaction": "Ver transação",
"amount_editable_first_payment_10k_or_greater": "Seu primeiro recebimento na lightning precisa ser de pelo menos 10.000 sats. Uma taxa de configuração será deduzida da quantidade requisitada.",
"why?": "Por que?",
"more_info_modal_p1": "Mutiny é uma carteira de auto custódia. Para iniciar um pagamento na lightning, nós precisamos abrir um canal que requer uma quantidade mínima e uma taxa de configuração.",
"more_info_modal_p2": "Transaçoēs futuras, como envios e recebimentos, terão somente taxas normais da rede e uma taxa de serviço nominal a não ser que seu canal fique sem capacidade de entrada.",
"learn_more_about_liquidity": "Aprenda mais sobre liquidez",
"set_amount": "Definir quantidade",
"whats_with_the_fees": "O que há com as taxas?",
"private_tags": "Tags privadas",
"receive_add_the_sender": "Marque quem o enviou para registro próprio",
"continue": "Continuar",
"receive_bitcoin": "Receber Bitcoin"
}

View File

@@ -0,0 +1,21 @@
export default {
create_an_issue: "Crie uma issue",
view_all: "Ver todas",
receive_some_sats_to_get_started: "Receba alguns satoshis para começar",
send_bitcoin: "Enviar Bitcoin",
view_transaction: "Ver transação",
amount_editable_first_payment_10k_or_greater:
"Seu primeiro recebimento na lightning precisa ser de pelo menos 10.000 sats. Uma taxa de configuração será deduzida da quantidade requisitada.",
"why?": "Por que?",
more_info_modal_p1:
"Mutiny é uma carteira de auto custódia. Para iniciar um pagamento na lightning, nós precisamos abrir um canal que requer uma quantidade mínima e uma taxa de configuração.",
more_info_modal_p2:
"Transaçoēs futuras, como envios e recebimentos, terão somente taxas normais da rede e uma taxa de serviço nominal a não ser que seu canal fique sem capacidade de entrada.",
learn_more_about_liquidity: "Aprenda mais sobre liquidez",
set_amount: "Definir quantidade",
whats_with_the_fees: "O que há com as taxas?",
private_tags: "Tags privadas",
receive_add_the_sender: "Marque quem o enviou para registro próprio",
continue: "Continuar",
receive_bitcoin: "Receber Bitcoin"
};

View File

@@ -39,21 +39,27 @@ const pwaOptions: Partial<VitePWAOptions> = {
};
export default defineConfig({
server: {
port: 3420,
fs: {
// Allow serving files from one level up (so that if mutiny-node is a sibling folder we can use it locally)
allow: [".."]
server: {
port: 3420,
fs: {
// Allow serving files from one level up (so that if mutiny-node is a sibling folder we can use it locally)
allow: [".."]
}
},
plugins: [wasm(), solid({ ssr: false }), VitePWA(pwaOptions)],
resolve: {
alias: [{ find: "~", replacement: path.resolve(__dirname, "./src") }]
},
optimizeDeps: {
// Don't want vite to bundle these late during dev causing reload
include: [
"qr-scanner",
"nostr-tools",
"class-variance-authority",
"@kobalte/core",
"@solid-primitives/upload"
],
// This is necessary because otherwise `vite dev` can't find the wasm
exclude: ["@mutinywallet/mutiny-wasm", "@mutinywallet/waila-wasm"]
}
},
plugins: [wasm(), solid({ ssr: false }), VitePWA(pwaOptions)],
resolve: {
alias: [{ find: '~', replacement: path.resolve(__dirname, './src') }]
},
optimizeDeps: {
// Don't want vite to bundle these late during dev causing reload
include: ["qr-scanner", "nostr-tools", "class-variance-authority", "@kobalte/core", "@solid-primitives/upload"],
// This is necessary because otherwise `vite dev` can't find the wasm
exclude: ["@mutinywallet/mutiny-wasm", "@mutinywallet/waila-wasm"],
},
});