From a952146fc21b2d8de58ee32740b59403f84c8ad9 Mon Sep 17 00:00:00 2001 From: Danilo Hoffmann Date: Mon, 25 Oct 2021 09:18:33 +0100 Subject: [PATCH] fix: check for whole occurences of localizations (#907) --- scripts/clean-up-localizations.js | 4 +++- src/assets/i18n/de_DE.json | 3 --- src/assets/i18n/en_US.json | 3 --- src/assets/i18n/fr_FR.json | 3 --- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/clean-up-localizations.js b/scripts/clean-up-localizations.js index 5c892f7a83..26605ac0d8 100644 --- a/scripts/clean-up-localizations.js +++ b/scripts/clean-up-localizations.js @@ -31,11 +31,13 @@ Object.keys(localizations_default) // go through directory recursively and find files to be searched const filesToBeSearched = glob.sync('{src,projects}/**/!(*.spec).{ts,html}'); +const regex = _.memoize(key => new RegExp(`[^.-]\\b${key.replace(/[.]/g, '\\$&')}\\b[^.-]`)); + // add used localization keys with their localization values filesToBeSearched.forEach(filePath => { const fileContent = fs.readFileSync(filePath); for (const localizationKey in localizations_default) { - if (fileContent.includes(localizationKey)) { + if (regex(localizationKey).test(fileContent)) { // store found localizations localizationsFound[localizationKey] = localizations_default[localizationKey]; delete localizations_default[localizationKey]; diff --git a/src/assets/i18n/de_DE.json b/src/assets/i18n/de_DE.json index 43bbe2f9a1..6a0336f19f 100644 --- a/src/assets/i18n/de_DE.json +++ b/src/assets/i18n/de_DE.json @@ -200,7 +200,6 @@ "account.organization.user_management.back_to_list": "Zurück zur Benutzerverwaltung", "account.organization.user_management.new_user.confirmation": "Der Benutzer \"{{0}}\" wurde erstellt.", "account.organization.user_management.update_user.confirmation": "Der Benutzer \"{{0}}\" wurde geändert.", - "account.organization.user_management.user_detail": "Benutzerdaten", "account.organization.user_management.user_detail.breadcrumb": "Benutzerdaten", "account.overview.message.text": "Hier finden Sie alles, um Ihre Bestellungen zu verfolgen, Ihr Adressbuch zu aktualisieren, Ihre Kontoinformationen zu bearbeiten und mehr.", "account.overview.message_b2b.text": "Hier finden Sie alles, was Sie benötigen, um Ihre Bestellanforderungen, Preisangebote und Bestellungen zu verfolgen, Ihre Bestellvorlagen zu aktualisieren, das Budget zu verwalten und vieles mehr.", @@ -323,7 +322,6 @@ "account.send_password.message": "Eine E-Mail mit einem Link zur Kennwort-Änderung wurde an Ihre E-Mail-Adresse gesendet. Öffnen Sie den Link und folgen Sie den Anweisungen.", "account.signin.auth0.button.label": "Mit Auth0 anmelden", "account.signin.button.label": "Anmelden", - "account.submit.button.label": "OK", "account.update.button.label": "Änderungen speichern", "account.update_email.answer.text": "Die neue E-Mail-Adresse ist sofort aktiv. Verwenden Sie sie bei der nächsten Bestellung oder aktualisieren Sie Ihre Kontoinformationen.", "account.update_email.breadcrumb": "E-Mail-Einstellungen bearbeiten", @@ -756,7 +754,6 @@ "locale.fr_FR.long": "Français", "locale.fr_FR.short": "fr", "modal.heading.remove.order.template": "Produkt aus Bestellvorlage entfernen", - "order.number.label": "Bestellnummer:", "order.tracking.error": "Leider konnte keine Bestellung mit Ihren Daten gefunden werden.", "order_template.create.heading": "Bestellvorlage anlegen", "payment.error.PaymentInstrumentAlreadyExists": "Das Zahlungsmittel konnte nicht angelegt werden. Zahlungsdaten mit den angegebenen Parametern sind bereits vorhanden.", diff --git a/src/assets/i18n/en_US.json b/src/assets/i18n/en_US.json index d68fbaf058..30b385a8ff 100644 --- a/src/assets/i18n/en_US.json +++ b/src/assets/i18n/en_US.json @@ -200,7 +200,6 @@ "account.organization.user_management.back_to_list": "Back to User Management", "account.organization.user_management.new_user.confirmation": "The user \"{{0}}\" has been created.", "account.organization.user_management.update_user.confirmation": "The user \"{{0}}\" has been updated.", - "account.organization.user_management.user_detail": "User Details", "account.organization.user_management.user_detail.breadcrumb": "User Details", "account.overview.message.text": "Everything you need to track your orders, update your address book, edit your account information and more is right here.", "account.overview.message_b2b.text": "Everything you need to track your requisitions, quotes and orders, update your order templates, manage the budget and more is right here.", @@ -323,7 +322,6 @@ "account.send_password.message": "An e-mail with a link has been sent to your e-mail address. Please follow this link to change your password.", "account.signin.auth0.button.label": "Sign In With Auth0", "account.signin.button.label": "Sign In", - "account.submit.button.label": "OK", "account.update.button.label": "Save Changes", "account.update_email.answer.text": "Your new e-mail address takes effect immediately. Use it the next time you place an order or update your account information.", "account.update_email.breadcrumb": "Edit E-mail Preferences", @@ -756,7 +754,6 @@ "locale.fr_FR.long": "Français", "locale.fr_FR.short": "fr", "modal.heading.remove.order.template": "Remove Product From Order Template", - "order.number.label": "Order Number:", "order.tracking.error": "Unfortunately, we could not locate an order with the information you provided.", "order_template.create.heading": "Create Order Template", "payment.error.PaymentInstrumentAlreadyExists": "The payment instrument could not be created. Payment data with the given parameters already exists.", diff --git a/src/assets/i18n/fr_FR.json b/src/assets/i18n/fr_FR.json index b3dc08007a..2eb4eab565 100644 --- a/src/assets/i18n/fr_FR.json +++ b/src/assets/i18n/fr_FR.json @@ -200,7 +200,6 @@ "account.organization.user_management.back_to_list": "Retourner à la gestion des utilisateurs", "account.organization.user_management.new_user.confirmation": " L’utilisateur \"{{0}}\" a été créé.", "account.organization.user_management.update_user.confirmation": "L’utilisateur \"{{0}}\" a été mise à jour.", - "account.organization.user_management.user_detail": "Détails de l’utilisateur", "account.organization.user_management.user_detail.breadcrumb": "Détails de l’utilisateur", "account.overview.message.text": "Tout ce dont vous avez besoin pour suivre vos commandes, mettre à jour votre carnet d’adresses, modifier les informations de votre compte et plus encore est ici.", "account.overview.message_b2b.text": "Tout ce dont vous avez besoin pour suivre vos demandes d'achat, devis et commandes, mettre à jour vos modèles de commande, gérer le budget et bien plus encore se trouve ici.", @@ -323,7 +322,6 @@ "account.send_password.message": "Un courriel contenant un lien a été envoyé à votre adresse courriel. Veuillez suivre ce lien pour modifier votre mot de passe.", "account.signin.auth0.button.label": "Connectez-vous avec Auth0", "account.signin.button.label": "Se connecter", - "account.submit.button.label": "OK", "account.update.button.label": "Enregistrer les modifications", "account.update_email.answer.text": "Votre nouvelle adresse courriel prend effet immédiatement. Utilisez-le la prochaine fois que vous passez une commande ou que vous modifiez les informations de votre compte.", "account.update_email.breadcrumb": "Modifiez les préférences de courriel", @@ -756,7 +754,6 @@ "locale.fr_FR.long": "Français", "locale.fr_FR.short": "fr", "modal.heading.remove.order.template": "Supprimer le produit du modèle de commande", - "order.number.label": "Numéro de commande :", "order.tracking.error": "Malheureusement, nous n’avons pas pu localiser de commande avec les informations que vous nous avez fournies.", "order_template.create.heading": "Créer un modèle de commande", "payment.error.PaymentInstrumentAlreadyExists": "L’instrument de paiement n’a pas pu être créé. Les données de paiement avec les paramètres fournis existent déjà.",