Skip to content

Commit

Permalink
Use spanish translations & fix token scan (#271)
Browse files Browse the repository at this point in the history
* fix cashu token scan

* use spanish translations
  • Loading branch information
KKA11010 authored Nov 22, 2023
1 parent 2fb0cf8 commit 930309a
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 15 deletions.
1 change: 1 addition & 0 deletions assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"disclaimer": "Haftungsausschluss",
"ecashPayment": "Ecash Zahlung",
"english": "Englisch",
"spanish": "Spanisch",
"swahili": "Suaheli",
"enutsRandD": "eNuts Telegram",
"estimatedFees": "Geschätzte Gebühr",
Expand Down
1 change: 1 addition & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"ecashPayment": "Ecash payment",
"english": "English",
"swahili": "Swahili",
"spanish": "Spanish",
"enutsRandD": "eNuts Telegram",
"estimatedFees": "Estimated fees",
"estimateFee": "Estimate fee",
Expand Down
9 changes: 5 additions & 4 deletions assets/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noResults": "Sin resultados"
},
"auth": {
"confirmAction": "Por favor, confirma la acción.",
"confirmAction": "Por favor, confirma esta acción.",
"createPin": "Crear PIN",
"editPin": "Editar PIN",
"pinMismatch": "¡PIN incorrecto!",
Expand Down Expand Up @@ -78,7 +78,8 @@
"disclaimer": "Advertencia",
"ecashPayment": "Pagar Ecash",
"english": "Inglés",
"swahili": "Swahili",
"spanish": "Español",
"swahili": "Suajili",
"enutsRandD": "Telegram eNuts",
"estimatedFees": "Comisión estimada",
"estimateFee": "Estimar comisión",
Expand Down Expand Up @@ -134,9 +135,9 @@
"scan": "Escanear",
"enutsBeta": "eNuts es un programa en fase beta",
"seconds": "segundos",
"selectAmount": "Selecciona cantidad",
"selectAmount": "Seleccionar cantidad",
"selected": "Seleccionado",
"selectMint": "Selecciona una ceca desde la que enviar",
"selectMint": "Seleccionar una ceca desde la que enviar",
"sendEcash": "Enviar Ecash",
"share": "Compartir",
"smthWrong": "Algo falló",
Expand Down
1 change: 1 addition & 0 deletions assets/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"disclaimer": "Clause de non-responsabilité",
"ecashPayment": "Paiement Ecash",
"english": "Anglais",
"spanish": "Espagnol",
"swahili": "Swahili",
"enutsRandD": "eNuts Telegram",
"estimatedFees": "Frais estimés",
Expand Down
1 change: 1 addition & 0 deletions assets/translations/sw.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"disclaimer": "Taarifa ya kutumia",
"ecashPayment": "Malipo ya Ecash",
"english": "Kiingereza",
"spanish": "Kihispania",
"swahili": "Kiswahili",
"enutsRandD": "eNuts Telegram",
"estimatedFees": "Ada zilizokadiriwa",
Expand Down
3 changes: 2 additions & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import de from '@assets/translations/de.json'
import en from '@assets/translations/en.json'
import es from '@assets/translations/es.json'
import fr from '@assets/translations/fr.json'
import sw from '@assets/translations/sw.json'
import { l } from '@log'
Expand All @@ -27,7 +28,7 @@ export enum NS {

export const defaultNS = NS.common
export const resources = {
en, de, fr, sw
en, de, fr, sw, es
} as const

/**
Expand Down
5 changes: 3 additions & 2 deletions src/model/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ const _tlLangNames = [
'english',
'german',
'french',
'swahili'
'swahili',
'spanish',
] as const
export type TTlLangNames = typeof _tlLangNames[number]

const _translationLangCodes = ['de', 'en', 'fr', 'sw'] as const
const _translationLangCodes = ['de', 'en', 'fr', 'sw', 'es'] as const
export type TranslationLangCodes = typeof _translationLangCodes[number]
export const translationLangCodes:Readonly<string[]> = [..._translationLangCodes]

Expand Down
14 changes: 6 additions & 8 deletions src/screens/QRScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ export default function QRScanPage({ navigation, route }: TQRScanPageProps) {
const bcType = isIOS ? 'org.iso.QRCode' : +QRType
// early return if barcode is not a QR
if (type !== bcType) {
openPromptAutoClose({ msg: t('notQrCode') })
return
return openPromptAutoClose({ msg: t('notQrCode') })
}
// handle cashu token claim
if (isCashuToken(data)) {
setToken(data)
void handleCashuToken(data)
return
const cashuToken = isCashuToken(data)
if (cashuToken) {
setToken(cashuToken)
return handleCashuToken(cashuToken)
}
// handle nostr
if (isNProfile(data)) {
Expand All @@ -119,8 +118,7 @@ export default function QRScanPage({ navigation, route }: TQRScanPageProps) {
const invoice = extractStrFromURL(data) || data
const { amount, timeLeft } = decodeLnInvoice(invoice)
if (timeLeft <= 0) {
openPromptAutoClose({ msg: t('invoiceExpired') })
return
return openPromptAutoClose({ msg: t('invoiceExpired') })
}
navigation.navigate('qr processing', { ln: { invoice, mint, balance, amount } })
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/screens/Settings/General/Language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const langs: ILangsOpt[] = [
{ name: 'german', code: 'de' },
{ name: 'french', code: 'fr' },
{ name: 'swahili', code: 'sw' },
{ name: 'spanish', code: 'es' },
]

export default function LanguageSettings({ navigation }: TLanguageSettingsPageProps) {
Expand Down

0 comments on commit 930309a

Please sign in to comment.