Skip to content

Commit

Permalink
fix: check for whole occurences of localizations (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi authored Oct 25, 2021
1 parent 2de6856 commit a952146
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
4 changes: 3 additions & 1 deletion scripts/clean-up-localizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
3 changes: 0 additions & 3 deletions src/assets/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down
3 changes: 0 additions & 3 deletions src/assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down
3 changes: 0 additions & 3 deletions src/assets/i18n/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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à.",
Expand Down

0 comments on commit a952146

Please sign in to comment.