Hacker News new | ask | show | jobs
by cj 4439 days ago
http://i.imgur.com/KpULrEs.png

Localize.js, a javascript library for translating websites. It detects and translates text on your website, and provides a UI for ordering and managing translations.

Docs: https://localizejs.com/docs/usage/installation

3 comments

This is sick. I haven't looked into other website localizing solutions, but how is this approach better than what's currently being used in industry?
The traditional localization approach is very time intensive, and requires a large time commitment to implement properly. Localize.js automates most of the localization process, which lets you localize your site in ~10% of the time it would normally take.

The traditional way you'd localize a website is by replacing text in your template files with string keys. For example:

<h1>Hello world!</h1> .

becomes...

<h1>{{ t 'homepage.hello_world' }}</h1>

You'd then maintain dictionary files that maps "homepage.hello_world" to "Hello world!", with a separate dictionary for each language. Additional complications arise when you want to pluralize phrases, since different languages pluralize phrases differently, etc. It's a pain to setup an effective localization workflow using the traditional approach.

Localize.js handles all of this automatically, and removes the need to convert your template files or manage your own phrases and translations. If you're interested in trying it out, I'd love to get in touch :) bp@brandonpaton.com

Can't check your site because I'm on a phone. I would interested to know how you solve this issue.
Very nice work. Definitely something we'll be using.
this looks very nice! is it possible to translate messages that only show in specific use-cases (for example error messages)?
Yes! Localize.js watches the page for changes, and immediately translates text that is added to the page (like an error message).

You can also translate text manually, like this: Localize.translate('Hello!');