Git Product home page Git Product logo

scalingua's Introduction

Scalingua Build Status Latest version Join the chat at https://gitter.im/makkarpov/scalingua

Have you ever wondered that there is no gettext-like library for Scala? Scalingua is here to fix it! It comes with lightweight runtime library and full-featured compile-time macros and SBT plugin that will combine the powers of gettext and Scala in a single library.

Scalingua consists of four modules:

  • core — a minimal runtime components for internationalization. It's very lightweight (~ 30 kB) and provides basic functions like loading precompiled translations.
  • scalingua itself — library with macros that have these features:
    • String interpolator that makes internationalization of strings as easy as writing one letter before them;
    • Plural string interpolator that adds plural suffixes for you;
    • Macros for strings with contexts (msgctxt) and plural strings;
    • Macros leaves no dependency on scalingua library — you can include it in provided scope and it will not break anything;
    • Macros will extract all your strings to separate *.pot file every compilation run and keep this file up-to-date with during incremental compilation;
    • You can translate more complex formats like HTML — all placeholders will be escaped, so no XSS attacks are possible;
    • You can re-use existing macros from this library to implement custom translation utilities (e.g. create th interpolator that will translate HTML) or move I18n method to your Utils object, but in this case you will have dependency on scalingua
  • scalingua-sbt — SBT plugin with small but important task:
    • Automatically sets compiler parameters so you don't have to remember them;
    • Parses *.po files and compiles them to efficient binary files and Scala classes.
  • scalingua-play — Integration module for Play framework:
    • Dependency injection bindings to summon Messages through DI;
    • HTML output format with ready to use functions and interpolators;
    • Extraction of visitor language from request headers.

Getting started

scalingua's People

Contributors

makkarpov avatar

Watchers

Dave Whittaker avatar James Cloos avatar Jason Cernansky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.