philfung / add-to-homescreen

Easily add a website to home screen on IOS/Android/Desktop
MIT License
125 stars 35 forks source link

"Add to Home Screen" doesn't change with locale #45

Closed claudiobosticco closed 5 days ago

claudiobosticco commented 1 week ago

Hello, on Android it seems that it's always using the "Add to Home Screen" value in English locale (or maybe the key?) when using locales different from en, for example with locale it:

2024-10-23 09 32 11

wss2 commented 1 week ago

Hi @claudiobosticco I can't set locale as IT where am I wrong? window.AddToHomeScreenInstance.show('it');

claudiobosticco commented 1 week ago

I must specify that I'm loading the it locale from https://cdn.jsdelivr.net/gh/philfung/add-to-homescreen@2.1/dist/add-to-homescreen_it.min.js, and in this file I see a mix of English and Italian messages 🤔

claudiobosticco commented 1 week ago

Sorry, I posted without noticing you reply. I don't know, that exact line of code is working for me 🤔 And now I've tried 'fr' and I see the same problem: image

claudiobosticco commented 1 week ago

I must specify that I'm loading the it locale from https://cdn.jsdelivr.net/gh/philfung/add-to-homescreen@2.1/dist/add-to-homescreen_it.min.js, and in this file I see a mix of English and Italian messages 🤔

but actually I don't see other messages in the wrong locale, just "Add to Home Screen"

wss2 commented 1 week ago

I must specify that I'm loading the it locale from https://cdn.jsdelivr.net/gh/philfung/add-to-homescreen@2.1/dist/add-to-homescreen_it.min.js, and in this file I see a mix of English and Italian messages 🤔

but actually I don't see other messages in the wrong locale, just "Add to Home Screen"

Done, I found the work around for both. In my case it was simple, I loaded the js without translation. In your case the translation is missing so I can tell you what I did. I downloaded the .min and copied to https://unminify.com/ to make it readable. Then I searched for and replaced "Add to home screen" with "Aggiungi alla Home" and then I used the file locally. I hope I have been helpful to you.

claudiobosticco commented 1 week ago

Okay, but no CDN then. Is it not possible to fix the hosted version?

philfung commented 5 days ago

@claudiobosticco thanks for highlighting this issue. It actually was caused by a bug in our build process where only the first string was translated and not every (minor fyi @shaneosullivan). Now fixed and made a new release.