All Projects → loctools → go-l10n

loctools / go-l10n

Licence: MIT license
Lightweight yet powerful continuous localization solution for Go, based on Serge and Plurr.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-l10n

Weblate
Web based localization tool with tight version control integration.
Stars: ✭ 2,719 (+8396.88%)
Mutual labels:  localization, l10n, continuous-localization
serge-plugins
Serge (Continuous localization platform https://serge.io/) Plugins
Stars: ✭ 17 (-46.87%)
Mutual labels:  localization, continuous-localization, serge
lioness
🐯 A React library for efficiently implementing Gettext localization
Stars: ✭ 29 (-9.37%)
Mutual labels:  localization, l10n
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (+290.63%)
Mutual labels:  localization, l10n
Es2015 I18n Tag
ES2015 template literal tag for i18n and l10n (translation and internationalization)
Stars: ✭ 171 (+434.38%)
Mutual labels:  localization, l10n
i18n-literally
🍦 A simple way to introduce internationalization to your JS
Stars: ✭ 80 (+150%)
Mutual labels:  localization, l10n
Keys Translations Manager
KTM, a locale management web app built on MERN stack, lets you manage and control locales in one place. It's particularly useful for someone who needs to manage multiple internationalization/localization projects.
Stars: ✭ 81 (+153.13%)
Mutual labels:  localization, l10n
Google Play Badge Svg
Hosting for localized versions of Google Play badges in SVG format.
Stars: ✭ 137 (+328.13%)
Mutual labels:  localization, l10n
Localize React
✈️ Lightweight React Localization Library 🇺🇸
Stars: ✭ 52 (+62.5%)
Mutual labels:  localization, l10n
L10n Swift
Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Stars: ✭ 177 (+453.13%)
Mutual labels:  localization, l10n
Omegat
Mirror of official OmegaT repo
Stars: ✭ 210 (+556.25%)
Mutual labels:  localization, l10n
Locale2
💪 Try as hard as possible to detect the client's language tag ("locale") in node or the browser. Browserify and Webpack friendly!
Stars: ✭ 65 (+103.13%)
Mutual labels:  localization, l10n
Redux React I18n
An i18n solution for React/Redux and React Native projects
Stars: ✭ 64 (+100%)
Mutual labels:  localization, l10n
Pseudo Localization
Dynamic pseudo-localization in the browser and nodejs
Stars: ✭ 109 (+240.63%)
Mutual labels:  localization, l10n
Zing
Translation server for continuous localization.
Stars: ✭ 55 (+71.88%)
Mutual labels:  localization, l10n
Punic
PHP translation and localization made easy!
Stars: ✭ 133 (+315.63%)
Mutual labels:  localization, l10n
React Native Globalize
Internationalization (i18n) for React Native
Stars: ✭ 246 (+668.75%)
Mutual labels:  localization, l10n
Fluent.js
JavaScript implementation of Project Fluent
Stars: ✭ 622 (+1843.75%)
Mutual labels:  localization, l10n
Fluent
Fluent — planning, spec and documentation
Stars: ✭ 818 (+2456.25%)
Mutual labels:  localization, l10n
Node Gettext
A JavaScript implementation of gettext, a localization framework.
Stars: ✭ 175 (+446.88%)
Mutual labels:  localization, l10n

About go-l10n

Lightweight yet powerful continuous localization solution for Go, based on Serge and Plurr.

Advantages

  1. Provides solution for both web-based and desktop applications.

  2. Can be used with different resource file formats, thanks to Serge. Currently offers the support for JSON resource files and string maps in the native .go format. Both formats support developer comments for translators to get extra context.

  3. Supports named placeholders, plurals and conditionals via Plurr-formatted strings (see the interactive demo).

  4. Support for translation and formatting functions in html/template and text/template.

  5. For web applications, an ability to auto-detect the best language from the browser, and to force the language using a cookie or a query string parameter.

  6. Comes with ready-to-use Serge configuration files to allow for seamless continuous localization process (see examples).

  7. Supports pseudotranslations out of the box. Pseudotranslation is a way to "translate" your application by applying some algorithm to each source string; it is useful to test if your application looks good with other locales without waiting for actual translations.

  8. The code is split into small packages to minimize external dependencies.

Example Code

There are two example projects that showcase approaches to localizing web applications and desktop applications. Below is a condensed example to illustrate the typical usage.

strings.go (master resource file):

package main

func init() {
    locpool.Resources["en"] = map[string]string{
        // Page title
        "Hello": "Hello!",

        // {N} is the number of messages
        "YouHaveNMessages": "You have {N} {N_PLURAL:message|messages}",
    }
}

strings-ru.go (localized resource file):

package main

func init() {
    locpool.Resources["ru"] = map[string]string{
        // Page title
        "Hello": "Здравствуйте!",

        // {N} is the number of messages
        "YouHaveNMessages": "У вас {N} {N_PLURAL:сообщение|сообщения|сообщений}",
    }
}

Code:

package main

import (
    "github.com/iafan/Plurr/go/plurr"
    "github.com/iafan/go-l10n/loc"
)

// Create a global localization pool which will be populated
// by resource files; use English as a default (fallback) language
var locpool = loc.NewPool("en")

func main() {
  // Get Russian localization context
  lc := locpool.GetContext("ru")

  // Get translation by key name:
  name := lc.Tr("Hello")

  // get translation by key name, then format it using Plurr:
  hello := lc.Format("YouHaveNMessages", plurr.Params{"N": 5})

  ...
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].