From 47a78409ab1e22d129832599d698e0e1a115a51e Mon Sep 17 00:00:00 2001 From: Ian Dees Date: Sun, 28 Jan 2024 21:59:25 -0600 Subject: [PATCH 1/3] Support address field ordering localization --- index.html | 23 ++++++++++++++++++----- js/i18n.js | 28 +++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 15bb89b..7fcb505 100755 --- a/index.html +++ b/index.html @@ -114,7 +114,8 @@

On OpenStreetMap

-
+ +
@@ -123,7 +124,8 @@

On OpenStreetMap

-
+ +
@@ -132,8 +134,18 @@

On OpenStreetMap

- -
+ +
+ +
+
+ +
+ +
+
+ +
@@ -142,7 +154,8 @@

On OpenStreetMap

-
+ +
diff --git a/js/i18n.js b/js/i18n.js index 176c8e5..d6c388a 100644 --- a/js/i18n.js +++ b/js/i18n.js @@ -19,7 +19,7 @@ const rerender = () => { // may have to fix this?? reloadLists(i18next.resolvedLanguage); - // these translations won't get re-copied to their current controls + // these translations won't get re-copied to their current controls successString = i18n.t('messages.success', { escapeInterpolation: false }); @@ -31,6 +31,28 @@ const rerender = () => { modalText.text = i18n.t('messages.modalTitle'); modalText.button = i18n.t('messages.modalButton'); + // Move the address fields around to match the localization + let parent = $('#hnumbergroup').parent(); + let hnumber = $('#hnumbergroup').clone(); + let street = $('#streetgroup').clone(); + let placename = $('#placenamegroup').clone(); + let city = $('#citygroup').clone(); + let postcode = $('#postcodegroup').clone(); + parent.empty() + if (i18next.resolvedLanguage === 'en-US') { + // US English should show house number before street name and hide place name + parent.append(hnumber); + parent.append(street); + parent.append(city); + parent.append(postcode); + } else { + // All other languages should show street before house number + parent.append(street); + parent.append(hnumber); + parent.append(city); + parent.append(postcode); + } + $('body').localize(); }; @@ -74,5 +96,5 @@ $(function () { rerender(); if (err) return console.error(err); - }); -}); + }); +}); From a78d7db706c3facaaf8e21edbe3e02590602d660 Mon Sep 17 00:00:00 2001 From: Ian Dees Date: Sun, 28 Jan 2024 22:04:00 -0600 Subject: [PATCH 2/3] Include placename in note body --- js/site.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/site.js b/js/site.js index 415d14a..b2c3558 100755 --- a/js/site.js +++ b/js/site.js @@ -591,6 +591,7 @@ function getNoteBody() { if ($("#name").val()) note_body += i18n.t('step2.name') + ": " + $("#name").val() + "\n"; if ($("#hnumberalt").val()) note_body += "addr:housenumber=" + $("#hnumberalt").val() + "\n"; if ($("#addressalt").val()) note_body += "addr:street=" + $("#addressalt").val() + "\n"; + if ($("#placenamealt").val()) note_body += "addr:place=" + $("#placenamealt").val() + "\n"; if ($("#city").val()) note_body += "addr:city=" + $("#city").val() + "\n"; if ($("#postcode").val()) note_body += "addr:postcode=" + $("#postcode").val() + "\n"; if ($("#phone").val()) note_body += i18n.t('step2.phone') + ": " + $("#phone").val() + "\n"; From d83ca9cde6ca2f2801c1a4598357228f494f7152 Mon Sep 17 00:00:00 2001 From: Ian Dees Date: Sun, 28 Jan 2024 22:18:09 -0600 Subject: [PATCH 3/3] Include i18n values for place name --- js/i18n.js | 1 + locales/en-GB/translation.json | 4 +++- locales/en-US/translation.json | 2 ++ locales/en/translation.json | 4 +++- locales/es/translation.json | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/js/i18n.js b/js/i18n.js index d6c388a..3053767 100644 --- a/js/i18n.js +++ b/js/i18n.js @@ -48,6 +48,7 @@ const rerender = () => { } else { // All other languages should show street before house number parent.append(street); + parent.append(placename); parent.append(hnumber); parent.append(city); parent.append(postcode); diff --git a/locales/en-GB/translation.json b/locales/en-GB/translation.json index 52993a4..a9752e7 100755 --- a/locales/en-GB/translation.json +++ b/locales/en-GB/translation.json @@ -23,10 +23,12 @@ "cataltdesc": "Description", "addressalt": "Help us by filling the complete address (housenumber, post code) or improving the previous one", "street": "Street", - "housenumber": "Housenumber", + "placename": "Place Name", + "housenumber": "House Number", "city": "City", "postcode": "Postcode", "addressaltplaceholder": "West Main Street", + "placenameplaceholder": "Woods Village", "housenumberplaceholder": "501", "cityplaceholder": "Alexandria", "postcodeplaceholder": "50023", diff --git a/locales/en-US/translation.json b/locales/en-US/translation.json index 0cd427b..1dcb07c 100644 --- a/locales/en-US/translation.json +++ b/locales/en-US/translation.json @@ -23,10 +23,12 @@ "cataltdesc": "Description", "addressalt": "Help us by filling the complete address (housenumber, post code) or improving the previous one", "street": "Street", + "placename": "Place Name", "housenumber": "Housenumber", "city": "City", "postcode": "Zipcode", "addressaltplaceholder": "West Main Street", + "placenameplaceholder": "Woods Village", "housenumberplaceholder": "501", "cityplaceholder": "Alexandria", "postcodeplaceholder": "50023", diff --git a/locales/en/translation.json b/locales/en/translation.json index 7b1ca22..a51ef44 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -24,10 +24,12 @@ "cataltdesc": "Description", "addressalt": "Help us by filling the complete address (housenumber, post code) or improving the previous one", "street": "Street", - "housenumber": "Housenumber", + "placename": "Place Name", + "housenumber": "House Number", "city": "City", "postcode": "Postcode", "addressaltplaceholder": "West Main Street", + "placenameplaceholder": "Woods Village", "housenumberplaceholder": "501", "cityplaceholder": "Alexandria", "postcodeplaceholder": "50023", diff --git a/locales/es/translation.json b/locales/es/translation.json index 29eefd6..22546f4 100644 --- a/locales/es/translation.json +++ b/locales/es/translation.json @@ -22,10 +22,12 @@ "cataltdesc": "Descripción", "addressalt": "Ayúdenos rellenando la dirección completa (número de casa, código postal) o mejorando la anterior", "street": "Calle", + "placename": "Nombre del lugar", "housenumber": "Número de casa", "city": "Ciudad", "postcode": "Código postal", "addressaltplaceholder": "Avenida América, España", + "placenameplaceholder": "Pueblo del Bosque", "housenumberplaceholder": "501", "cityplaceholder": "Alexandria", "postcodeplaceholder": "50023",