Skip to content
This repository has been archived by the owner on May 21, 2018. It is now read-only.

Add refined type support to I18n constructor #275

Merged
merged 3 commits into from Jul 15, 2017

Conversation

joshlemer
Copy link
Contributor

This supports the #274 by replacing usages of ClassTag[_] with TypeTag[_] which allows us to get the parents of the type, in the case of a refined Lang type such as En with Fr with De. For example, see this:

  val `Get both parent languages from a refined-type i18n` = test {
    val msg = I18n[En with Fr]("biscuit")
    (msg[En], msg[Fr])
  } returns (("biscuit", "biscuit"))

@propensive
Copy link
Owner

That looks great! Thanks! It was a few years ago I wrote I18n, and I'd have done it this way if I were writing it again, so thank you for doing something I would probably have never found the time to.

By the way, I'm still not sure it's good practice to get into the habit of defining the same string for two languages, but it would be something you would commonly want to do with variants of the same language, e.g. EN_GB and EN_US. It doesn't support that yet, but this is one step closer to making such a feature usable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants