Hacker News new | ask | show | jobs
by rjst01 486 days ago
> When I first ran into this issue back in 2017, I posted in the React issue tracker that I had ”fixed” my app by blocking translation entirely.

Please do not do this! In almost every instance I've encountered severe Translate-related broken-ness, it's still worked well enough to get me a snapshot of the current page translated. Fighting through this is still less cumbersome than the alternatives.

> The only alternative solution that I can think of, is to implement your own localization within your app (i.e. internationalization)

I will add, please make sure that language is an independent setting, and not derived from locale! I sometimes have to use translate on sites that have my preferred language available, but won't show it to me because it's tied to locale and that changes other things that I don't want, like currency.

On one such site I used a browser extension to rewrite the request for the language strings file.

4 comments

> I will add, please make sure that language is an independent setting, and not derived from locale!

Websites already have exactly what they need to provide you with the language you want via the Accept-Language header your browser sends. In your browser's settings you can configure a list of languages (country-specific if desired) which get send with every request.

E.g.,:

    en-GB
    en
    nl
(Prefer British English, fall back to any English, and if not available either use Dutch.)

This is already entirely separate from your OS locale! Although it will default to filling it in with that locale's language if you don't configure it yourself of course.

This should be the primary way to decide upon a language, but in addition to that offering a way to switch languages for a specific site on that site itself is a user-friendly gesture appreciated by many.

This is not true. E.g., Safari is tied to the OS settings, Firefox has some dependencies regarding the locale of the first install, etc…

Moreover, probably most people speak or can read more than a single language. There may be reasons for accessing a site in a particular language other than the standard locale.

Please empower users to make their own choice! Do not assume to know better.

For example, when the translation is shit and you prefer to use the English one because the one in your language is impossible to understand.
This does not help in many many situations.

I am a Hongkonger, natively speaks Cantonese, fluent in English and learning Japanese.

If I go to Google I want English UI and prioritise traditional Chinese result then English then simplified Chinese.

On the other hand if I go to a Japanese website, I don’t want them to translate for me, just display the original Japanese will be fine. Unless I toggle.

These kind of complex setup can never be achieved if we don’t have a per site locale policy. And seriously. A toggle per site is easier than navigate three level deep into browser setting page.

> A toggle per site is easier than navigate three level deep into browser setting page.

I don't disagree with your overall point, that flexibility is useful for website visitors, but your statements requires asking the question: "easier for whom?"

Certainly relying on Accept-Language is significantly easier for the website maintainer. And overall it would be a lot easier if the small handful of web browser maintainers added saner settings (even a per-website Accept-Language toggle), than if we were to require the thousands (tens of thousands? millions?) of multi-language website developers to provide their own toggle. Not to mention having a standardized way to do manage this would be better for users than having to discover each website's language toggle UI.

But sure, we don't have those easy-to-use browser settings, so it's (unfortunately) up to every website developer to solve this problem, over and over and over.

(As an aside, it would be cool if websites could return a hypothetically-standardized Available-Languages header in their responses so browsers could display the appropriate per-website UI, with only the supported languages.)

The problem is when you understand multiple languages.

If a website is made by an English speaking team, as I understand English I'd like it to be English first and not a possibly broken French version. If a website is developed with French language first I'd like to have it in French and not a second-rate English translation.

> In your browser's settings you can configure a list of languages (country-specific if desired) which get send with every request.

Customising this list at all makes your browser fingerprint thousands of times less common than it was before you did this, and many websites you visit could then probably uniquely identify you as the same user across all of your sessions.

That and a thousand other things. A highly privacy focussed browser could offer to enable this setting only on whitelisted websites (and send 'en' plus a bunch of random language codes on others).
> 'en' plus a bunch of random language codes

This is an easier fingerprint signal than just not sending anything.

Not if the random part of the list changes with each request.

There are two ways to defeat fingerprinting: 1) make everyone look exactly the same (pretty difficult to do), or 2) introduce enough noise and randomness to fingerprinting signals to each request so that each person looks like many different people (much easier to do).

> This should be the primary way to decide upon a language

Google developers are very intelligent, but not intelligent enough to understand this.

They probably understand it just fine. Someone higher-up has just over-ruled them. There may even be a good reason for it, but because of the way companies work, we will probably never find out what it is.
Almost no website uses this, even big ones like Google who insist on showing me pages in German rather than English or French.
On the other hand, sometime the ads that are shown are in German. Easier to mentally filter out.
> that changes other things that I don't want, like currency.

Oh god Google is so bad at this. They don't even let me change the currency in many cases when looking at hotels (yes on the website; not in the Google Maps app)

Google is so ridiculously bad at this, when an account that only ever uses English is explicitly asking for English search results, but happens to be located in Thailand, it will give you English results, but use the Thai calendar to display years, which is 543 years ahead of the Gregorian calendar. Are there any people at all who expect to read English text but expect to see the year 2568 instead of the year 2025, when no part of their system or account is configured for Thai?
I'd have no issue leaving translation enabled, if the translator was an optional feature that the user must opt-in to, and that's clearly communicated as something not controlled by the developer.

But I've received reports from Edge-users that didn't even know translation was enabled.

Yeah, I agree that's problematic. And I would have no objection to implementing a UI feature that displayed a warning banner of some kind if it detected that the page had been translated.
When you say locale, you mean your current location, e.g. as detected by geoip?
A locale is a combination of several things, including a language, but not only.

E.g. I'm from portugal. I'm visiting an american site, which does not have professional portuguese translations, but does have auto-generated ones.

I don't like the auto-generated ones and can read english just fine, so I want to have the language set to english (en-US in this case).

However, I still want it to apply some locale-specific things from Portugal, e.g.:

- Units (Metric vs. Imperial vs. Whatever mess countries like the UK do)

- Date formatting (DD/MM/YYYY vs MM/DD/YYYY)

- Time formatting (AM/PM vs. 24hr clock)

- Currency formatting (10€ vs. 10 € vs. 10 EUR vs. €10)

- Number formatting (10,000.00 vs 10.000,00)

- When the week starts (Monday vs. Sunday)

If you take a look at the windows locale options, it mostly lets you mix-and-match whatever you want (which is great! Now if only the MS apps let me stop using the localized keyboard shortcuts...): https://learn.microsoft.com/en-us/globalization/locale/langu...

Locale I'm using as a shorthand for "the bundle of variables that your service or business needs to tweak between customers in different markets". It may determine things like currency, date/time or currency formatting, or relevant regulatory framework. My argument is that language should always be sett-able independently of the other variables locale controls.

For an example of a site that almost gets it right, see https://www.finnair.com/ . You are first prompted to set location, and then language. I say "almost" because although they will allow you to select English in any market, they won't allow you to select any offered language in any market.

In comparison, https://www.flysas.com/ you get one dropdown which sets market, currency, and language in one go.

Sometimes, but not always. Sometimes it is also based on the locales in your browser.
It means system/browser settings like the one available in navigator.language.