This is my Blog.

It's full of opinions on a wide range of stuff.

Native2Ascii plugin for SBT

As I have been doing quite a lot of localisation work recently, I thought it prudent to port the native2ascii tool over to SBT so that I didn't constantly have to keep using it manually on the command line. If you are interested, you can grab the source code from here

If order to get started with the plugin add it to your Plugins.scala within your project:

  import sbt._
  class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
    val n2a = "eu.getintheloop" % "sbt-native2ascii-plugin" % "0.1.0" 
  }

...and then mix the Native2Ascii trait into your project:

      class SampleProject(info: ProjectInfo) 
    extends DefaultWebProject(info) 
    with Native2AsciiPlugin {
    ...
  }
</code>

Ensure you have all your localization .txt files in src/main/i18n and by default they will be translated into your application resources folder in src/main/resources.

Then, from your SBT prompt just hit:

`

native2ascii `

All being well you should then see something like:

      [info] == native2ascii ==
  [info] Encoding '.txt' to '.properties' file(s) in src/main/resources
  [info] Translation complete.
  [info] == native2ascii ==
</code>
blog comments powered by Disqus