2026-01-10 21:44:57 +01:00
|
|
|
import { createTranslator } from '@symfony/ux-translator';
|
|
|
|
|
import { messages, localeFallbacks } from '../var/translations/index.js';
|
|
|
|
|
|
2023-06-28 16:00:11 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Symfony UX Translator package.
|
|
|
|
|
*
|
|
|
|
|
* If folder "../var/translations" does not exist, or some translations are missing,
|
|
|
|
|
* you must warmup your Symfony cache to refresh JavaScript translations.
|
|
|
|
|
*
|
|
|
|
|
* If you use TypeScript, you can rename this file to "translator.ts" to take advantage of types checking.
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-10 21:44:57 +01:00
|
|
|
const translator = createTranslator({
|
|
|
|
|
messages,
|
|
|
|
|
localeFallbacks,
|
|
|
|
|
});
|
2023-06-28 16:00:11 +02:00
|
|
|
|
2026-01-18 18:50:38 +01:00
|
|
|
// Wrapper function with default domain set to 'frontend'
|
|
|
|
|
export const trans = (id, parameters = {}, domain = 'frontend', locale = null) => {
|
|
|
|
|
return translator.trans(id, parameters, domain, locale);
|
|
|
|
|
};
|