Skip to content

Instantly share code, notes, and snippets.

@propensive
Created April 12, 2015 08:21
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save propensive/ab862f2e77d3ba2bd39a to your computer and use it in GitHub Desktop.
Save propensive/ab862f2e77d3ba2bd39a to your computer and use it in GitHub Desktop.
Welcome to Scala version 2.10.5 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import rapture.i18n._
import rapture.i18n._
scala> type IString = I18n[String, En with Fr with De with Pl with La] // English, French, German, Polish, Latin
defined type alias IString
scala> val msg: IString = en"Hello, world!"
<console>:11: error: Some language translations were not provided: fr, la, de, pl
val msg: IString = en"Hello, world!"
^
scala> import rapture.translate._
import rapture.translate._
scala> val msg: IString = en"Hello, world!"
<console>:14: error: Not all required language translations have been provided. Consider appending the following translations to the expression:
| fr"Bonjour le monde!" | la"Salve, mundi!" | de"Hallo Welt!" | pl"Witaj świecie!"
val msg: IString = en"Hello, world!"
^
scala> val msg: IString = en"Hello, world!" | fr"Bonjour le monde!" | la"Salve, mundi!" | de"Hallo Welt!" | pl"Witaj świecie!"
msg: IString = fr|la|de|en|pl:Hello, world!
scala> msg[De]
res0: String = Hallo Welt!
scala> msg[La]
res1: String = Salve, mundi!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment