From 51861d113132216c71fbe79ab2698d37bba0d6a9 Mon Sep 17 00:00:00 2001 From: Andy Rothwell Date: Wed, 6 Dec 2023 12:02:36 -0500 Subject: [PATCH] starts to add infrastructure for putting in translations --- .github/workflows/dev_push_to_s3.yml | 2 +- package-lock.json | 150 +++------------------------ package.json | 2 +- src/components/customGreeting.vue | 47 ++++++--- src/i18n/en-us.js | 34 ++++++ src/i18n/es.js | 34 ++++++ src/i18n/i18n.js | 32 ++++++ src/main.js | 8 +- 8 files changed, 156 insertions(+), 153 deletions(-) create mode 100644 src/i18n/en-us.js create mode 100644 src/i18n/es.js create mode 100644 src/i18n/i18n.js diff --git a/.github/workflows/dev_push_to_s3.yml b/.github/workflows/dev_push_to_s3.yml index b0536d2..b461d07 100644 --- a/.github/workflows/dev_push_to_s3.yml +++ b/.github/workflows/dev_push_to_s3.yml @@ -6,7 +6,7 @@ name: dev Push to S3 on: push: branches: - - main + - add-translations jobs: build: diff --git a/package-lock.json b/package-lock.json index 296af35..aef1c75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1179,7 +1179,7 @@ }, "@fortawesome/fontawesome-svg-core": { "version": "1.2.36", - "resolved": "https://npm.fontawesome.com/@fortawesome/fontawesome-svg-core/-/1.2.36/fontawesome-svg-core-1.2.36.tgz", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.36.tgz", "integrity": "sha512-YUcsLQKYb6DmaJjIHdDWpBIGCcyE/W+p/LMGvjQem55Mm2XWVAP5kWTMKWLv9lwpCVjpLxPyOMOyUocP1GxrtA==", "requires": { "@fortawesome/fontawesome-common-types": "^0.2.36" @@ -1187,7 +1187,7 @@ }, "@fortawesome/free-brands-svg-icons": { "version": "5.15.4", - "resolved": "https://npm.fontawesome.com/@fortawesome/free-brands-svg-icons/-/5.15.4/free-brands-svg-icons-5.15.4.tgz", + "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-5.15.4.tgz", "integrity": "sha512-f1witbwycL9cTENJegcmcZRYyawAFbm8+c6IirLmwbbpqz46wyjbQYLuxOc7weXFXfB7QR8/Vd2u5R3q6JYD9g==", "requires": { "@fortawesome/fontawesome-common-types": "^0.2.36" @@ -1195,7 +1195,7 @@ }, "@fortawesome/free-regular-svg-icons": { "version": "5.15.4", - "resolved": "https://npm.fontawesome.com/@fortawesome/free-regular-svg-icons/-/5.15.4/free-regular-svg-icons-5.15.4.tgz", + "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-5.15.4.tgz", "integrity": "sha512-9VNNnU3CXHy9XednJ3wzQp6SwNwT3XaM26oS4Rp391GsxVYA+0oDR2J194YCIWf7jNRCYKjUCOduxdceLrx+xw==", "requires": { "@fortawesome/fontawesome-common-types": "^0.2.36" @@ -1203,7 +1203,7 @@ }, "@fortawesome/free-solid-svg-icons": { "version": "5.15.4", - "resolved": "https://npm.fontawesome.com/@fortawesome/free-solid-svg-icons/-/5.15.4/free-solid-svg-icons-5.15.4.tgz", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.4.tgz", "integrity": "sha512-JLmQfz6tdtwxoihXLg6lT78BorrFyCf59SAwBM6qV/0zXyVeDygJVb3fk+j5Qat+Yvcxp1buLTY5iDh1ZSAQ8w==", "requires": { "@fortawesome/fontawesome-common-types": "^0.2.36" @@ -1235,7 +1235,7 @@ }, "@fortawesome/vue-fontawesome": { "version": "2.0.5", - "resolved": "https://npm.fontawesome.com/@fortawesome/vue-fontawesome/-/2.0.5/vue-fontawesome-2.0.5.tgz", + "resolved": "https://registry.npmjs.org/@fortawesome/vue-fontawesome/-/vue-fontawesome-2.0.5.tgz", "integrity": "sha512-BktJiEuZhU+HxANJ37Pek6y+LRVVFgcU5CDd6b+t6XKj30QrYrh3ICsC5FQm5MuAdh3CPpYT99ywjk5v6nWteA==" }, "@hapi/address": { @@ -1519,15 +1519,14 @@ } }, "@phila/pinboard": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@phila/pinboard/-/pinboard-1.2.8.tgz", - "integrity": "sha512-JfTETwkhGGsCerV0ZmzDjN01PtIydFlcDFgxAXDrIirDaeviDxf8nqVEhR/nx91yJ4BXBnObqr5LDxRrPbtKUg==", + "version": "git+https://github.com/CityOfPhiladelphia/pinboard.git#9ee47b2be5e077aab2a0dbb1ed89b2caf51017a3", + "from": "git+https://github.com/CityOfPhiladelphia/pinboard.git#9ee47b2", "requires": { "@creativebulma/bulma-tooltip": "^1.2.0", "@fortawesome/free-brands-svg-icons": "^5.15.4", "@phila/phila-ui": "2.1.13", - "@phila/vue-datafetch": "2.2.16", - "@phila/vue-mapping": "3.1.20", + "@phila/vue-datafetch": "2.2.18", + "@phila/vue-mapping": "3.1.21", "animate.css": "^4.1.1", "axios": "^0.19.0", "bulma": "^0.9.4", @@ -1545,9 +1544,9 @@ } }, "@phila/vue-datafetch": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/@phila/vue-datafetch/-/vue-datafetch-2.2.16.tgz", - "integrity": "sha512-vcIqMqjrhmE/ZKUi7PZ1yF8KKFSEbAHcUJmYqZ9NhLEC3RNaPsHUz2WWYm8+b74ra953NGvz6ovNewM5luLm2A==", + "version": "2.2.18", + "resolved": "https://registry.npmjs.org/@phila/vue-datafetch/-/vue-datafetch-2.2.18.tgz", + "integrity": "sha512-y6SuRGF54u+fH4JtNsa8SPuZup8iSwFYImo+dyyYdJky/2IZNDNhxLWFwGUHldCIrFeDQFook5uZNUF278JMsw==", "requires": { "@turf/turf": "^6.5.0", "airtable": "^0.8.1", @@ -1562,9 +1561,9 @@ } }, "@phila/vue-mapping": { - "version": "3.1.20", - "resolved": "https://registry.npmjs.org/@phila/vue-mapping/-/vue-mapping-3.1.20.tgz", - "integrity": "sha512-O8aW3xm88RvmAJMxC5UtDVAMJhafuKt0i3MBAZ+R7sfBke5Ljwj2vLxPzw+7JxwloG2+eVdeWFSfnQ6YLhdhbw==", + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/@phila/vue-mapping/-/vue-mapping-3.1.21.tgz", + "integrity": "sha512-k+pTNcmd27a/X+O5Ah9jhDsKLI3T4RhKGdSuuB00IlarJSf4nog/aU9ILC2KoWfMG8HwivJtNMBc90rtL0tAJg==", "requires": { "@fortawesome/fontawesome-svg-core": "1.2.36", "@fortawesome/free-regular-svg-icons": "5.15.4", @@ -1711,39 +1710,6 @@ "@turf/helpers": "^6.5.0", "@turf/invariant": "^6.5.0", "@turf/rhumb-bearing": "^6.5.0" - }, - "dependencies": { - "@turf/bearing": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/bearing/-/bearing-6.5.0.tgz", - "integrity": "sha512-dxINYhIEMzgDOztyMZc20I7ssYVNEpSv04VbMo5YPQsqa80KO3TFvbuCahMsCAW5z8Tncc8dwBlEFrmRjJG33A==", - "requires": { - "@turf/helpers": "^6.5.0", - "@turf/invariant": "^6.5.0" - } - }, - "@turf/helpers": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-6.5.0.tgz", - "integrity": "sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==" - }, - "@turf/invariant": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-6.5.0.tgz", - "integrity": "sha512-Wv8PRNCtPD31UVbdJE/KVAWKe7l6US+lJItRR/HOEW3eh+U/JwRCSUl/KZ7bmjM/C+zLNoreM2TU6OoLACs4eg==", - "requires": { - "@turf/helpers": "^6.5.0" - } - }, - "@turf/rhumb-bearing": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/rhumb-bearing/-/rhumb-bearing-6.5.0.tgz", - "integrity": "sha512-jMyqiMRK4hzREjQmnLXmkJ+VTNTx1ii8vuqRwJPcTlKbNWfjDz/5JqJlb5NaFDcdMpftWovkW5GevfnuzHnOYA==", - "requires": { - "@turf/helpers": "^6.5.0", - "@turf/invariant": "^6.5.0" - } - } } }, "@turf/area": { @@ -2152,38 +2118,6 @@ "@turf/helpers": "^6.5.0", "@turf/invariant": "^6.5.0", "@turf/meta": "^6.5.0" - }, - "dependencies": { - "@turf/centroid": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/centroid/-/centroid-6.5.0.tgz", - "integrity": "sha512-MwE1oq5E3isewPprEClbfU5pXljIK/GUOMbn22UM3IFPDJX0KeoyLNwghszkdmFp/qMGL/M13MMWvU+GNLXP/A==", - "requires": { - "@turf/helpers": "^6.5.0", - "@turf/meta": "^6.5.0" - } - }, - "@turf/helpers": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-6.5.0.tgz", - "integrity": "sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==" - }, - "@turf/invariant": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-6.5.0.tgz", - "integrity": "sha512-Wv8PRNCtPD31UVbdJE/KVAWKe7l6US+lJItRR/HOEW3eh+U/JwRCSUl/KZ7bmjM/C+zLNoreM2TU6OoLACs4eg==", - "requires": { - "@turf/helpers": "^6.5.0" - } - }, - "@turf/meta": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/meta/-/meta-6.5.0.tgz", - "integrity": "sha512-RrArvtsV0vdsCBegoBtOalgdSOfkBrTJ07VkpiCnq/491W67hnMWmDu7e6Ztw0C3WldRYTXkg3SumfdzZxLBHA==", - "requires": { - "@turf/helpers": "^6.5.0" - } - } } }, "@turf/ellipse": { @@ -2494,21 +2428,6 @@ "@turf/distance-weight": "^6.5.0", "@turf/helpers": "^6.5.0", "@turf/meta": "^6.5.0" - }, - "dependencies": { - "@turf/helpers": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-6.5.0.tgz", - "integrity": "sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==" - }, - "@turf/meta": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/meta/-/meta-6.5.0.tgz", - "integrity": "sha512-RrArvtsV0vdsCBegoBtOalgdSOfkBrTJ07VkpiCnq/491W67hnMWmDu7e6Ztw0C3WldRYTXkg3SumfdzZxLBHA==", - "requires": { - "@turf/helpers": "^6.5.0" - } - } } }, "@turf/nearest-point": { @@ -2612,21 +2531,6 @@ "requires": { "@turf/helpers": "^6.5.0", "@turf/meta": "^6.5.0" - }, - "dependencies": { - "@turf/helpers": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-6.5.0.tgz", - "integrity": "sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==" - }, - "@turf/meta": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/meta/-/meta-6.5.0.tgz", - "integrity": "sha512-RrArvtsV0vdsCBegoBtOalgdSOfkBrTJ07VkpiCnq/491W67hnMWmDu7e6Ztw0C3WldRYTXkg3SumfdzZxLBHA==", - "requires": { - "@turf/helpers": "^6.5.0" - } - } } }, "@turf/polygon-tangents": { @@ -2689,30 +2593,6 @@ "@turf/boolean-intersects": "^6.5.0", "@turf/distance": "^6.5.0", "@turf/helpers": "^6.5.0" - }, - "dependencies": { - "@turf/distance": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/distance/-/distance-6.5.0.tgz", - "integrity": "sha512-xzykSLfoURec5qvQJcfifw/1mJa+5UwByZZ5TZ8iaqjGYN0vomhV9aiSLeYdUGtYRESZ+DYC/OzY+4RclZYgMg==", - "requires": { - "@turf/helpers": "^6.5.0", - "@turf/invariant": "^6.5.0" - } - }, - "@turf/helpers": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-6.5.0.tgz", - "integrity": "sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==" - }, - "@turf/invariant": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-6.5.0.tgz", - "integrity": "sha512-Wv8PRNCtPD31UVbdJE/KVAWKe7l6US+lJItRR/HOEW3eh+U/JwRCSUl/KZ7bmjM/C+zLNoreM2TU6OoLACs4eg==", - "requires": { - "@turf/helpers": "^6.5.0" - } - } } }, "@turf/rewind": { diff --git a/package.json b/package.json index 366d271..7a4728d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@fortawesome/pro-light-svg-icons": "5.15.4", "@fortawesome/pro-regular-svg-icons": "5.15.4", "@fortawesome/pro-solid-svg-icons": "5.15.4", - "@phila/pinboard": "1.2.8", + "@phila/pinboard": "https://github.com/CityOfPhiladelphia/pinboard#9ee47b2", "bulma": "^0.9.1", "core-js": "^3.25.1", "vue": "^2.6.10" diff --git a/src/components/customGreeting.vue b/src/components/customGreeting.vue index 6b9df6b..8c30c96 100644 --- a/src/components/customGreeting.vue +++ b/src/components/customGreeting.vue @@ -11,22 +11,43 @@
-

About this finder

-

This tool can help you find organizations that offer immigrant-focused services in Philadelphia. You can:

-
-
    -
  • Browse the list of organizations.
  • -
  • Search by address or keyword.
  • -
  • Filter your results by service type.
  • -
-
-
-
-

Adding your organization

-

Does your organization offer services for immigrants? Contact the Office of Immigrant Affairs at OIA@phila.gov to learn how to be added to this finder.

+

+ {{ $t('introPage.section1Title') }} +

+ + +

+ + +

    +
  • Browse the list of organizations.
  • +
  • Search by address or keyword.
  • +
  • Filter your results by service type.
  • +
+ + + + + +

+

    +
  • + {{ $t('introPage.ul1.' + index) }} +
  • +
+
diff --git a/src/i18n/en-us.js b/src/i18n/en-us.js new file mode 100644 index 0000000..7fb1c2c --- /dev/null +++ b/src/i18n/en-us.js @@ -0,0 +1,34 @@ + +export default { + language: 'English', + app: { + title: 'Resources for immigrants', + subtitle: 'Find services for immigrants in Philadelphia', + noResults: 'We\'re sorry, there are no results for that search. Adjust the filters you\'ve selected and try again.', + searchPlaceholders: { + all: 'Search by address', + }, + }, + introPage: { + section1Title: "About this finder", + p0: "This tool can help you find organizations that offer immigrant-focused services in Philadelphia. You can:", + ul1: { + li: "Browse the list of organizations.", + li2: "Search by address or keyword.", + li3: "Filter your results by service type.", + }, + section2Title: "Adding your organization", + p1: "Does your organization offer services for immigrants? Contact the Office of Immigrant Affairs at OIA@phila.gov to learn how to be added to this finder.", + }, + 'Arts & culture': 'Arts & culture', + 'Citizenship application help': 'Citizenship application help', + 'English (ESL) classes': 'English (ESL) classes', + 'Health/mental health services': 'Health/mental health services', + 'Housing assistance': 'Housing assistance', + 'Immigrant advocacy': 'Immigrant advocacy', + 'Immigrant focused youth programs': 'Immigrant focused youth programs', + 'Job readiness': 'Job readiness', + 'Legal services': 'Legal services', + 'Refugee/asylee services': 'Refugee/asylee services', + 'Victim/witness support': 'Victim/witness support', +}; diff --git a/src/i18n/es.js b/src/i18n/es.js new file mode 100644 index 0000000..8dc1906 --- /dev/null +++ b/src/i18n/es.js @@ -0,0 +1,34 @@ + +export default { + language: 'Spanish', + app: { + title: 'Spanish Resources for immigrants', + subtitle: 'Spanish Find services for immigrants in Philadelphia', + noResults: 'We\'re sorry, there are no results for that search. Adjust the filters you\'ve selected and try again.', + searchPlaceholders: { + all: 'Search by address', + }, + }, + introPage: { + section1Title: "Spanish About this finder", + p0: "Spanish This tool can help you find organizations that offer immigrant-focused services in Philadelphia. You can:", + ul1: { + li: "Spanish Browse the list of organizations.", + li2: "Spanish Search by address or keyword.", + li3: "Spanish Filter your results by service type.", + }, + section2Title: "Spanish Adding your organization", + p1: "Spanish Does your organization offer services for immigrants? Contact the Office of Immigrant Affairs at OIA@phila.gov to learn how to be added to this finder.", + }, + 'Arts & culture': 'Spanish Arts & culture', + 'Citizenship application help': 'Spanish Citizenship application help', + 'English (ESL) classes': 'Spanish English (ESL) classes', + 'Health/mental health services': 'Spanish Health/mental health services', + 'Housing assistance': 'Spanish Housing assistance', + 'Immigrant advocacy': 'Spanish Immigrant advocacy', + 'Immigrant focused youth programs': 'Spanish Immigrant focused youth programs', + 'Job readiness': 'Spanish Job readiness', + 'Legal services': 'Spanish Legal services', + 'Refugee/asylee services': 'Spanish Refugee/asylee services', + 'Victim/witness support': 'Spanish Victim/witness support', +}; diff --git a/src/i18n/i18n.js b/src/i18n/i18n.js new file mode 100644 index 0000000..f19df52 --- /dev/null +++ b/src/i18n/i18n.js @@ -0,0 +1,32 @@ + +import en from './en-us'; +import es from './es'; +// import ch from './ch'; +// import vi from './vi'; +// import ru from './ru'; +// import fr from './fr'; + +let i18n = { + i18n: { + header: 'inside', + enabled: true, + refinePanel: true, + expandCollapseTitle: true, + footer: true, + data: { + locale: 'en-US', + messages: { + 'en-US': en, + es: es, + // ch: ch, + // vi: vi, + // ru: ru, + // fr: fr, + }, + }, + }, +}; + +// console.log('injury prevention i18n.js, i18n:', i18n); + +export default i18n; diff --git a/src/main.js b/src/main.js index b8c82a0..9b3bee6 100644 --- a/src/main.js +++ b/src/main.js @@ -5,7 +5,6 @@ // (we might not need to use axios with new vue async tools) // if that is not needed, we can move this info to main.js - // turn off console logging in production if (process.env.NODE_ENV === 'production') { console.log = console.info = console.debug = console.error = function () {}; @@ -33,12 +32,15 @@ const customComps = { 'customGreeting': customGreeting, }; +import i18n from './i18n/i18n'; +console.log('main.js i18n:', i18n); pinboard({ publicPath: process.env.VUE_APP_PUBLICPATH, + i18n: i18n.i18n, app: { - title: 'Resources for immigrants', - subtitle: 'Find services and support for immigrants in Philadelphia', + // title: 'Resources for immigrants', + // subtitle: 'Find services and support for immigrants in Philadelphia', logoSrc: require('@/assets/oia-logo.png'), logoAlt: 'Office of Immigrant Affairs, City of Philadelphia', type: 'immigrant',