@@ -19,7 +19,7 @@ import {
1919import { Stack } from "@mui/material" ;
2020import IconButton from "@mui/material/IconButton" ;
2121import { useState , useEffect } from "react" ;
22- import { useDataProvider , useLocale , useNotify } from "react-admin" ;
22+ import { useDataProvider , useLocale , useNotify , useTranslate } from "react-admin" ;
2323
2424import { EtkeAttribution } from "./EtkeAttribution" ;
2525import { useAppContext } from "../../Context" ;
@@ -46,6 +46,7 @@ const BillingPage = () => {
4646 const dataProvider = useDataProvider ( ) as SynapseDataProvider ;
4747 const notify = useNotify ( ) ;
4848 const locale = useLocale ( ) ;
49+ const translate = useTranslate ( ) ;
4950 const [ paymentsData , setPaymentsData ] = useState < Payment [ ] > ( [ ] ) ;
5051 const [ loading , setLoading ] = useState ( true ) ;
5152 const [ maintenance , setMaintenance ] = useState ( false ) ;
@@ -78,7 +79,7 @@ const BillingPage = () => {
7879 try {
7980 setDownloadingInvoice ( transactionId ) ;
8081 await dataProvider . getInvoice ( etkeccAdmin , transactionId ) ;
81- notify ( "Invoice download started " , { type : "info" } ) ;
82+ notify ( "etkecc.billing.helper.download_started " , { type : "info" } ) ;
8283 } catch ( error ) {
8384 // Use the specific error message from the dataProvider
8485 const errorMessage = error instanceof Error ? error . message : "Error downloading invoice" ;
@@ -92,20 +93,19 @@ const BillingPage = () => {
9293 const header = (
9394 < Box >
9495 < Typography variant = "h4" >
95- < PaymentIcon sx = { { verticalAlign : "middle" , mr : 1 } } /> Billing
96+ < PaymentIcon sx = { { verticalAlign : "middle" , mr : 1 } } /> { translate ( "etkecc.billing.name" ) }
9697 </ Typography >
97- < Typography variant = "body1" > View payments and generate invoices from here.</ Typography >
9898 < EtkeAttribution >
9999 < Typography variant = "body1" >
100- View payments and generate invoices from here. More details about billing can be found { " " }
101- < Link href = "https://etke.cc/help/extras/scheduler/# payments" target = "_blank" >
102- here
100+ { translate ( "etkecc. billing.description1" ) } { " " }
101+ < Link href = "https://etke.cc/help/payments/ " target = "_blank" >
102+ etke.cc/help/payments
103103 </ Link >
104104 .
105105 < br />
106- If you'd like to change your billing email, or add company details, please { " " }
106+ { translate ( "etkecc. billing.description2" ) } { " " }
107107 < Link href = "https://etke.cc/contacts/" target = "_blank" >
108- contact etke.cc support
108+ etke.cc/contacts
109109 </ Link >
110110 .
111111 </ Typography >
@@ -118,7 +118,7 @@ const BillingPage = () => {
118118 < Stack spacing = { 3 } mt = { 3 } >
119119 { header }
120120 < Box sx = { { mt : 3 } } >
121- < Typography > Loading billing information... </ Typography >
121+ < Typography > { translate ( "etkecc. billing.helper.loading" ) } </ Typography >
122122 </ Box >
123123 </ Stack >
124124 ) ;
@@ -130,18 +130,18 @@ const BillingPage = () => {
130130 { header }
131131 < Box sx = { { mt : 3 } } >
132132 < Typography >
133- There was a problem loading your billing information.
133+ { translate ( "etkecc. billing.helper.loading_failed1" ) }
134134 < br />
135- This might be a temporary issue - please try again in a few minutes.
135+ { translate ( "etkecc.billing.helper.loading_failed2" ) }
136136 < br />
137137 </ Typography >
138138 < EtkeAttribution >
139139 < Typography >
140- If it persists, contact { " " }
140+ { translate ( "etkecc.billing.helper.loading_failed3" ) } { " " }
141141 < Link href = "https://etke.cc/contacts/" target = "_blank" >
142- etke.cc support team
142+ etke.cc/contacts
143143 </ Link > { " " }
144- with the following error message:
144+ { translate ( "etkecc.billing.helper.loading_failed4" ) }
145145 </ Typography >
146146 </ EtkeAttribution >
147147 < Typography variant = "body2" color = "error" sx = { { mt : 1 } } >
@@ -158,11 +158,11 @@ const BillingPage = () => {
158158 { header }
159159 < Box sx = { { mt : 3 } } >
160160 < Alert severity = "info" >
161- The system is currently in maintenance mode.
161+ { translate ( "etkecc. maintenance.title" ) }
162162 < br />
163- Please try again later.
163+ { translate ( "etkecc.maintenance.try_again" ) }
164164 < br />
165- You don't need to contact support about this, we are already working on it!
165+ { translate ( "etkecc.maintenance.note" ) }
166166 </ Alert >
167167 </ Box >
168168 </ Stack >
@@ -174,16 +174,16 @@ const BillingPage = () => {
174174 { header }
175175 < Box sx = { { mt : 2 } } >
176176 < Typography variant = "h5" sx = { { mb : 2 } } >
177- Payment History
177+ { translate ( "etkecc.billing.title" ) }
178178 </ Typography >
179179 { paymentsData . length === 0 ? (
180180 < Typography variant = "body1" >
181- No payments found.
181+ { translate ( "etkecc.billing.no_payments" ) }
182182 < EtkeAttribution >
183183 < Typography >
184- If you believe that's an error, please { " " }
184+ { translate ( "etkecc.billing.no_payments_helper" ) } { " " }
185185 < Link href = "https://etke.cc/contacts/" target = "_blank" >
186- contact etke.cc support
186+ etke.cc/contacts
187187 </ Link >
188188 .
189189 </ Typography >
@@ -194,12 +194,12 @@ const BillingPage = () => {
194194 < Table >
195195 < TableHead >
196196 < TableRow >
197- < TableCell > Transaction ID </ TableCell >
198- < TableCell > Email </ TableCell >
199- < TableCell > Type </ TableCell >
200- < TableCell > Amount </ TableCell >
201- < TableCell > Paid At </ TableCell >
202- < TableCell > Download Invoice </ TableCell >
197+ < TableCell > { translate ( "etkecc.billing.fields.transaction_id" ) } </ TableCell >
198+ < TableCell > { translate ( "etkecc.billing.fields.email" ) } </ TableCell >
199+ < TableCell > { translate ( "etkecc.billing.fields.type" ) } </ TableCell >
200+ < TableCell > { translate ( "etkecc.billing.fields.amount" ) } </ TableCell >
201+ < TableCell > { translate ( "etkecc.billing.fields.paid_at" ) } </ TableCell >
202+ < TableCell > { translate ( "etkecc.billing.helper.download_invoice" ) } </ TableCell >
203203 </ TableRow >
204204 </ TableHead >
205205 < TableBody >
@@ -209,7 +209,9 @@ const BillingPage = () => {
209209 < TruncatedUUID uuid = { payment . transaction_id } />
210210 </ TableCell >
211211 < TableCell > { payment . email } </ TableCell >
212- < TableCell > { payment . is_subscription ? "Subscription" : "One-time" } </ TableCell >
212+ < TableCell >
213+ { translate ( `etkecc.billing.enums.type.${ payment . is_subscription ? "subscription" : "one_time" } ` ) }
214+ </ TableCell >
213215 < TableCell > ${ payment . amount . toFixed ( 2 ) } </ TableCell >
214216 < TableCell > { new Date ( payment . paid_at ) . toLocaleDateString ( locale ) } </ TableCell >
215217 < TableCell >
@@ -220,7 +222,11 @@ const BillingPage = () => {
220222 onClick = { ( ) => handleInvoiceDownload ( payment . transaction_id ) }
221223 disabled = { downloadingInvoice === payment . transaction_id }
222224 >
223- { downloadingInvoice === payment . transaction_id ? "Downloading..." : "Invoice" }
225+ { translate (
226+ downloadingInvoice === payment . transaction_id
227+ ? "etkecc.billing.helper.downloading"
228+ : "etkecc.billing.fields.invoice"
229+ ) }
224230 </ Button >
225231 </ TableCell >
226232 </ TableRow >
0 commit comments