2024-12-02 15:04:58 +00:00
|
|
|
import * as interfaces from './interfaces/index.js';
|
2024-11-30 19:54:15 +00:00
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Define English translations without enforcing TTranslationImplementation yet
|
|
|
|
export const EN_translations = {
|
2024-12-02 11:46:28 +00:00
|
|
|
address: 'Address',
|
|
|
|
bankConnection: 'Bank Connection',
|
|
|
|
contactInfo: 'Contact Info',
|
|
|
|
description: 'Description',
|
2024-11-30 19:54:15 +00:00
|
|
|
invoice: 'Invoice',
|
2024-12-02 11:46:28 +00:00
|
|
|
itemPos: 'Item Pos.',
|
2024-11-30 19:54:15 +00:00
|
|
|
quantity: 'Quantity',
|
2024-12-02 11:46:28 +00:00
|
|
|
registrationInfo: 'Registration Info',
|
|
|
|
reverseVatNote: 'VAT arises on a reverse charge basis and is payable by the customer.',
|
|
|
|
totalNetPrice: 'Total Net Price',
|
|
|
|
unitNetPrice: 'Unit Net Price',
|
|
|
|
unitType: 'Unit Type',
|
|
|
|
yourCustomerId: 'Your Customer ID:',
|
|
|
|
yourVatId: 'Your vat id on file:',
|
|
|
|
continuesOnPage: 'Continues on page',
|
|
|
|
finalPageStatement: 'This is the final page of this document.',
|
|
|
|
page: 'Page',
|
2024-12-05 00:42:05 +00:00
|
|
|
vatShort: 'VAT',
|
2024-12-05 00:33:16 +00:00
|
|
|
} as const;
|
|
|
|
|
|
|
|
// Infer keys of EN_translations
|
|
|
|
export type TTranslationKey = keyof typeof EN_translations;
|
|
|
|
|
|
|
|
// Define the type for all translations based on EN_translations keys
|
|
|
|
export type TTranslationImplementation = {
|
|
|
|
[key in TTranslationKey]: string;
|
2024-11-30 19:54:15 +00:00
|
|
|
};
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Define German translations
|
2024-11-30 19:54:15 +00:00
|
|
|
export const DE_translations: TTranslationImplementation = {
|
2024-12-02 11:46:28 +00:00
|
|
|
address: 'Adresse',
|
|
|
|
bankConnection: 'Bankverbindung',
|
|
|
|
contactInfo: 'Kontaktinformationen',
|
|
|
|
description: 'Beschreibung',
|
2024-11-30 19:54:15 +00:00
|
|
|
invoice: 'Rechnung',
|
2024-12-02 11:46:28 +00:00
|
|
|
itemPos: 'Pos.',
|
2024-11-30 19:54:15 +00:00
|
|
|
quantity: 'Anzahl',
|
2024-12-02 11:46:28 +00:00
|
|
|
registrationInfo: 'HRA/HRB Info',
|
2024-12-05 00:33:16 +00:00
|
|
|
reverseVatNote:
|
|
|
|
'Umkehr der Umsatzsteuerpflicht: Der Rechnungsempfänger ist für die korrekte Abrechnung der Umsatzsteuer zuständig.',
|
|
|
|
totalNetPrice: 'Summe netto',
|
|
|
|
unitNetPrice: 'Einheit netto',
|
2024-12-02 11:46:28 +00:00
|
|
|
unitType: 'Einheit',
|
|
|
|
yourCustomerId: 'Ihre Kundennummer:',
|
|
|
|
yourVatId: 'Ihre Umsatzsteuer-ID:',
|
|
|
|
continuesOnPage: 'Fortsetzung auf Seite',
|
2024-12-02 14:20:57 +00:00
|
|
|
finalPageStatement: 'Dies ist die letzte Seite dieses Dokuments.',
|
2024-12-02 11:46:28 +00:00
|
|
|
page: 'Seite',
|
2024-12-05 00:42:05 +00:00
|
|
|
vatShort: 'USt',
|
2024-12-02 11:46:28 +00:00
|
|
|
};
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Define Spanish translations
|
2024-12-02 11:46:28 +00:00
|
|
|
export const ES_translations: TTranslationImplementation = {
|
|
|
|
address: 'Dirección',
|
|
|
|
bankConnection: 'Conexión bancaria',
|
|
|
|
contactInfo: 'Información de contacto',
|
|
|
|
description: 'Descripción',
|
|
|
|
invoice: 'Factura',
|
|
|
|
itemPos: 'Pos.',
|
|
|
|
quantity: 'Cantidad',
|
|
|
|
registrationInfo: 'Información de registro',
|
2024-12-02 14:20:57 +00:00
|
|
|
reverseVatNote: 'El IVA se aplica por inversión del sujeto pasivo y debe ser pagado por el cliente.',
|
2024-12-02 11:46:28 +00:00
|
|
|
totalNetPrice: 'Precio total neto',
|
|
|
|
unitNetPrice: 'Precio unitario neto',
|
|
|
|
unitType: 'Tipo de unidad',
|
|
|
|
yourCustomerId: 'Su número de cliente:',
|
|
|
|
yourVatId: 'Su ID de IVA:',
|
2024-12-02 14:20:57 +00:00
|
|
|
continuesOnPage: 'Continúa en la página',
|
|
|
|
finalPageStatement: 'Esta es la última página de este documento.',
|
|
|
|
page: 'Página',
|
2024-12-05 00:42:05 +00:00
|
|
|
vatShort: 'IVA',
|
2024-12-02 14:20:57 +00:00
|
|
|
};
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Define French translations
|
2024-12-02 14:20:57 +00:00
|
|
|
export const FR_translations: TTranslationImplementation = {
|
|
|
|
address: 'Adresse',
|
|
|
|
bankConnection: 'Coordonnées bancaires',
|
|
|
|
contactInfo: 'Informations de contact',
|
|
|
|
description: 'Description',
|
|
|
|
invoice: 'Facture',
|
|
|
|
itemPos: 'Position',
|
|
|
|
quantity: 'Quantité',
|
2024-12-05 00:33:16 +00:00
|
|
|
registrationInfo: "Informations d'enregistrement",
|
|
|
|
reverseVatNote:
|
|
|
|
"La TVA s'applique selon le mécanisme d'autoliquidation et est à payer par le client.",
|
2024-12-02 14:20:57 +00:00
|
|
|
totalNetPrice: 'Prix net total',
|
|
|
|
unitNetPrice: 'Prix unitaire net',
|
2024-12-05 00:33:16 +00:00
|
|
|
unitType: "Type d'unité",
|
2024-12-02 14:20:57 +00:00
|
|
|
yourCustomerId: 'Votre numéro de client :',
|
|
|
|
yourVatId: 'Votre numéro de TVA :',
|
|
|
|
continuesOnPage: 'Continue sur la page',
|
|
|
|
finalPageStatement: 'Ceci est la dernière page de ce document.',
|
2024-12-02 11:46:28 +00:00
|
|
|
page: 'Page',
|
2024-12-05 00:42:05 +00:00
|
|
|
vatShort: 'TVA',
|
2024-11-30 19:54:15 +00:00
|
|
|
};
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Define Italian translations
|
2024-12-02 14:20:57 +00:00
|
|
|
export const IT_translations: TTranslationImplementation = {
|
|
|
|
address: 'Indirizzo',
|
|
|
|
bankConnection: 'Coordinate bancarie',
|
|
|
|
contactInfo: 'Informazioni di contatto',
|
|
|
|
description: 'Descrizione',
|
|
|
|
invoice: 'Fattura',
|
|
|
|
itemPos: 'Pos.',
|
|
|
|
quantity: 'Quantità',
|
|
|
|
registrationInfo: 'Informazioni di registrazione',
|
2024-12-05 00:33:16 +00:00
|
|
|
reverseVatNote: "L'IVA è applicata con inversione contabile ed è a carico del cliente.",
|
2024-12-02 14:20:57 +00:00
|
|
|
totalNetPrice: 'Prezzo netto totale',
|
|
|
|
unitNetPrice: 'Prezzo netto unitario',
|
|
|
|
unitType: 'Tipo di unità',
|
|
|
|
yourCustomerId: 'Il tuo numero cliente:',
|
|
|
|
yourVatId: 'Il tuo numero di partita IVA:',
|
|
|
|
continuesOnPage: 'Continua alla pagina',
|
|
|
|
finalPageStatement: 'Questa è l\'ultima pagina di questo documento.',
|
|
|
|
page: 'Pagina',
|
2024-12-05 00:42:05 +00:00
|
|
|
vatShort: 'IVA',
|
2024-12-02 14:20:57 +00:00
|
|
|
};
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Language Code Map
|
|
|
|
export const languageCodeMap: Record<string, TTranslationImplementation> = {
|
|
|
|
EN: EN_translations,
|
|
|
|
DE: DE_translations,
|
|
|
|
ES: ES_translations,
|
|
|
|
FR: FR_translations,
|
|
|
|
IT: IT_translations,
|
2024-11-30 19:54:15 +00:00
|
|
|
};
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Language Code Type
|
2024-11-30 19:54:15 +00:00
|
|
|
export type TLanguageCode = keyof typeof languageCodeMap;
|
|
|
|
|
2024-12-05 00:33:16 +00:00
|
|
|
// Translate Function
|
|
|
|
export const translate = (
|
|
|
|
languageCode: TLanguageCode,
|
|
|
|
key: TTranslationKey,
|
|
|
|
defaultValue: string
|
|
|
|
): string => {
|
2024-11-30 19:54:15 +00:00
|
|
|
const translations = languageCodeMap[languageCode] || EN_translations;
|
2024-12-05 00:33:16 +00:00
|
|
|
return translations[key] || defaultValue;
|
2024-11-30 19:54:15 +00:00
|
|
|
};
|