com.osinka.i18n

package com.osinka.i18n

Members list

Type members

Classlikes

case class Lang(locale: Locale)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Lang

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Lang.type
trait Localized[T]

An entity's preferred language.

An entity's preferred language.

A convenient type class to represent a preferred language of a user or session or whatever.

Use it in the companion object:

case class User(id: Int, lang: Lang)

object User {
 implicit object localized extends Localized[User] {
   override def locale(user: User) = user.lang
 }
}

Attributes

See also
Companion
object
Supertypes
class Object
trait Matchable
class Any
object Localized

Provides a helper for "localized" objects.

Provides a helper for "localized" objects.

For example, for Messages:

Localized(user) { implicit lang =>
 Messages("error")
}

Attributes

See also
Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Localized.type
trait Messages

Messages externalization

Messages externalization

== Overview == You would use it like so:

Localized(user) { implicit lang =>
 val error = Messages("error")
}

Messages are stored in messages_XXX.txt files in UTF-8 encoding in resources. The lookup will fallback to default file messages.txt if the string is not found in the language-specific file.

Messages are formatted with java.text.MessageFormat.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Messages
object Messages extends Messages

Attributes

Companion
trait
Supertypes
trait Messages
class Object
trait Matchable
class Any
Self type
Messages.type