Fixed JS translation fox new UX/translator version
Some checks are pending
Build assets artifact / Build assets artifact (push) Waiting to run
Docker Image Build / docker (push) Waiting to run
Docker Image Build (FrankenPHP) / docker (push) Waiting to run
Static analysis / Static analysis (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, mysql) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, postgres) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Waiting to run
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.5, sqlite) (push) Waiting to run

This commit is contained in:
Jan Böhmer 2026-01-10 21:44:57 +01:00
parent 6828ce5803
commit 1cd0b459be
6 changed files with 33 additions and 30 deletions

View file

@ -26,9 +26,6 @@ import {marked} from "marked";
import { import {
trans, trans,
SEARCH_PLACEHOLDER,
SEARCH_SUBMIT,
STATISTICS_PARTS
} from '../../translator'; } from '../../translator';
@ -82,9 +79,9 @@ export default class extends Controller {
panelPlacement: this.element.dataset.panelPlacement, panelPlacement: this.element.dataset.panelPlacement,
plugins: [recentSearchesPlugin], plugins: [recentSearchesPlugin],
openOnFocus: true, openOnFocus: true,
placeholder: trans(SEARCH_PLACEHOLDER), placeholder: trans("search.placeholder"),
translations: { translations: {
submitButtonTitle: trans(SEARCH_SUBMIT) submitButtonTitle: trans("search.submit")
}, },
// Use a navigator compatible with turbo: // Use a navigator compatible with turbo:
@ -153,7 +150,7 @@ export default class extends Controller {
}, },
templates: { templates: {
header({ html }) { header({ html }) {
return html`<span class="aa-SourceHeaderTitle">${trans(STATISTICS_PARTS)}</span> return html`<span class="aa-SourceHeaderTitle">${trans("part.labelp")}</span>
<div class="aa-SourceHeaderLine" />`; <div class="aa-SourceHeaderLine" />`;
}, },
item({item, components, html}) { item({item, components, html}) {

View file

@ -25,8 +25,7 @@ import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en';
import * as zxcvbnDePackage from '@zxcvbn-ts/language-de'; import * as zxcvbnDePackage from '@zxcvbn-ts/language-de';
import * as zxcvbnFrPackage from '@zxcvbn-ts/language-fr'; import * as zxcvbnFrPackage from '@zxcvbn-ts/language-fr';
import * as zxcvbnJaPackage from '@zxcvbn-ts/language-ja'; import * as zxcvbnJaPackage from '@zxcvbn-ts/language-ja';
import {trans, USER_PASSWORD_STRENGTH_VERY_WEAK, USER_PASSWORD_STRENGTH_WEAK, USER_PASSWORD_STRENGTH_MEDIUM, import {trans} from '../../translator.js';
USER_PASSWORD_STRENGTH_STRONG, USER_PASSWORD_STRENGTH_VERY_STRONG} from '../../translator.js';
/* stimulusFetch: 'lazy' */ /* stimulusFetch: 'lazy' */
export default class extends Controller { export default class extends Controller {
@ -89,23 +88,23 @@ export default class extends Controller {
switch (level) { switch (level) {
case 0: case 0:
text = trans(USER_PASSWORD_STRENGTH_VERY_WEAK); text = trans("user.password_strength.very_weak");
classes = "bg-danger badge-danger"; classes = "bg-danger badge-danger";
break; break;
case 1: case 1:
text = trans(USER_PASSWORD_STRENGTH_WEAK); text = trans("user.password_strength.weak");
classes = "bg-warning badge-warning"; classes = "bg-warning badge-warning";
break; break;
case 2: case 2:
text = trans(USER_PASSWORD_STRENGTH_MEDIUM) text = trans("user.password_strength.medium")
classes = "bg-info badge-info"; classes = "bg-info badge-info";
break; break;
case 3: case 3:
text = trans(USER_PASSWORD_STRENGTH_STRONG); text = trans("user.password_strength.strong");
classes = "bg-primary badge-primary"; classes = "bg-primary badge-primary";
break; break;
case 4: case 4:
text = trans(USER_PASSWORD_STRENGTH_VERY_STRONG); text = trans("user.password_strength.very_strong");
classes = "bg-success badge-success"; classes = "bg-success badge-success";
break; break;
default: default:

View file

@ -22,7 +22,7 @@ import '../../css/components/tom-select_extensions.css';
import TomSelect from "tom-select"; import TomSelect from "tom-select";
import {Controller} from "@hotwired/stimulus"; import {Controller} from "@hotwired/stimulus";
import {trans, ENTITY_SELECT_GROUP_NEW_NOT_ADDED_TO_DB} from '../../translator.js' import {trans} from '../../translator.js'
import TomSelect_autoselect_typed from '../../tomselect/autoselect_typed/autoselect_typed' import TomSelect_autoselect_typed from '../../tomselect/autoselect_typed/autoselect_typed'
TomSelect.define('autoselect_typed', TomSelect_autoselect_typed) TomSelect.define('autoselect_typed', TomSelect_autoselect_typed)
@ -204,7 +204,7 @@ export default class extends Controller {
if (data.not_in_db_yet) { if (data.not_in_db_yet) {
//Not yet added items are shown italic and with a badge //Not yet added items are shown italic and with a badge
name += "<i><b>" + escape(data.text) + "</b></i>" + "<span class='ms-3 badge bg-info badge-info'>" + trans(ENTITY_SELECT_GROUP_NEW_NOT_ADDED_TO_DB) + "</span>"; name += "<i><b>" + escape(data.text) + "</b></i>" + "<span class='ms-3 badge bg-info badge-info'>" + trans("entity.select.group.new_not_added_to_DB") + "</span>";
} else { } else {
name += "<b>" + escape(data.text) + "</b>"; name += "<b>" + escape(data.text) + "</b>";
} }

View file

@ -1,5 +1,6 @@
import { localeFallbacks } from '../var/translations/configuration'; import { createTranslator } from '@symfony/ux-translator';
import { trans, getLocale, setLocale, setLocaleFallbacks } from '@symfony/ux-translator'; import { messages, localeFallbacks } from '../var/translations/index.js';
/* /*
* This file is part of the Symfony UX Translator package. * This file is part of the Symfony UX Translator package.
* *
@ -9,8 +10,9 @@ import { trans, getLocale, setLocale, setLocaleFallbacks } from '@symfony/ux-tra
* If you use TypeScript, you can rename this file to "translator.ts" to take advantage of types checking. * If you use TypeScript, you can rename this file to "translator.ts" to take advantage of types checking.
*/ */
setLocaleFallbacks(localeFallbacks); const translator = createTranslator({
messages,
localeFallbacks,
});
export { trans }; export const { trans } = translator;
export * from '../var/translations';

View file

@ -1,3 +1,9 @@
ux_translator: ux_translator:
# The directory where the JavaScript translations are dumped # The directory where the JavaScript translations are dumped
dump_directory: '%kernel.project_dir%/var/translations' dump_directory: '%kernel.project_dir%/var/translations'
when@prod:
ux_translator:
# Control whether TypeScript types are dumped alongside translations.
# Disable this if you do not use TypeScript (e.g. in production when using AssetMapper), to speed up cache warmup.
# dump_typescript: false

View file

@ -718,18 +718,17 @@
"files": [] "files": []
}, },
"symfony/ux-translator": { "symfony/ux-translator": {
"version": "2.9", "version": "2.32",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "main", "branch": "main",
"version": "2.9", "version": "2.32",
"ref": "bc396565cc4cab95692dd6df810553dc22e352e1" "ref": "20e2abac415da4c3a9a6bafa059a6419beb74593"
}, },
"files": [ "files": [
"./assets/translator.js", "assets/translator.js",
"./config/packages/ux_translator.yaml", "config/packages/ux_translator.yaml",
"./var/translations/configuration.js", "var/translations/index.js"
"./var/translations/index.js"
] ]
}, },
"symfony/ux-turbo": { "symfony/ux-turbo": {