Skip to content

Commit

Permalink
PB-531: Use vue-i18n tool for string interpolations
Browse files Browse the repository at this point in the history
  • Loading branch information
ltshb committed May 23, 2024
1 parent bfd1a04 commit a4d11df
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/modules/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"feedback_success_message": "Danke für Ihre Nachricht. Diese wurde erfolgreich übermittelt.",
"feedback_unsupported_format": "Dieser Dateityp wird leider nicht unterstützt. Bitte verwenden Sie eine .pdf, .zip, .jpg, .jpeg, .kml, .kmz oder .gpx Datei.",
"file_is_not_kml": "Dieses File ist keine KML Datei. ",
"file_too_large": "Die Datei ist zu gross (maximal erlaubte Größe: MAX_FILE_SIZE).",
"file_too_large": "Die Datei ist zu gross (maximal erlaubte Grösse: {maxFileSize}).",
"follow_us": "Folgen Sie uns",
"full_screen": "Vollbild",
"funksender": "Funksender",
Expand Down Expand Up @@ -674,12 +674,12 @@
"field_required": "Dieses Feld ist erforderlich",
"invalid_email": "ungültige E-Mail",
"no_email": "Das E-Mail-Feld ist erforderlich",
"file_unsupported_format": "Dieses Dateiformat wird nicht unterstützt. Nur die folgenden Formate sind erlaubt: ALLOWED_FORMATS",
"file_unsupported_format": "Dieses Dateiformat wird nicht unterstützt. Nur die folgenden Formate sind erlaubt: {allowedFormats}",
"form_invalid": "Das Formular ist ungültig",
"file_imported_success": "Datei erfolgreich importiert",
"3d_labels": "Geografische Namen",
"3d_vegetation": "Vegetationen",
"3d_constructions": "Gebäude und Konstruktionen",
"webmapviewer_live_disclaimer": "Grosse Veränderungen stehen bevor, <a target='_blank' href='https://www.swisstopo.admin.ch/de'>erfahren Sie mehr</a>",
"drawing_too_large": "Deine Zeichnung ist zu groß, entferne einige Details."
"drawing_too_large": "Deine Zeichnung ist zu gross, entferne einige Details."
}
4 changes: 2 additions & 2 deletions src/modules/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"feedback_success_message": "Your message was successfully sent. Thank you.",
"feedback_unsupported_format": "This file format is not supported. Thanks for using another format for you attachment.",
"file_is_not_kml": "The file is not a KML file.",
"file_too_large": "The file is too large (max size allowed MAX_FILE_SIZE).",
"file_too_large": "The file is too large (max size allowed {maxFileSize}).",
"follow_us": "Follow us",
"full_screen": "Full screen",
"funksender": "Radio transmitter",
Expand Down Expand Up @@ -674,7 +674,7 @@
"field_required": "This field is required",
"invalid_email": "Invalid email",
"no_email": "The e-mail field is required",
"file_unsupported_format": "This file format is not supported. Only the following formats are allowed: ALLOWED_FORMATS",
"file_unsupported_format": "This file format is not supported. Only the following formats are allowed: {allowedFormats}",
"form_invalid": "Form is invalid",
"file_imported_success": "File successfully imported",
"3d_labels": "Geographic names",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"feedback_success_message": "Votre message a été envoyé avec succès. Merci.",
"feedback_unsupported_format": "Le format du fichier n’est pas pris en charge, merci d’utiliser un autre format pour votre pièce jointe.",
"file_is_not_kml": "Ce fichier n'est pas un fichier KML.",
"file_too_large": "Ce fichier est trop volumineux (taille maximale autorisée : MAX_FILE_SIZE)",
"file_too_large": "Ce fichier est trop volumineux (taille maximale autorisée : {maxFileSize})",
"follow_us": "Suivez-nous",
"full_screen": "Plein écran",
"funksender": "Emetteur radio",
Expand Down Expand Up @@ -674,7 +674,7 @@
"field_required": "Ce champ est requis",
"invalid_email": "e-mail invalide",
"no_email": "Le champ email est requis",
"file_unsupported_format": "Ce format de fichier n'est pas pris en charge. Seuls les formats suivants sont autorisés : ALLOWED_FORMATS",
"file_unsupported_format": "Ce format de fichier n'est pas pris en charge. Seuls les formats suivants sont autorisés : {allowedFormats}",
"form_invalid": "Le formulaire est invalide",
"file_imported_success": "Fichier importé avec succès",
"3d_labels": "Noms géographiques",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"feedback_success_message": "Il suo messaggio è stato inviato con successo. Grazie.",
"feedback_unsupported_format": "Il formato del file selezionato non è supportato dal sistema, per favore utilizzare un altro formato per il vostro allegato.",
"file_is_not_kml": "Questo file non è un file KML.",
"file_too_large": "Il file é troppo grande (dimensione massima consentita: MAX_FILE_SIZE)",
"file_too_large": "Il file é troppo grande (dimensione massima consentita: {maxFileSize})",
"follow_us": "Seguiteci",
"full_screen": "Schermo intero",
"funksender": "Trasmettitore radio",
Expand Down Expand Up @@ -674,7 +674,7 @@
"field_required": "Questo campo è obbligatorio",
"invalid_email": "e-mail non valido",
"no_email": "Il campo email è obbligatorio",
"file_unsupported_format": "Questo formato file non è supportato. Sono ammessi solo i seguenti formati: ALLOWED_FORMATS",
"file_unsupported_format": "Questo formato file non è supportato. Sono ammessi solo i seguenti formati: {allowedFormats}",
"form_invalid": "Il modulo non è valido",
"file_imported_success": "File importato con successo",
"3d_labels": "Nomi geografici",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/i18n/locales/rm.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"feedback_success_message": "Rapport trasmess cun success. Grazia.",
"feedback_unsupported_format": "Tip da datoteca betg supportà. Duvrai empè da quai pdf, .zip, .jpg, .jpeg, .kml, .kmz u .gpx",
"file_is_not_kml": "Questa datoteca nun è ina datoteca KML",
"file_too_large": "Questa datoteca è memia grond (grondezza maximala lubida: MAX_FILE_SIZE)",
"file_too_large": "Questa datoteca è memia grond (grondezza maximala lubida: {maxFileSize})",
"follow_us": "Giais suenter a nus",
"full_screen": "Maletg entir",
"funksender": "Emettur radiofonic ",
Expand Down Expand Up @@ -672,7 +672,7 @@
"field_required": "Quest champ è necessari",
"invalid_email": "ungültige E-Mail",
"no_email": "Il champ da posta eletronicala è necessari",
"file_unsupported_format": "Quest format da datoteca na vegn betg sustegnì. Sun ils seguents formats èn permess: ALLOWED_FORMATS",
"file_unsupported_format": "Quest format da datoteca na vegn betg sustegnì. Sun ils seguents formats èn permess: {allowedFormats}",
"form_invalid": "Il formular è invalid",
"file_imported_success": "Datoteca importada cun success",
"3d_labels": "Numns geografics",
Expand Down
8 changes: 4 additions & 4 deletions src/utils/components/FileInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ function onFileSelected(evt) {
data-cy="file-input-invalid-feedback"
>
{{
i18n
.t(invalidMessage)
.replace('ALLOWED_FORMATS', acceptedFileTypes.join(', '))
.replace('MAX_FILE_SIZE', maxFileSizeHuman)
i18n.t(invalidMessage, {
maxFileSize: maxFileSizeHuman,
allowedFormats: acceptedFileTypes.join(', '),
})
}}
</div>
<div v-if="validMessage" class="valid-feedback" data-cy="file-input-valid-feedback">
Expand Down
4 changes: 2 additions & 2 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,6 @@ export function isValidEmail(email) {
* @returns {String} Human readable size
*/
export function humanFileSize(size) {
let i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024))
return +(size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
const i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024))
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
}

0 comments on commit a4d11df

Please sign in to comment.