diff options
Diffstat (limited to 'packages/demobank-ui/src/i18n')
-rw-r--r-- | packages/demobank-ui/src/i18n/index.tsx | 50 | ||||
-rw-r--r-- | packages/demobank-ui/src/i18n/strings.ts | 647 |
2 files changed, 218 insertions, 479 deletions
diff --git a/packages/demobank-ui/src/i18n/index.tsx b/packages/demobank-ui/src/i18n/index.tsx index 9882525a1..2489184b2 100644 --- a/packages/demobank-ui/src/i18n/index.tsx +++ b/packages/demobank-ui/src/i18n/index.tsx @@ -21,9 +21,9 @@ /** * Imports */ -import { ComponentChild, ComponentChildren, h, Fragment, VNode } from 'preact'; +import { ComponentChild, ComponentChildren, h, Fragment, VNode } from "preact"; -import { useTranslationContext } from '../context/translation'; +import { useTranslationContext } from "../context/translation"; export function useTranslator() { const ctx = useTranslationContext(); @@ -46,12 +46,10 @@ export function useTranslator() { * Convert template strings to a msgid */ function toI18nString(stringSeq: ReadonlyArray<string>): string { - let s = ''; + let s = ""; for (let i = 0; i < stringSeq.length; i++) { s += stringSeq[i]; - if (i < stringSeq.length - 1) - s += `%${i + 1}$s`; - + if (i < stringSeq.length - 1) s += `%${i + 1}$s`; } return s; } @@ -64,12 +62,11 @@ interface TranslateSwitchProps { function stringifyChildren(children: ComponentChildren): string { let n = 1; const ss = (children instanceof Array ? children : [children]).map((c) => { - if (typeof c === 'string') - return c; - + if (typeof c === "string") return c; + return `%${n++}$s`; }); - const s = ss.join('').replace(/ +/g, ' ').trim(); + const s = ss.join("").replace(/ +/g, " ").trim(); return s; } @@ -97,24 +94,20 @@ function getTranslatedChildren( const placeholderChildren = Array<ComponentChild>(); for (let i = 0; i < childArray.length; i++) { const x = childArray[i]; - if (x === undefined) - continue; - else if (typeof x === 'string') - continue; - else - placeholderChildren.push(x); - + if (x === undefined) continue; + else if (typeof x === "string") continue; + else placeholderChildren.push(x); } const result = Array<ComponentChild>(); - for (let i = 0; i < tr.length; i++) - if (i % 2 == 0) + for (let i = 0; i < tr.length; i++) + if (i % 2 == 0) // Text result.push(tr[i]); else { const childIdx = Number.parseInt(tr[i], 10) - 1; result.push(placeholderChildren[childIdx]); } - + return result; } @@ -154,21 +147,18 @@ export function TranslateSwitch({ children, target }: TranslateSwitchProps) { let singular: VNode<TranslationPluralProps> | undefined; let plural: VNode<TranslationPluralProps> | undefined; // const children = this.props.children; - if (children) + if (children) (children instanceof Array ? children : [children]).forEach( (child: any) => { - if (child.type === TranslatePlural) - plural = child; - - if (child.type === TranslateSingular) - singular = child; - + if (child.type === TranslatePlural) plural = child; + + if (child.type === TranslateSingular) singular = child; }, ); - + if (!singular || !plural) { - console.error('translation not found'); - return h('span', {}, ['translation not found']); + console.error("translation not found"); + return h("span", {}, ["translation not found"]); } singular.props.target = target; plural.props.target = target; diff --git a/packages/demobank-ui/src/i18n/strings.ts b/packages/demobank-ui/src/i18n/strings.ts index 1a3c72f85..d9af71657 100644 --- a/packages/demobank-ui/src/i18n/strings.ts +++ b/packages/demobank-ui/src/i18n/strings.ts @@ -15,458 +15,207 @@ */ /*eslint quote-props: ["error", "consistent"]*/ -export const strings: {[s: string]: any} = {}; +export const strings: { [s: string]: any } = {}; -strings['de'] = { - 'domain': 'messages', - 'locale_data': { - 'messages': { - 'days': [ - '' - ], - 'hours': [ - '' - ], - 'minutes': [ - '' - ], - 'seconds': [ - '' - ], - 'Clear': [ - '' - ], - 'Logout': [ - '' - ], - 'Demo Bank': [ - '' - ], - 'Go back': [ - '' - ], - 'Wire transfer': [ - '' - ], - 'Transfer money to another account of this bank:': [ - '' - ], - 'Want to try the raw payto://-format?': [ - '' - ], - 'Transfer money via the Payto system:': [ - '' - ], - 'payto address': [ - '' - ], - 'Confirm': [ - '' - ], - 'Confirm Withdrawal': [ - '' - ], - 'Waiting the bank to create the operaion...': [ - '' - ], - 'This withdrawal was aborted!': [ - '' - ], - 'Withdraw to a Taler Wallet': [ - '' - ], - 'You can use this QR code to withdraw to your mobile wallet:': [ - '' - ], - 'this link': [ - '' - ], - 'Abort': [ - '' - ], - 'Start withdrawal': [ - '' - ], - 'Withdraw Money into a Taler wallet': [ - '' - ], - 'Amount to withdraw': [ - '' - ], - 'Please login!': [ - '' - ], - 'Login': [ - '' - ], - 'Register to the euFin bank!': [ - '' - ], - 'Registration form': [ - '' - ], - 'Register': [ - '' - ], - 'Date': [ - '' - ], - 'Amount': [ - '' - ], - 'Counterpart': [ - '' - ], - 'Subject': [ - '' - ], - 'Username or account label \'%1$s\' not found. Won\'t login.': [ - '' - ], - 'Wrong credentials given.': [ - '' - ], - 'Account information could not be retrieved.': [ - '' - ], - 'Close wire transfer': [ - '' - ], - 'Close Taler withdrawal': [ - '' - ], - 'Bank account balance:': [ - '' - ], - 'Latest transactions:': [ - '' - ], - 'Transfer money manually': [ - '' - ], - 'List of public accounts was not found.': [ - '' - ], - 'List of public accounts could not be retrieved.': [ - '' - ], - 'History of public accounts': [ - '' - ], - 'Page has a problem: logged in but backend state is lost.': [ - '' - ], - 'Welcome to the euFin bank!': [ - '' - ], - '': { - 'domain': 'messages', - 'plural_forms': 'nplurals=2; plural=(n != 1);', - 'lang': 'de' - } - } - } +strings["de"] = { + domain: "messages", + locale_data: { + messages: { + days: [""], + hours: [""], + minutes: [""], + seconds: [""], + Clear: [""], + Logout: [""], + "Demo Bank": [""], + "Go back": [""], + "Wire transfer": [""], + "Transfer money to another account of this bank:": [""], + "Want to try the raw payto://-format?": [""], + "Transfer money via the Payto system:": [""], + "payto address": [""], + Confirm: [""], + "Confirm Withdrawal": [""], + "Waiting the bank to create the operaion...": [""], + "This withdrawal was aborted!": [""], + "Withdraw to a Taler Wallet": [""], + "You can use this QR code to withdraw to your mobile wallet:": [""], + "this link": [""], + Abort: [""], + "Start withdrawal": [""], + "Withdraw Money into a Taler wallet": [""], + "Amount to withdraw": [""], + "Please login!": [""], + Login: [""], + "Register to the euFin bank!": [""], + "Registration form": [""], + Register: [""], + Date: [""], + Amount: [""], + Counterpart: [""], + Subject: [""], + "Username or account label '%1$s' not found. Won't login.": [""], + "Wrong credentials given.": [""], + "Account information could not be retrieved.": [""], + "Close wire transfer": [""], + "Close Taler withdrawal": [""], + "Bank account balance:": [""], + "Latest transactions:": [""], + "Transfer money manually": [""], + "List of public accounts was not found.": [""], + "List of public accounts could not be retrieved.": [""], + "History of public accounts": [""], + "Page has a problem: logged in but backend state is lost.": [""], + "Welcome to the euFin bank!": [""], + "": { + domain: "messages", + plural_forms: "nplurals=2; plural=(n != 1);", + lang: "de", + }, + }, + }, }; -strings['en'] = { - 'domain': 'messages', - 'locale_data': { - 'messages': { - 'days': [ - 'days' - ], - 'hours': [ - 'hours' - ], - 'minutes': [ - 'minutes' - ], - 'seconds': [ - 'seconds' - ], - 'Clear': [ - '' - ], - 'Logout': [ - '' - ], - 'Demo Bank': [ - '' - ], - 'Go back': [ - 'Go back' - ], - 'Wire transfer': [ - '' - ], - 'Transfer money to another account of this bank:': [ - '' - ], - 'Want to try the raw payto://-format?': [ - '' - ], - 'Transfer money via the Payto system:': [ - '' - ], - 'payto address': [ - '' - ], - 'Confirm': [ - '' - ], - 'Confirm Withdrawal': [ - 'Confirm withdrawal' - ], - 'Waiting the bank to create the operaion...': [ - '' - ], - 'This withdrawal was aborted!': [ - '' - ], - 'Withdraw to a Taler Wallet': [ - 'Charge Taler wallet' - ], - 'You can use this QR code to withdraw to your mobile wallet:': [ - '' - ], - 'this link': [ - '' - ], - 'Abort': [ - '' - ], - 'Start withdrawal': [ - 'Start withdrawal' - ], - 'Withdraw Money into a Taler wallet': [ - 'Charge Taler wallet' - ], - 'Amount to withdraw': [ - 'Amount to withdraw' - ], - 'Please login!': [ - '' - ], - 'Login': [ - '' - ], - 'Register to the euFin bank!': [ - '' - ], - 'Registration form': [ - '' - ], - 'Register': [ - '' - ], - 'Date': [ - '' - ], - 'Amount': [ - '' - ], - 'Counterpart': [ - '' - ], - 'Subject': [ - '' - ], - 'Username or account label \'%1$s\' not found. Won\'t login.': [ - '' - ], - 'Wrong credentials given.': [ - '' - ], - 'Account information could not be retrieved.': [ - '' - ], - 'Close wire transfer': [ - '' - ], - 'Close Taler withdrawal': [ - 'Close Taler withdrawal' - ], - 'Bank account balance:': [ - '' - ], - 'Latest transactions:': [ - '' - ], - 'Transfer money manually': [ - '' - ], - 'List of public accounts was not found.': [ - '' - ], - 'List of public accounts could not be retrieved.': [ - '' - ], - 'History of public accounts': [ - '' - ], - 'Page has a problem: logged in but backend state is lost.': [ - 'Page has a problem: logged in but backend state is lost.' - ], - 'Welcome to the euFin bank!': [ - 'Welcome to euFin bank: Taler+IBAN now possible!' - ], - '': { - 'domain': 'messages', - 'plural_forms': 'nplurals=2; plural=(n != 1);', - 'lang': 'en' - } - } - } +strings["en"] = { + domain: "messages", + locale_data: { + messages: { + days: ["days"], + hours: ["hours"], + minutes: ["minutes"], + seconds: ["seconds"], + Clear: [""], + Logout: [""], + "Demo Bank": [""], + "Go back": ["Go back"], + "Wire transfer": [""], + "Transfer money to another account of this bank:": [""], + "Want to try the raw payto://-format?": [""], + "Transfer money via the Payto system:": [""], + "payto address": [""], + Confirm: [""], + "Confirm Withdrawal": ["Confirm withdrawal"], + "Waiting the bank to create the operaion...": [""], + "This withdrawal was aborted!": [""], + "Withdraw to a Taler Wallet": ["Charge Taler wallet"], + "You can use this QR code to withdraw to your mobile wallet:": [""], + "this link": [""], + Abort: [""], + "Start withdrawal": ["Start withdrawal"], + "Withdraw Money into a Taler wallet": ["Charge Taler wallet"], + "Amount to withdraw": ["Amount to withdraw"], + "Please login!": [""], + Login: [""], + "Register to the euFin bank!": [""], + "Registration form": [""], + Register: [""], + Date: [""], + Amount: [""], + Counterpart: [""], + Subject: [""], + "Username or account label '%1$s' not found. Won't login.": [""], + "Wrong credentials given.": [""], + "Account information could not be retrieved.": [""], + "Close wire transfer": [""], + "Close Taler withdrawal": ["Close Taler withdrawal"], + "Bank account balance:": [""], + "Latest transactions:": [""], + "Transfer money manually": [""], + "List of public accounts was not found.": [""], + "List of public accounts could not be retrieved.": [""], + "History of public accounts": [""], + "Page has a problem: logged in but backend state is lost.": [ + "Page has a problem: logged in but backend state is lost.", + ], + "Welcome to the euFin bank!": [ + "Welcome to euFin bank: Taler+IBAN now possible!", + ], + "": { + domain: "messages", + plural_forms: "nplurals=2; plural=(n != 1);", + lang: "en", + }, + }, + }, }; -strings['it'] = { - 'domain': 'messages', - 'locale_data': { - 'messages': { - 'days': [ - '' - ], - 'hours': [ - '' - ], - 'minutes': [ - '' - ], - 'seconds': [ - '' - ], - 'Clear': [ - 'Cancella' - ], - 'Logout': [ - '' - ], - 'Demo Bank': [ - 'Banca \'demo\'' - ], - 'Go back': [ - 'Indietro' - ], - 'Wire transfer': [ - 'Bonifico' - ], - 'Transfer money to another account of this bank:': [ - 'Trasferisci fondi a un altro conto di questa banca:' - ], - 'Want to try the raw payto://-format?': [ - 'Prova il trasferimento tramite il formato Payto!' - ], - 'Transfer money via the Payto system:': [ - 'Effettua un bonifico tramite il sistema Payto:' - ], - 'payto address': [ - 'indirizzo Payto' - ], - 'Confirm': [ - 'Conferma' - ], - 'Confirm Withdrawal': [ - 'Conferma il ritiro' - ], - 'Waiting the bank to create the operaion...': [ - 'La banca sta creando l\'operazione...' - ], - 'This withdrawal was aborted!': [ - 'Questo ritiro è stato annullato!' - ], - 'Withdraw to a Taler Wallet': [ - 'Ritira contante nel portafoglio Taler' - ], - 'You can use this QR code to withdraw to your mobile wallet:': [ - 'Usa questo codice QR per ritirare contante nel tuo wallet:' - ], - 'this link': [ - 'questo link' - ], - 'Abort': [ - 'Annulla' - ], - 'Start withdrawal': [ - 'Ritira contante' - ], - 'Withdraw Money into a Taler wallet': [ - 'Ritira contante nel portafoglio Taler' - ], - 'Amount to withdraw': [ - 'Somma da ritirare' - ], - 'Please login!': [ - 'Accedi!' - ], - 'Login': [ - 'Accedi' - ], - 'Register to the euFin bank!': [ - 'Apri un conto in banca euFin!' - ], - 'Registration form': [ - 'Registrazione' - ], - 'Register': [ - 'Registrati' - ], - 'Date': [ - '' - ], - 'Amount': [ - 'Somma' - ], - 'Counterpart': [ - 'Controparte' - ], - 'Subject': [ - 'Causale' - ], - 'Username or account label \'%1$s\' not found. Won\'t login.': [ - 'L\'utente \'%1$s\' non esiste. Login impossibile' - ], - 'Wrong credentials given.': [ - 'Credenziali invalide.' - ], - 'Account information could not be retrieved.': [ - 'Impossibile ricevere le informazioni relative al conto.' - ], - 'Close wire transfer': [ - 'Chiudi il bonifico' - ], - 'Close Taler withdrawal': [ - 'Chiudi il ritiro Taler' - ], - 'Bank account balance:': [ - 'Bilancio:' - ], - 'Latest transactions:': [ - 'Ultime transazioni:' - ], - 'Transfer money manually': [ - 'Effettua un bonifico' - ], - 'List of public accounts was not found.': [ - 'Lista conti pubblici non trovata.' - ], - 'List of public accounts could not be retrieved.': [ - 'Lista conti pubblici non pervenuta.' - ], - 'History of public accounts': [ - 'Storico dei conti pubblici' - ], - 'Page has a problem: logged in but backend state is lost.': [ - 'Stato inconsistente: accesso utente effettuato ma stato con server perso.' - ], - 'Welcome to the euFin bank!': [ - 'Benvenuti in banca euFin!' - ], - '': { - 'domain': 'messages', - 'plural_forms': 'nplurals=2; plural=(n != 1);', - 'lang': 'it' - } - } - } +strings["it"] = { + domain: "messages", + locale_data: { + messages: { + days: [""], + hours: [""], + minutes: [""], + seconds: [""], + Clear: ["Cancella"], + Logout: [""], + "Demo Bank": ["Banca 'demo'"], + "Go back": ["Indietro"], + "Wire transfer": ["Bonifico"], + "Transfer money to another account of this bank:": [ + "Trasferisci fondi a un altro conto di questa banca:", + ], + "Want to try the raw payto://-format?": [ + "Prova il trasferimento tramite il formato Payto!", + ], + "Transfer money via the Payto system:": [ + "Effettua un bonifico tramite il sistema Payto:", + ], + "payto address": ["indirizzo Payto"], + Confirm: ["Conferma"], + "Confirm Withdrawal": ["Conferma il ritiro"], + "Waiting the bank to create the operaion...": [ + "La banca sta creando l'operazione...", + ], + "This withdrawal was aborted!": ["Questo ritiro è stato annullato!"], + "Withdraw to a Taler Wallet": ["Ritira contante nel portafoglio Taler"], + "You can use this QR code to withdraw to your mobile wallet:": [ + "Usa questo codice QR per ritirare contante nel tuo wallet:", + ], + "this link": ["questo link"], + Abort: ["Annulla"], + "Start withdrawal": ["Ritira contante"], + "Withdraw Money into a Taler wallet": [ + "Ritira contante nel portafoglio Taler", + ], + "Amount to withdraw": ["Somma da ritirare"], + "Please login!": ["Accedi!"], + Login: ["Accedi"], + "Register to the euFin bank!": ["Apri un conto in banca euFin!"], + "Registration form": ["Registrazione"], + Register: ["Registrati"], + Date: [""], + Amount: ["Somma"], + Counterpart: ["Controparte"], + Subject: ["Causale"], + "Username or account label '%1$s' not found. Won't login.": [ + "L'utente '%1$s' non esiste. Login impossibile", + ], + "Wrong credentials given.": ["Credenziali invalide."], + "Account information could not be retrieved.": [ + "Impossibile ricevere le informazioni relative al conto.", + ], + "Close wire transfer": ["Chiudi il bonifico"], + "Close Taler withdrawal": ["Chiudi il ritiro Taler"], + "Bank account balance:": ["Bilancio:"], + "Latest transactions:": ["Ultime transazioni:"], + "Transfer money manually": ["Effettua un bonifico"], + "List of public accounts was not found.": [ + "Lista conti pubblici non trovata.", + ], + "List of public accounts could not be retrieved.": [ + "Lista conti pubblici non pervenuta.", + ], + "History of public accounts": ["Storico dei conti pubblici"], + "Page has a problem: logged in but backend state is lost.": [ + "Stato inconsistente: accesso utente effettuato ma stato con server perso.", + ], + "Welcome to the euFin bank!": ["Benvenuti in banca euFin!"], + "": { + domain: "messages", + plural_forms: "nplurals=2; plural=(n != 1);", + lang: "it", + }, + }, + }, }; - |