Skip to content

Commit

Permalink
Add type alias LString to LValue[String]
Browse files Browse the repository at this point in the history
  • Loading branch information
makkarpov committed Apr 14, 2016
1 parent 94e4a85 commit f5e0e9f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scalingua/src/main/scala/ru/makkarpov/scalingua/I18n.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,41 @@ package ru.makkarpov.scalingua
import scala.language.experimental.macros

object I18n {
type LString = LValue[String]

implicit class StringInterpolator(val sc: StringContext) extends AnyVal {
def t(args: Any*)(implicit lang: Language, outputFormat: OutputFormat[String]): String =
macro Macros.interpolate[String]

def lt(args: Any*)(implicit outputFormat: OutputFormat[String]): LValue[String] =
def lt(args: Any*)(implicit outputFormat: OutputFormat[String]): LString =
macro Macros.lazyInterpolate[String]
}

def t(msg: String, args: (String, Any)*)(implicit lang: Language, outputFormat: OutputFormat[String]): String =
macro Macros.singular[String]

def lt(msg: String, args: (String, Any)*)(implicit outputFormat: OutputFormat[String]): LValue[String] =
def lt(msg: String, args: (String, Any)*)(implicit outputFormat: OutputFormat[String]): LString =
macro Macros.lazySingular[String]

def tc(ctx: String, msg: String, args: (String, Any)*)(implicit lang: Language, outputFormat: OutputFormat[String]): String =
macro Macros.singularCtx[String]

def ltc(ctx: String, msg: String, args: (String, Any)*)(implicit outputFormat: OutputFormat[String]): LValue[String] =
def ltc(ctx: String, msg: String, args: (String, Any)*)(implicit outputFormat: OutputFormat[String]): LString =
macro Macros.lazySingularCtx[String]

def p(msg: String, msgPlural: String, n: Long, args: (String, Any)*)
(implicit lang: Language, outputFormat: OutputFormat[String]): String =
macro Macros.plural[String]

def lp(msg: String, msgPlural: String, n: Long, args: (String, Any)*)
(implicit outputFormat: OutputFormat[String]): LValue[String] =
(implicit outputFormat: OutputFormat[String]): LString =
macro Macros.lazyPlural[String]

def pc(ctx: String, msg: String, msgPlural: String, n: Long, args: (String, Any)*)
(implicit lang: Language, outputFormat: OutputFormat[String]): String =
macro Macros.pluralCtx[String]

def lpc(ctx: String, msg: String, msgPlural: String, n: Long, args: (String, Any)*)
(implicit outputFormat: OutputFormat[String]): LValue[String] =
(implicit outputFormat: OutputFormat[String]): LString =
macro Macros.lazyPluralCtx[String]
}

0 comments on commit f5e0e9f

Please sign in to comment.