News for hackers. Stuff that matters.
Re:Ask HN: Screenshot Saturday by cj on Saturday April 26, 2014 @06:14PM (#7652955)
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

Re:Ask HN: Screenshot Saturday by andrewlouis93 on Saturday April 26, 2014 @06:18PM (#7652971)
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?
Re:Ask HN: Screenshot Saturday by cj on Saturday April 26, 2014 @07:04PM (#7653085)
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 :) [email protected]

Re:Ask HN: Screenshot Saturday by gbog on Saturday April 26, 2014 @08:00PM (#7653249)
Can't check your site because I'm on a phone. I would interested to know how you solve this issue.
Re:Ask HN: Screenshot Saturday by tluyben2 on Saturday April 26, 2014 @06:50PM (#7653058)
Very nice work. Definitely something we'll be using.
Re:Ask HN: Screenshot Saturday by arthurk on Sunday April 27, 2014 @03:40AM (#7654300)
this looks very nice! is it possible to translate messages that only show in specific use-cases (for example error messages)?
Re:Ask HN: Screenshot Saturday by cj on Sunday April 27, 2014 @06:46PM (#7657309)
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!');