Live data from Hacker News

Everything about Google Translate crashing React (and other web apps)

martijnhols.nl

31–40 of 88 posts

Re: Everything about Google Translate crashing React (and other web apps)

#31

Therefore, I prefer svelte (besides superior ergonomics & web-standards compliance): It's not a framework, but a compiler that outputs only pure JS. Svelte simply has no virtual DOM that can be messed up. Just Simplicity & efficiency.

You are confused about the issue, and the OP does its part in contributing to the confusion. It's not a VDOM issue, it's not React exclusive (that part the post is explicit about) and indeed Svelte is affected as well: https://github.com/sveltejs/svelte/issues/15090

When seeing issues like this one pop up with React in the title, one should really have a good think whether this is solved principally different in other fws OR, and this should be the null hypothesis, is React in the title because it is more widely used than all the others combined

Re: Everything about Google Translate crashing React (and other web apps)

#32
post #8

> 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 alternat…

> 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.

Re: Everything about Google Translate crashing React (and other web apps)

#33
post #8

> 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 alternat…

> 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 ba…

> 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.

Re: Everything about Google Translate crashing React (and other web apps)

#34

Therefore, I prefer svelte (besides superior ergonomics & web-standards compliance): It's not a framework, but a compiler that outputs only pure JS. Svelte simply has no virtual DOM that can be messed up. Just Simplicity & efficiency.

Svelte breaks just the same...

Go, get down off your high horse and try it yourself, finish the counter in their tutorial, put a console log in the handler, and translate the page to French...

C'est tres borked.

Re: Everything about Google Translate crashing React (and other web apps)

#35
post #4

Another solution would be a React-native machine translation implementation that updates the TextNodes without replacing them. It would still have the issues of merging adjacent nodes to get a proper translation, but at least it could update on any state change.

One idea that crossed my mind while reading the article: for websites that already use react-intl, have react-intl implement an API to allow supplying machine translations of messages into languages otherwise not supported by the app. The problem with this is that it will only help sites that already put in effort to internationalization. Whereas the main target of Google translate are the sites that do not bother wi…

that requires google to care about this issue

Re: Everything about Google Translate crashing React (and other web apps)

#36

Therefore, I prefer svelte (besides superior ergonomics & web-standards compliance): It's not a framework, but a compiler that outputs only pure JS. Svelte simply has no virtual DOM that can be messed up. Just Simplicity & efficiency.

[flagged]

Re: Everything about Google Translate crashing React (and other web apps)

#37
post #8

> 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 alternat…

When you say locale, you mean your current location, e.g. as detected by geoip?

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.

Re: Everything about Google Translate crashing React (and other web apps)

#38
post #8

> 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 alternat…

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.

Re: Everything about Google Translate crashing React (and other web apps)

#39
post #8

> 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 alternat…

> 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 ba…

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

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

Post reply on HN