Skip to content

Commit

Permalink
LSPS1: Localize strings
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed May 2, 2024
1 parent f4a6832 commit 58d813a
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 117 deletions.
28 changes: 28 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"general.valid": "Valid",
"general.invalid": "Invalid",
"general.createdAt": "Created at",
"general.expiresAt": "Expires at",
"general.id": "ID",
"general.hash": "Hash",
"general.kind": "Kind",
Expand All @@ -102,6 +103,7 @@
"general.advanced": "Advanced",
"general.clearChanges": "Clear changes",
"general.destination": "Destination",
"general.state": "State",
"restart.title": "Restart required",
"restart.msg": "ZEUS has to be restarted before the new configuration is applied.",
"restart.msg1": "Would you like to restart now?",
Expand Down Expand Up @@ -910,6 +912,32 @@
"views.Sync.currentBlockHeight": "Current block height",
"views.Sync.tip": "Tip",
"views.Sync.numBlocksUntilSynced": "Number of blocks until synced",
"views.LSPS1.pubkeyAndHostNotFound": "Node pubkey and host are not set",
"views.LSPS1.timeoutError": "Did not receive response from server",
"views.LSPS1.channelExpiryBlocks": "Channel Expiry Blocks",
"views.LSPS1.maxChannelExpiryBlocks": "Max channel Expiry Blocks",
"views.LSPS1.clientBalance": "Client balance",
"views.LSPS1.confirmWithinBlocks": "Confirm within blocks",
"views.LSPS1.lspBalance": "LSP Balance",
"views.LSPS1.orderId": "Order ID",
"views.LSPS1.orderState": "Order state",
"views.LSPS1.miniFeeFor0Conf": "Min fee for 0 conf",
"views.LSPS1.minOnchainPaymentConfirmations": "Min Onchain Payment Confirmations",
"views.LSPS1.onchainPayment": "Onchain payment",
"views.LSPS1.totalOrderValue": "Total order value",
"views.LSPS1.initialLSPBalance": "Initial LSP Balance",
"views.LSPS1.initialClientBalance": "Initial Client Balance",
"views.LSPS1.minChannelConfirmations": "Min channel confirmations",
"views.LSPS1.minOnchainPaymentSize": "Min onchain payment size",
"views.LSPS1.supportZeroChannelReserve": "Support zero channel reserve",
"views.LSPS1.requiredChannelConfirmations": "Required channel confirmations",
"views.LSPS1.token": "Token",
"views.LSPS1.refundOnchainAddress": "Refund onchain address",
"views.LSPS1.getQuote": "Get quote",
"views.LSPS1.makePayment": "Make payment",
"views.LSPS1.goToSettings": "Go to settings",
"views.LSPS1.fundedAt": "Funded At",
"views.LSPS1.fundingOutpoint": "Funding outpoint",
"components.UTXOPicker.modal.title": "Select UTXOs to use",
"components.UTXOPicker.modal.description": "Select the UTXOs to be used in this operation. You may want to only use specific UTXOs to preserve your privacy.",
"components.UTXOPicker.modal.set": "Set UTXOs",
Expand Down
98 changes: 74 additions & 24 deletions views/Settings/LSPS1/Order.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import LoadingIndicator from '../../../components/LoadingIndicator';
import { themeColor } from '../../../utils/ThemeUtils';
import BackendUtils from '../../../utils/BackendUtils';
import UrlUtils from '../../../utils/UrlUtils';
import { localeString } from '../../../utils/LocaleUtils';

import LSPStore from '../../../stores/LSPStore';
import SettingsStore from '../../../stores/SettingsStore';
Expand Down Expand Up @@ -51,7 +52,6 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
async componentDidMount() {
const { LSPStore } = this.props;
const orderId = this.props.navigation.getParam('orderId', null);
console.log('Order ID:', orderId);

BackendUtils.supportsLSPS1rest()
? LSPStore.getOrderREST(orderId)
Expand Down Expand Up @@ -231,7 +231,9 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
<View style={{ paddingHorizontal: 20 }}>
{result.announce_channel && (
<KeyValue
keyValue="Announce Channel"
keyValue={localeString(
'views.OpenChannel.announceChannel'
)}
value={
result.announce_channel
? 'True'
Expand All @@ -246,13 +248,17 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
)}
{result.channel_expiry_blocks && (
<KeyValue
keyValue="Channel Expiry Blocks"
keyValue={localeString(
'views.LSPS1.channelExpiryBlocks'
)}
value={result.channel_expiry_blocks}
/>
)}
{result.client_balance_sat && (
<KeyValue
keyValue="Client Balance (SAT)"
keyValue={localeString(
'views.LSPS1.clientBalance'
)}
value={
<Amount
sats={
Expand All @@ -266,31 +272,39 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
)}
{result.funding_confirms_within_blocks && (
<KeyValue
keyValue="Confirms Within Blocks"
keyValue={localeString(
'views.LSPS1.confirmWithinBlocks'
)}
value={
result.funding_confirms_within_blocks
}
/>
)}
{result.created_at && (
<KeyValue
keyValue="Created At"
keyValue={localeString(
'general.createdAt'
)}
value={moment(
result.createdAt
).format('MMM Do YYYY, h:mm:ss a')}
/>
)}
{result.expires_at && (
<KeyValue
keyValue="Expires At"
keyValue={localeString(
'general.expiresAt'
)}
value={moment(
result.expires_at
).format('MMM Do YYYY, h:mm:ss a')}
/>
)}
{result.lsp_balance_sat && (
<KeyValue
keyValue="LSP Balance"
keyValue={localeString(
'views.LSPS1.lspBalance'
)}
value={
<Amount
sats={
Expand All @@ -304,13 +318,17 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
)}
{result.order_id && (
<KeyValue
keyValue="Order ID"
keyValue={localeString(
'views.LSPS1.orderId'
)}
value={result.order_id}
/>
)}
{result.order_state && (
<KeyValue
keyValue="Order State"
keyValue={localeString(
'views.LSPS1.orderState'
)}
value={result.order_state}
color={
result.order_state === 'CREATED'
Expand All @@ -325,10 +343,16 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
}
/>
)}
<KeyValue keyValue="PAYMENT:" />
<KeyValue
keyValue={localeString(
'views.Payment.title'
)}
/>
{payment.fee_total_sat && (
<KeyValue
keyValue="Fee Total"
keyValue={localeString(
'views.Transaction.totalFees'
)}
value={
<Amount
sats={payment.fee_total_sat}
Expand All @@ -341,7 +365,9 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
{(payment.lightning_invoice ||
payment.bolt11_invoice) && (
<KeyValue
keyValue="Lightning Invoice"
keyValue={localeString(
'general.lightningInvoice'
)}
value={
payment.lightning_invoice ||
payment.bolt11_invoice
Expand All @@ -350,39 +376,51 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
)}
{payment.state && (
<KeyValue
keyValue="State"
keyValue={localeString(
'general.state'
)}
value={payment.state}
/>
)}
{payment.min_fee_for_0conf && (
<KeyValue
keyValue="Min Fee for 0 Conf"
keyValue={localeString(
'views.LSPS1.miniFeeFor0Conf'
)}
value={payment.min_fee_for_0conf}
/>
)}
{payment.min_onchain_payment_confirmations && (
<KeyValue
keyValue="Min Onchain Payment Confirmations"
keyValue={localeString(
'views.LSPS1.minOnchainPaymentConfirmations'
)}
value={
payment.min_onchain_payment_confirmations
}
/>
)}
{payment.onchain_address && (
<KeyValue
keyValue="Onchain Address"
keyValue={localeString(
'views.Settings.AddContact.onchainAddress'
)}
value={payment.onchain_address}
/>
)}
{payment.onchain_payment && (
<KeyValue
keyValue="Onchain Payment"
keyValue={localeString(
'views.LSPS1.onchainPayment'
)}
value={payment.onchain_payment}
/>
)}
{payment.order_total_sat && (
<KeyValue
keyValue="Order Total"
keyValue={localeString(
'views.LSPS1.totalOrderValue'
)}
value={
<Amount
sats={
Expand All @@ -396,25 +434,35 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
)}
{channel && (
<>
<KeyValue keyValue="CHANNEL:" />
<KeyValue
keyValue="Expires at"
keyValue={localeString(
'views.Channel.title'
)}
/>
<KeyValue
keyValue={localeString(
'general.expiresAt'
)}
value={moment(
channel?.expires_at
).format(
'MMM Do YYYY, h:mm:ss a'
)}
/>
<KeyValue
keyValue="Funded at"
keyValue={localeString(
'views.LSPS1.fundedAt'
)}
value={moment(
channel?.funded_at
).format(
'MMM Do YYYY, h:mm:ss a'
)}
/>
<KeyValue
keyValue="Funding outpoint"
keyValue={localeString(
'views.LSPS1.fundingOutpoint'
)}
value={
channel?.funding_outpoint
}
Expand All @@ -431,7 +479,9 @@ export default class Orders extends React.Component<OrderProps, OrdersState> {
)}
{result?.order_state !== 'COMPLETED' && (
<Button
title="MAKE PAYMENT"
title={localeString(
'views.LSPS1.makePayment'
)}
containerStyle={{
paddingVertical: 20
}}
Expand Down
Loading

0 comments on commit 58d813a

Please sign in to comment.