Initial logic for i18n

This commit is contained in:
kngako 2022-10-14 02:35:09 +02:00
parent de797faa79
commit fcfdc60c41
8 changed files with 6673 additions and 0 deletions

14
index.js Normal file
View File

@ -0,0 +1,14 @@
const i18nUtil = require("./lib/i18n-util")
module.exports.getText = i18nUtil.getText
console.log("Basic: ", this.getText(
"en",
"lowBalancePleaseIncrease",
{
balance: 100,
currencyTicker: "ZAR",
requestedAmount: 110
}
))

48
lib/i18n-util/index.js Normal file
View File

@ -0,0 +1,48 @@
const i18n = require('i18n')
const YAML = require('yaml')
const path = require("path")
module.exports.baseLocale = "en"
module.exports.missingKeys = []
i18n.configure({
directory: path.join(__dirname, '../../locales'),
// defaultLocale: baseLocale,
extension: '.yaml',
updateFiles: false,
parser: YAML,
missingKeyFn: function (locale, value) {
module.exports.missingKeys.push(
{
locale: locale,
key: value
}
)
return value
}
})
module.exports.locales = i18n.getLocales()
// TODO: Generate keys from the base language...
const BaseLocaleKeys = Object.keys(i18n.getCatalog(this.baseLocale))
// const translations = i18n.__l(baseLocale)
BaseLocaleKeys.forEach(baseLocaleKey => {
// Check all the base keys so we know if all the locales support this key...
i18n.__h(baseLocaleKey)
})
module.exports.getText = (locale, key, substitution = null) => {
if (BaseLocaleKeys.includes(key)) {
// Check if substitions need to be made...
return i18n.__({
phrase: key,
locale: locale
}, substitution)
} else {
// User requested a phrase we don't know
return `+404-${key}-${locale}`
}
}

169
locales/en.yaml Normal file
View File

@ -0,0 +1,169 @@
welcomeHeading: "Welcome to Machankura"
productAmountPrompt: "How much {{bitrefillProductName]} {{categoryType}} to buy for {{receipent}}"
amountRangeText: "(min:{{minimumAmount}} {{currencyTicker}}, max:{{maximumAmount}} {{currencyTicker}})"
inCurrencyPrompt: "(in {{currencyTicker}})"
inputAmountOutOfRangePrompt: "You can't buy airtime out of the defined range"
pleaseTryAgain: "Please try again."
menu: "Menu"
inputAmountImpossible: "You can't buy {{bitrefillProductName}} with the current input {{amountInput}}"
enterMachankuraPinForAirtime: "Enter your Machankura PIN to buy {{inputAmountValue}} {{productCurrencyTicker}} ({{btcAmount}} {{currencyTicker}}) {{bitrefillProductName}} airtime for {{phoneNumber}}"
failedToConfirmAction: "Failed to confirm action. Please try again later."
inputAmountInvalid: "Amount is invalid. Please try again."
productPurchaseInitiated: "You have initiated {{categoryType}} purchase. Check transaction history for updates."
productPurchaseFailed: "Failed to purchase {{categoryType}}. Please try again later."
yourPhoneNumberNotSupported: "Your phone number {{airtimeReceipent}} currently has no products we can help deliver to it."
pinDontMatch: "Your Machankura PIN doesn't match the PIN we have on the system. Please try again."
balanceTooLow: "Your balance is too low for this transaction. Please try again."
purchaseFailed: "Couldn't complete purchase. Please try again."
phoneNumberNotSupported: "Phone number not supported. Please try again"
pickYourNetwork: "Pick your network"
pickNetworkFailure: "We couldn't process network selection. Please try again."
phoneNumber: "Phone Number"
lightningAddress: "Lightning Address"
lightningAddressPrompt: "(for slow typer just enter the username and on the next screen enter domain)"
machankuraUsername: "Machankura Username"
unsupported: "unsupported"
mostRecent: "Most Recent"
mostFrequent: "Most Frequent"
inputReceipentToBuy: "Please input the {{recipientText}} you want to buy {{bitrefillProductName}} for:"
vendorNotFound: "Couldn't find a vendor for your input. Please try again."
enterPinToSend: "Enter your Machankura PIN to send {{amountText}} to {{receiver}}:"
lowBalancePleaseIncrease: "Your balance ({{balance}} {{currencyTicker}}) is too low. Please increase your balance or send lower amount then {{amountText}}"
cannotSendToYourself: "You cannot send transactions to yourself. Please try again with different receiver."
successfullySent: "You have successfully sent {{amountText}} to {{receiver}}."
failedToSend: "Failed to send {{amountText}} to {{receiver}}. Please try again later."
successfullyGiftedSats: "You have gifted {{amountText}} to {{receiver}}. They have 21 days to claim your gift, please tell them to setup a Machankura account."
failedToGiftSats: "Failed to gift {{amountText}} to {{receiver}}. Please try again with different values."
giftCountryUnsupported: "You cannot yet gift Bitcoins to phone numbers in that country."
failedTransfer: "Failed to transfer {{amountText}} to {{receiver}}. Please try again."
initiatedTransfer: "Your transfer of {{amountText}} to {{receiver}} has been initiated. Check your transactions for status."
failedTransferLightningAddress: "Failed to transfer {{amountText}} to {{receiver}}. Please try again or a different lightning address."
lowBalanceForServiceFeePleaseIncrease: "Your balance ({{satsBalance}} sats) is too low to cover the service fee. Please increase your balance or send lower amount then {{amountText}}"
aztecoVoucherAlreadyRedeemed: "Azteco voucher ({{aztecoVoucherCode}}) has already been redeemed."
redeemAztecoVoucherPrompt: "We are about to redeem an Azteco voucher worth {{satsAmount}} sats to your Machankura account."
redeem: "Redeem"
decline: "Decline"
failedToRedeemAztecoVoucher: "Failed to redeem Azteco voucher ({{aztecoVoucherCode}}) becuase of internal errors. Please try again."
failedToProcessAztecoVoucher: "Failed to process Azteco voucher ({{aztecoVoucherCode}}) becuase of internal errors. Please try again."
failedToAccessAztecoVoucher: "Failed to access Azteco voucher ({{aztecoVoucherCode}}) becuase of internal errors. Please try again."
initiatedAztecoOnchainRedemption: "You have begun the redemption. Azteco onchain voucher is getting redeemed."
errorGeneratingOnchainAddress: "Internal error generating address. Please try again later."
redemptionInProgress: "Redemption in progress. Please wait."
reattemptAztecoRedemptionTitle: "You have re-attempted the redemption"
reattemptAztecoRedemptionBody: "1 For You voucher ({{aztecoVoucherCode}}) is being redeemed for Bitcoin via Azteco. Please wait for updates."
redeem1ForYouTitle: "You have begun the redemption"
redeem1ForYouBody: "1 For You voucher ({{aztecoVoucherCode}}) is being redeemed for Bitcoin via Azteco. Please wait for updates."
successfullyInitiatedRedemption: "Successfully initiated redemption of Azteco voucher (you will receive {{amountInSatoshis}} sats). You will receive updates on the result on the transfer."
failedToFindAztecoVoucher: "Failed to find Azteco voucher {{aztecoVoucherCode}}"
declinedRedemption: "You have declined to redeem the Azteco voucher ({{aztecoVoucherCode}})."
sendBTC: "Send BTC"
receiveBTC: "Receive BTC"
balanceAndHistory: "Balance and history"
spendBTC: "Spend BTC"
settings: "Settings"
exit: "Exit"
username: "Username"
pin: "PIN"
language: "Lanugage"
learnMore: "LearnMore"
enterPinToUpdateUsername: "Enter your Machankura pin to update your lightning address username"
enterPinToSetUsername: "Enter your Machankura pin to set a username for your lightning address"
enterUsername: "Enter the text you want as your new username:"
usernameUpdated: "Your username has been updated from {{oldUsername}} to {{proposedUsernameText}}. Your lightning address is now {{proposedUsernameText}}@{{domain}}."
enterDifferentUsername: "Failed to update username. Please enter a different username ({{proposedUsernameText}} is {{errorStatus}}):"
languageSettingsComingSoon: "Language settings coming soon."
learnMoreSettingsComingSoon: "Learn more settings coming soon."
resetPinCountDown: "You will be able to reset your PIN {{when}} from now. Please come to this screen later."
cancelPinReset: "To cancel the PIN reset enter your current PIN"
cancelledPinReset: "Your PIN reset request has been cancelled. Thank you for using Machankura."
pinUpdated: "Your Machankura PIN has been updated to the one you just entered."
enterNewPin: "Enter your new 5 digit PIN"
expiredPinReset: "Pin reset has expired. Try again."
pinManagement: "Machankura PIN management"
changePin: "Change PIN"
resetPin: "Reset PIN (forgot PIN)"
resetPinPrompt: "To reset your PIN (because you forgot your PIN) you will need to start a 24 hour password reset process (expires in 48 hours)."
startPasswordReset: "Start password reset"
initiatedPinReset: "Pin reset has been initiated. You will be able to set a new password in 24 hours. To cancel the request, you can enter your current PIN."
failedPinResetInitiation: "Failed to initiate PIN reset. Please try again later."
enterCurrentPin: "Enter your current PIN:"
unitOfMeasurePrompt: "Which unit (measure of value) would you like to send Bitcoin in?"
amountToSendPrompt: "Enter how much {{selectedCurrencyTicker}} you want to send:"
mediumToSendPrompt: "Where would you like to send {{shortNumber(amount)}} {{selectedCurrencyTicker}}:"
noPastRecipients: "No recipients on the list. Please input a receipent through phonenumber, lightning address, or username."
selectPastRecipient: "Select a {{quickRecipientMethodText}}:"
recipientNotFound: "Couldn't find recipient"
enterDomainForLightningAddress: "Please enter the domain to complete the lightning address that starts with {{username}} to send {{amountInput}} {{selectedCurrencyTicker}}:"
failedToUnderstandInputs: "Sorry we currently can't make sense of these inputs. Please try again later."
yourLightningAddressIs: "Your lightning address is {{lightningAddress}}"
redeemBTC: "Redeem BTC"
whatIsALightningAddress: "What is a lightning address?"
getQRCode: "Get QR code"
getOnchainAddress: "Get onchain address"
enterAztecoVoucher: "Enter Azteco or 1 For You Bitcoin voucher you want to redeem:"
aLightningAddressIs: "A lightning address is like an email address, but for you to receive Bitcoin."
yourQRCodeIs: "Your QR code webpage is"
bitcoinOnchain: "Bitcoin Onchain (Beta)"
onchainRecommendations: "Onchain recommendations"
shareOnchainOnce: "Please only share and use an onchain address once."
addressesCanBeTracked: "Each person you share it with can track all transactions sent to it forever."
yourBitcoinAddressIs: "Your Bitcoin address is:"
smsOnchainAddress: "SMS onchain address"
getNewOnchainAddress: "Get new onchain address"
newOnchainAddressAsFollows: "Your new Bitcoin onchain address is as follows:"
youWillReceiveSMS: "You will also receive it via SMS"
failedToGenerateOnchainAddress: "Failed to generate a new onchain address. Please try again later"
smsHasBeenSent: "SMS has been sent for the address:"
checkInbox: "Please check your inbox."
generateNewAddress: "Please generate a new address. The previous one has been used."
enterPin4AccountDetails: "Enter your PIN to view your account details:"
machankuraBalance: "Machankura balance is {{balance.toLocaleString}} {{currencyTicker}} (worth around {{fiatAmount}} {{fiatCurrency}})."
transactionHistory: "Transaction history"
purchasedVoucher: "Purchased Voucher"
unknown: "Unknown"
transactionDetail: "You {{sentOrReceived}} {{amountInSatoshis}} {{currencyTicker}} {{fromOrTo}} {{counterPartyText}} (status: {{status}}) on {{dateText}} {{timeText}}\n{{redemptionInfoText}}"
electricity: "Electricity"
electricityTransactionDetail: "You {{sentOrReceived}} {{amountInSatoshis}} {{currencyTicker}} {{fromOrTo}} Lightning Watts (status: {{status}}) on {{dateText}} {{timeText}}\n{{redemptionInfoText}}"
failedToProcess: "Failed to process transaction."
noTransaction: "You have no transaction using Machankura. This will change when you send or receive Bitcoin using Machankura."
select: "Select:"
more: "more"
failedTransactionHistory: "Failed to present transaction history."
buyUsingMachankura: "Buy using Machankura"
integrationComingSoon: "Integration to buy goods/services is coming soon."
buyAirtime: "Buy airtime:"
forYourNumber: "For your number ({{phoneNumber}})"
forAnotherNumber: "For another phone number"
enterPhoneNumberForAirtime: "Enter the phone number you want to buy airtime for:"
pickAProduct: "Pick a product"
yourself: "yourself"
failedAirtimePin: "Failed to process airtime pin product."
enterWattsMeterNumber: "Please enter meter number you want to buy electricity for:"
enterWattsAmount: "Please enter how much electricity do you want to buy (min: 25 ZAR, max: 1 000 ZAR):"
enterPinForWatts: "Please enter your Machankura PIN to buy {{satoshis}} sats ({{zarAmount}} ZAR) for {{meterNumberInput}}:"
failedWattsPurchase: "Failed to get invoice to buy electricity for the meter number {{meterNumberInput}}. Please try again later."
initiatedWattsPurchase: "Initiated purchase of {{amountInSatoshis}} sats ({{amountInZAR}} ZAR) to buy electricity for {{meterNumber}}."
failedWattsPurchaseWithAmount: "Failed to initiate purchase of {{amountInZAR}} ZAR of electricity for {{meterNumberInput}} on Machankura. Please try again."
wattsValidRangePrompt: "Please enter a number between 25 ZAR and 1000 ZAR."
wattsInvalidMeterNumber: "The meter number you entered is invalid. Please try again."
pickElectricityVendor: "Pick electricity vendor"
pickPetrolGarage: "Pick petrol garage"
pickAStore: "Pick a store"
categoryInactive: "Category hasn't been activated yet. Please try again later."
btcExchangeRate: "BTC exchange rate"
bitcoin: "Bitcoin"
thankYouForVisiting: "Thank you for visiting Machankura."
welcomeToMachankura: "Welcome to Machankura (cellular Bitcoin wallet)"
whatYouWantPrompt: "What would you like to do"
registerAccount: "Register account"
changeLanguage: "Change language"
machankuraIsAMobileService: "Machankura is a mobile service that sends and receives Bitcoin on your behalf via your phone number."
learnAboutBitcoin: "Learn about Bitcoin"
bitcoinIsElectronicMoney: "Bitcoin is a decentralized peer to peer electronic money introduced by Satoshi Nakamoto in 2008. It's the native digital currency."
thankYouForVisitingTillNextTime: "Thank you for checking out Machankura. We will be happy to be at your service on the next visit."
registerAccountPrompt: "To create a Machankura account please enter a 5 digit PIN that you will use when using your account:"
youHaveGifts: "You have {{giftCount}} gifts waiting for you ;) (go to Menu and see account details)."
enjoySendingAndReceiving: "Enjoy sending and receiving Bitcoin. ;)"
accountCreated: "We have created your Manchankura account."
failedToCreateUser: "Failed to create user. Please try again."
englishOnly: "English is currently the only language on Machankura. We will be adding more soon."

169
locales/zu.yaml Normal file
View File

@ -0,0 +1,169 @@
welcomeHeading: "Welcome to Machankura"
productAmountPrompt: "How much {{bitrefillProductName]} {{categoryType}} to buy for {{receipent}}"
amountRangeText: "(min:{{minimumAmount}} {{currencyTicker}}, max:{{maximumAmount}} {{currencyTicker}})"
inCurrencyPrompt: "(in {{currencyTicker}})"
inputAmountOutOfRangePrompt: "You can't buy airtime out of the defined range"
pleaseTryAgain: "Please try again."
menu: "Menu"
inputAmountImpossible: "You can't buy {{bitrefillProductName}} with the current input {{amountInput}}"
enterMachankuraPinForAirtime: "Enter your Machankura PIN to buy {{inputAmountValue}} {{productCurrencyTicker}} ({{btcAmount}} {{currencyTicker}}) {{bitrefillProductName}} airtime for {{phoneNumber}}"
failedToConfirmAction: "Failed to confirm action. Please try again later."
inputAmountInvalid: "Amount is invalid. Please try again."
productPurchaseInitiated: "You have initiated {{categoryType}} purchase. Check transaction history for updates."
productPurchaseFailed: "Failed to purchase {{categoryType}}. Please try again later."
yourPhoneNumberNotSupported: "Your phone number {{airtimeReceipent}} currently has no products we can help deliver to it."
pinDontMatch: "Your Machankura PIN doesn't match the PIN we have on the system. Please try again."
balanceTooLow: "Your balance is too low for this transaction. Please try again."
purchaseFailed: "Couldn't complete purchase. Please try again."
phoneNumberNotSupported: "Phone number not supported. Please try again"
pickYourNetwork: "Pick your network"
pickNetworkFailure: "We couldn't process network selection. Please try again."
phoneNumber: "Phone Number"
lightningAddress: "Lightning Address"
lightningAddressPrompt: "(for slow typer just enter the username and on the next screen enter domain)"
machankuraUsername: "Machankura Username"
unsupported: "unsupported"
mostRecent: "Most Recent"
mostFrequent: "Most Frequent"
inputReceipentToBuy: "Please input the {{recipientText}} you want to buy {{bitrefillProductName}} for:"
vendorNotFound: "Couldn't find a vendor for your input. Please try again."
enterPinToSend: "Enter your Machankura PIN to send {{amountText}} to {{receiver}}:"
lowBalancePleaseIncrease: "Your balance ({{balance}} {{currencyTicker}}) is too low. Please increase your balance or send lower amount then {{amountText}}"
cannotSendToYourself: "You cannot send transactions to yourself. Please try again with different receiver."
successfullySent: "You have successfully sent {{amountText}} to {{receiver}}."
failedToSend: "Failed to send {{amountText}} to {{receiver}}. Please try again later."
successfullyGiftedSats: "You have gifted {{amountText}} to {{receiver}}. They have 21 days to claim your gift, please tell them to setup a Machankura account."
failedToGiftSats: "Failed to gift {{amountText}} to {{receiver}}. Please try again with different values."
giftCountryUnsupported: "You cannot yet gift Bitcoins to phone numbers in that country."
failedTransfer: "Failed to transfer {{amountText}} to {{receiver}}. Please try again."
initiatedTransfer: "Your transfer of {{amountText}} to {{receiver}} has been initiated. Check your transactions for status."
failedTransferLightningAddress: "Failed to transfer {{amountText}} to {{receiver}}. Please try again or a different lightning address."
lowBalanceForServiceFeePleaseIncrease: "Your balance ({{satsBalance}} sats) is too low to cover the service fee. Please increase your balance or send lower amount then {{amountText}}"
aztecoVoucherAlreadyRedeemed: "Azteco voucher ({{aztecoVoucherCode}}) has already been redeemed."
redeemAztecoVoucherPrompt: "We are about to redeem an Azteco voucher worth {{satsAmount}} sats to your Machankura account."
redeem: "Redeem"
decline: "Decline"
failedToRedeemAztecoVoucher: "Failed to redeem Azteco voucher ({{aztecoVoucherCode}}) becuase of internal errors. Please try again."
failedToProcessAztecoVoucher: "Failed to process Azteco voucher ({{aztecoVoucherCode}}) becuase of internal errors. Please try again."
failedToAccessAztecoVoucher: "Failed to access Azteco voucher ({{aztecoVoucherCode}}) becuase of internal errors. Please try again."
initiatedAztecoOnchainRedemption: "You have begun the redemption. Azteco onchain voucher is getting redeemed."
errorGeneratingOnchainAddress: "Internal error generating address. Please try again later."
redemptionInProgress: "Redemption in progress. Please wait."
reattemptAztecoRedemptionTitle: "You have re-attempted the redemption"
reattemptAztecoRedemptionBody: "1 For You voucher ({{aztecoVoucherCode}}) is being redeemed for Bitcoin via Azteco. Please wait for updates."
redeem1ForYouTitle: "You have begun the redemption"
redeem1ForYouBody: "1 For You voucher ({{aztecoVoucherCode}}) is being redeemed for Bitcoin via Azteco. Please wait for updates."
successfullyInitiatedRedemption: "Successfully initiated redemption of Azteco voucher (you will receive {{amountInSatoshis}} sats). You will receive updates on the result on the transfer."
failedToFindAztecoVoucher: "Failed to find Azteco voucher {{aztecoVoucherCode}}"
declinedRedemption: "You have declined to redeem the Azteco voucher ({{aztecoVoucherCode}})."
sendBTC: "Send BTC"
receiveBTC: "Receive BTC"
balanceAndHistory: "Balance and history"
spendBTC: "Spend BTC"
settings: "Settings"
exit: "Exit"
username: "Username"
pin: "PIN"
language: "Lanugage"
learnMore: "LearnMore"
enterPinToUpdateUsername: "Enter your Machankura pin to update your lightning address username"
enterPinToSetUsername: "Enter your Machankura pin to set a username for your lightning address"
enterUsername: "Enter the text you want as your new username:"
usernameUpdated: "Your username has been updated from {{oldUsername}} to {{proposedUsernameText}}. Your lightning address is now {{proposedUsernameText}}@{{domain}}."
enterDifferentUsername: "Failed to update username. Please enter a different username ({{proposedUsernameText}} is {{errorStatus}}):"
languageSettingsComingSoon: "Language settings coming soon."
learnMoreSettingsComingSoon: "Learn more settings coming soon."
resetPinCountDown: "You will be able to reset your PIN {{when}} from now. Please come to this screen later."
cancelPinReset: "To cancel the PIN reset enter your current PIN"
cancelledPinReset: "Your PIN reset request has been cancelled. Thank you for using Machankura."
pinUpdated: "Your Machankura PIN has been updated to the one you just entered."
enterNewPin: "Enter your new 5 digit PIN"
expiredPinReset: "Pin reset has expired. Try again."
pinManagement: "Machankura PIN management"
changePin: "Change PIN"
resetPin: "Reset PIN (forgot PIN)"
resetPinPrompt: "To reset your PIN (because you forgot your PIN) you will need to start a 24 hour password reset process (expires in 48 hours)."
startPasswordReset: "Start password reset"
initiatedPinReset: "Pin reset has been initiated. You will be able to set a new password in 24 hours. To cancel the request, you can enter your current PIN."
failedPinResetInitiation: "Failed to initiate PIN reset. Please try again later."
enterCurrentPin: "Enter your current PIN:"
unitOfMeasurePrompt: "Which unit (measure of value) would you like to send Bitcoin in?"
amountToSendPrompt: "Enter how much {{selectedCurrencyTicker}} you want to send:"
mediumToSendPrompt: "Where would you like to send {{shortNumber(amount)}} {{selectedCurrencyTicker}}:"
noPastRecipients: "No recipients on the list. Please input a receipent through phonenumber, lightning address, or username."
selectPastRecipient: "Select a {{quickRecipientMethodText}}:"
recipientNotFound: "Couldn't find recipient"
enterDomainForLightningAddress: "Please enter the domain to complete the lightning address that starts with {{username}} to send {{amountInput}} {{selectedCurrencyTicker}}:"
failedToUnderstandInputs: "Sorry we currently can't make sense of these inputs. Please try again later."
yourLightningAddressIs: "Your lightning address is {{lightningAddress}}"
redeemBTC: "Redeem BTC"
whatIsALightningAddress: "What is a lightning address?"
getQRCode: "Get QR code"
getOnchainAddress: "Get onchain address"
enterAztecoVoucher: "Enter Azteco or 1 For You Bitcoin voucher you want to redeem:"
aLightningAddressIs: "A lightning address is like an email address, but for you to receive Bitcoin."
yourQRCodeIs: "Your QR code webpage is"
bitcoinOnchain: "Bitcoin Onchain (Beta)"
onchainRecommendations: "Onchain recommendations"
shareOnchainOnce: "Please only share and use an onchain address once."
addressesCanBeTracked: "Each person you share it with can track all transactions sent to it forever."
yourBitcoinAddressIs: "Your Bitcoin address is:"
smsOnchainAddress: "SMS onchain address"
getNewOnchainAddress: "Get new onchain address"
newOnchainAddressAsFollows: "Your new Bitcoin onchain address is as follows:"
youWillReceiveSMS: "You will also receive it via SMS"
failedToGenerateOnchainAddress: "Failed to generate a new onchain address. Please try again later"
smsHasBeenSent: "SMS has been sent for the address:"
checkInbox: "Please check your inbox."
generateNewAddress: "Please generate a new address. The previous one has been used."
enterPin4AccountDetails: "Enter your PIN to view your account details:"
machankuraBalance: "Machankura balance is {{balance.toLocaleString}} {{currencyTicker}} (worth around {{fiatAmount}} {{fiatCurrency}})."
transactionHistory: "Transaction history"
purchasedVoucher: "Purchased Voucher"
unknown: "Unknown"
transactionDetail: "You {{sentOrReceived}} {{amountInSatoshis}} {{currencyTicker}} {{fromOrTo}} {{counterPartyText}} (status: {{status}}) on {{dateText}} {{timeText}}\n{{redemptionInfoText}}"
electricity: "Electricity"
electricityTransactionDetail: "You {{sentOrReceived}} {{amountInSatoshis}} {{currencyTicker}} {{fromOrTo}} Lightning Watts (status: {{status}}) on {{dateText}} {{timeText}}\n{{redemptionInfoText}}"
failedToProcess: "Failed to process transaction."
noTransaction: "You have no transaction using Machankura. This will change when you send or receive Bitcoin using Machankura."
select: "Select:"
more: "more"
failedTransactionHistory: "Failed to present transaction history."
buyUsingMachankura: "Buy using Machankura"
integrationComingSoon: "Integration to buy goods/services is coming soon."
buyAirtime: "Buy airtime:"
forYourNumber: "For your number ({{phoneNumber}})"
forAnotherNumber: "For another phone number"
enterPhoneNumberForAirtime: "Enter the phone number you want to buy airtime for:"
pickAProduct: "Pick a product"
yourself: "yourself"
failedAirtimePin: "Failed to process airtime pin product."
enterWattsMeterNumber: "Please enter meter number you want to buy electricity for:"
enterWattsAmount: "Please enter how much electricity do you want to buy (min: 25 ZAR, max: 1 000 ZAR):"
enterPinForWatts: "Please enter your Machankura PIN to buy {{satoshis}} sats ({{zarAmount}} ZAR) for {{meterNumberInput}}:"
failedWattsPurchase: "Failed to get invoice to buy electricity for the meter number {{meterNumberInput}}. Please try again later."
initiatedWattsPurchase: "Initiated purchase of {{amountInSatoshis}} sats ({{amountInZAR}} ZAR) to buy electricity for {{meterNumber}}."
failedWattsPurchaseWithAmount: "Failed to initiate purchase of {{amountInZAR}} ZAR of electricity for {{meterNumberInput}} on Machankura. Please try again."
wattsValidRangePrompt: "Please enter a number between 25 ZAR and 1000 ZAR."
wattsInvalidMeterNumber: "The meter number you entered is invalid. Please try again."
pickElectricityVendor: "Pick electricity vendor"
pickPetrolGarage: "Pick petrol garage"
pickAStore: "Pick a store"
categoryInactive: "Category hasn't been activated yet. Please try again later."
btcExchangeRate: "BTC exchange rate"
bitcoin: "Bitcoin"
thankYouForVisiting: "Thank you for visiting Machankura."
welcomeToMachankura: "Welcome to Machankura (cellular Bitcoin wallet)"
whatYouWantPrompt: "What would you like to do"
registerAccount: "Register account"
changeLanguage: "Change language"
machankuraIsAMobileService: "Machankura is a mobile service that sends and receives Bitcoin on your behalf via your phone number."
learnAboutBitcoin: "Learn about Bitcoin"
bitcoinIsElectronicMoney: "Bitcoin is a decentralized peer to peer electronic money introduced by Satoshi Nakamoto in 2008. It's the native digital currency."
thankYouForVisitingTillNextTime: "Thank you for checking out Machankura. We will be happy to be at your service on the next visit."
registerAccountPrompt: "To create a Machankura account please enter a 5 digit PIN that you will use when using your account:"
youHaveGifts: "You have {{giftCount}} gifts waiting for you ;) (go to Menu and see account details)."
enjoySendingAndReceiving: "Enjoy sending and receiving Bitcoin. ;)"
accountCreated: "We have created your Manchankura account."
failedToCreateUser: "Failed to create user. Please try again."
englishOnly: "English is currently the only language on Machankura. We will be adding more soon."

6212
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

22
package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "machankura.i18n",
"version": "0.0.1",
"description": "Library that provides multi-lingual support for machankura",
"main": "index.js",
"scripts": {
"test": "jest"
},
"repository": {
"type": "git",
"url": "https://code.sigidli.com/machankura/machankura.i18n.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"i18n": "^0.15.1",
"yaml": "^2.1.3"
},
"devDependencies": {
"jest": "^29.1.2"
}
}

View File

@ -0,0 +1,26 @@
const YAML = require("yaml")
const fs = require("fs")
const { expect } = require('@jest/globals');
describe("No Duplicate Keys", () => {
// Read all files in locales...
fs.readdirSync("./locales").forEach(localeFile => {
test(`No duplicate keys for ${localeFile}`, () => {
const file = fs.readFileSync(`./locales/${localeFile}`, 'utf8')
const en = YAML.parse(file)
})
});
});
// test("No Duplicate Keys all files", async () => {
// // Read all files in locales...
// const file = fs.readFileSync('./locales/en.yaml', 'utf8')
// const en = YAML.parse(file)
// expect()
// });

13
test/missing-keys.test.js Normal file
View File

@ -0,0 +1,13 @@
const YAML = require("yaml")
const fs = require("fs")
const { expect } = require('@jest/globals');
const i18nUtil = require("../lib/i18n-util")
test("Missing Keys", () => {
// Read all files in locales...
expect(i18nUtil.missingKeys).not.toBeNull()
expect(i18nUtil.missingKeys).not.toBeUndefined()
expect(i18nUtil.missingKeys).toStrictEqual([])
});