Skip to content

Commit

Permalink
fix: update strings to work with i18next 24 (#2552)
Browse files Browse the repository at this point in the history
* fix: change lng to long for compatibility with i18next 24

* fix: update localeString calls

* build: update i18next to 24.0.2
  • Loading branch information
paulschreiber authored Nov 26, 2024
1 parent 87b8ace commit 9701a40
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dev-client/locales/po/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ msgid "site##your_location"
msgstr "Your location"

msgid "site##coords"
msgstr "{{lat}}, {{lng}}"
msgstr "{{lat}}, {{long}}"

msgid "site##soil_id_prediction"
msgstr "Soil ID Top Match"
Expand Down
2 changes: 1 addition & 1 deletion dev-client/locales/po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ msgid "site##members"
msgstr "{{members}} Miembros"

msgid "site##coords"
msgstr "{{lat}}, {{lng}}"
msgstr "{{lat}}, {{long}}"

msgid "site##empty##info"
msgstr ""
Expand Down
8 changes: 4 additions & 4 deletions dev-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"expo-web-browser": "~13.0.3",
"formik": "^2.4.6",
"haversine": "^1.1.1",
"i18next": "^24.0.0",
"i18next": "^24.0.2",
"intl-pluralrules": "^2.0.1",
"jpeg-js": "^0.4.4",
"munsell": "^1.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const LatLngDetail = ({isCurrentLocation, coords}: Props) => {
<Text variant="body2">
{t('site.coords', {
lat: formatCoordinate(coords.latitude),
lng: formatCoordinate(coords.longitude),
long: formatCoordinate(coords.longitude),
})}
</Text>
{isCurrentLocation && (
Expand Down
2 changes: 1 addition & 1 deletion dev-client/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"members": "{{members}} Members",
"more_info": "Learn more",
"your_location": "Your location",
"coords": "{{lat}}, {{lng}}",
"coords": "{{lat}}, {{long}}",
"soil_id_prediction": "Soil ID Top Match",
"ecological_site_prediction": "Ecological Site Top Match",
"annual_precip_avg": "Annual precipitation avg",
Expand Down
2 changes: 1 addition & 1 deletion dev-client/src/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"site": {
"progress": "Progreso: {{progress}}",
"members": "{{members}} Miembros",
"coords": "{{lat}}, {{lng}}",
"coords": "{{lat}}, {{long}}",
"empty": {
"info": "No tiene aún ningún sitio. Un sitio te permite recopilar y guardar datos, aprender más sobre tu suelo y su potencial, y compartir con otros.\n\n<bold>Utiliza el mapa para crear un sitio.</bold> Hay tres formas de utilizar el mapa para encontrar una ubicación para un sitio:",
"bullet_1": "Toca el mapa para marcar una ubicación y obtener más imformacion acerca del lugar.",
Expand Down
8 changes: 6 additions & 2 deletions dev-client/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ export const formatDate = (dateString: string) => {
};

export const formatPercent = (value: number) => {
return value.toLocaleString(undefined, {style: 'percent'});
const locale = getSystemLocale();

return value.toLocaleString(locale, {style: 'percent'});
};

export const formatCoordinate = (value: number) => {
return value.toLocaleString(undefined, {
const locale = getSystemLocale();

return value.toLocaleString(locale, {
maximumFractionDigits: COORDINATE_PRECISION,
});
};
Expand Down

0 comments on commit 9701a40

Please sign in to comment.