Welcome to zerokspot.com, the personal website of Horst Gutmann.

Archive for l10n

  • l10n.js: Localise your JavaScripts

    Thanks to a recent article on Ajaxian I just stumbled upon l10n.js, a thin localisation library for JavaScript that build upon the language's native String.toLocaleString() method. Because of this, it gracefully degrades it either the library itself is not available and also if the string to be localised can't be found in a localised form.

    All you need is a localisation file (basically JSON) and the l10n.js library:

    
    <link rel="localizations" href="/path/to/localizations.js"
        type="application/x-i10n+json" />
    <script type="text/javascript" src="/path/to/l10n.js"></script>
    <script type="text/javascript">
    alert("hello".toLocaleString());
    </script>
    

    This example uses one big file for all the localised "hello"s of the world. If you want to stick with one file per language, you can use the "hreflang" attribute with the link-tag.

    This looks like a really nice and clean approach to the whole localised JavaScript issue. One problem, that this solution doesn't handle, though, is variable-replacement. For this you still need some printf- or low-level templating implementation.

    [via ajaxian.com]

    2010/05/16 at 19:04:46

    comments

  • localflavor für Österreich in Django

    Kleines Update für alle Österreicher, die Django benutzen. Seit letztem Wochenende gibt es jetzt endlich auch ein eigenes localflavor.at-Package (r8087, r8113). Zum aktuellen Zeitpunkt kommt es mit einer Select-Box für die neun Bundesländer, einem einfachen Formularfeld, das österreichische Postleitzahlen validiert, und einem Feld, das die hier gültigen Sozialversicherungsnummern akzeptiert, daher.

    Read more about "localflavor für Österreich in Django" ...

    2008/07/31 at 21:26:37

    comments

See all tags used for weblog posts