Translated Running Page into Spanish #1137
irvingbennett
started this conversation in
Show and tell
Replies: 1 comment
|
amazing I think its fine we add Spanish and PR welcome |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
https://running-page.irving-d46.workers.dev/
I will later add it to my domain as https://alairelibre.net/running-page. I liked the dashboard theme very much since I saw it. So I added a map for my country (Panama) and I added language "es" to i18n.tsx. Then translated all the strings that were there. Instantly the page changed into Spanish when clicking the "es" button. It now toggles English, Spanish and Chinese. Later I saw some texts that were still in English. So I hunted them down and most where hardcoded this way:
`{/* Latest Activity */}
{latest && (
{locale === 'zh' ? 'ζθΏζ΄»ε¨' : 'Latest Activity'}
...`
And this was replaced with:
`{/* Latest Activity */}
{latest && (
{t('latestActivity')}
...`
That was done after adding this to i18n.tsx:
`export type Locale = 'zh' | 'en' | 'es';
export const messages: Record<Locale, Record<string, string>> = {
zh: {
// ... existing keys
latestActivity: 'ζθΏζ΄»ε¨',
},
en: {
// ... existing keys
latestActivity: 'Latest Activity',
},
es: {
// ... existing keys
latestActivity: 'Γltima Actividad',
},
};`
This was done for most of the hard coded lables: add them to i18s.tsx and replace them with the {t('translation')}. The changes were really not that large. They would be very easy to add to the master branch.
Adding the Panama Map required a PanamaMap.tsx, PanamaMap.json, and Panama-Provincias.geojson. With those three files and some replacements in the right places the map show up beautifully and the tracks got added to the province count. You guys made the job fairly achievable. At some future point we could add a map preference so the map can be added for different countries.
All reactions