Skip to content

sergerehem/gaelyk-i18n-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gaelyk i18n Plugin

The plugin implements an easy way to work with Java Properties files in your Gaelyk application. It's also very useful to work with internationalization. The plugin was successfuly tested with Gaelyk version 1.2.

Installation

To use the plugin just donwload the gaelyk-i18n-plugin-0.2.jar and put it in your WEB-INF/lib/ folder in your Gaelyk application extract the distribution into your project directory.

14/06/2012 13:23:44 gaelyk.plugins.I18nPlugin
INFO: Gaelyk i18n Plugin Registered!
14/06/2012 13:23:44 gaelyk.plugins.I18nPlugin
INFO: Using Config file: true.

Usage

After installing the plugin you will be able to use the i18n global variable inside your templates (.gtpl) ou Groovlets (.groovy) to obtain entry values in your .properties files, in various forms. Example:

message.properties

title="Page Title"
plugin="Gaelyk i18n Plugin"
url="http://github.com/sergerehem/gaelyk-i18n-plugin"
congrats="Congratulations {0}! Your plugin is running!"

sample.gtpl

 <html>
   <head><title>$i18.title</title>
   <body>
     <h1>$i18n['plugin']</h1>
     <a href="${i18n.getProperty('url')}"/>
     <p>${i18.congrats('Serge'}</p>
   </bodu>
</html>

You can change locale manually using session "locale' attribute

If session does not contain locale attribute, the plugin always using the request locale

The plugin searches properties file in the standard i18n order - if the locale is "he_IL" it will first look for "messages_he_IL.properties", if it does not exists will search for "messages_he.properties" and then for "messages.properties"

You can copy samples files to your Gaelyk app from here.

Configuration

The plugin uses the convention over configuration concept, so you can just put your messages.properties file in the WEB-INF/i18n folder

You can also create a i18nConfig.groovy file in WEB-INF/ folder and configure those optional variables:

  • basePath: the base path for your .properties files. Default is "WEB-INF/i18n".
  • baseName: the base name for your .properties files. Default is "messages".
  • messagesEncoding: by default is used the server operationg system encoding

TIP: After version upgrade, clean your memcache using app engine console

About

Gaelyk i18n Plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published