georgeosddev / play-xgettext

Scala 2.10/2.11 compiler plugin that acts like GNU xgettext command to extract i18n strings from PlayFramework project's Scala source code and twirl templates files to message file

Version Matrix

i18n messages extractor for PlayFramework

This project is forked from xitrum-framework/scala-xgettext.

This plugin extract Internationalized message keys from scala source codes and twirl templates where play.api.i18n.Messages is used in your PlayFramework project.

Demo

Demo

Usage

Add to application's build.sbt

autoCompilerPlugins := true

addCompilerPlugin("com.github.georgeosddev" %% "play-xgettext" % "0.1")

// If you don't need comment about scala code line
// scalacOptions += "-P:play-xgettext:hideLines"

Create empty messages.default to project root

cd Your_PlayFramework_Project_Root
rm -rf ./messages.default
touch messages.default

Compile project

activator clean compile

All keys used with play.api.i18n.Messages in your project will be extracted into messages.default. And then you can copy it to your internationalized message file like conf/messages.ja