translate.ts
16 lines
| 1 | interface WindowWithHostingerData extends Window { |
| 2 | hostinger_reach_reach_data?: { |
| 3 | translations?: Record<string, string>; |
| 4 | }; |
| 5 | } |
| 6 | |
| 7 | export const translate = (text: string): string => { |
| 8 | const translations = (window as WindowWithHostingerData)?.hostinger_reach_reach_data?.translations || {}; |
| 9 | |
| 10 | if (!text) return ''; |
| 11 | |
| 12 | return translations[text] || text; |
| 13 | }; |
| 14 | |
| 15 | export const t = translate; |
| 16 |