Permalink
Browse files

Updated documentation for version 1.1.

  • Loading branch information...
1 parent dc75997 commit 57255b32881965a399d1fd897083fd151f4412eb @huljas committed May 16, 2011
Showing with 31 additions and 6 deletions.
  1. +15 −3 README.md
  2. +16 −3 documentation/manual/home.textile
View
@@ -3,7 +3,7 @@ Play Messages Module
This module gives you a tool in @messages for localizing your application.
-Tested with play 1.1 on windows and linux.
+Tested with play 1.1 and 1.2 on windows and linux.
## Features
- Web based tool for localizing your application
@@ -14,14 +14,18 @@ Tested with play 1.1 on windows and linux.
- Keep list for keys that are should be treated as normal keys although they are not found in the sources
- Add new keys if needed
- Remove existing keys
-- Localizations are saved in alphabetical order in your application's messages files
+- Localizations are saved in alphabetical order in your application's messages file
## Usage
-Add the module to your application `application.conf`
+Play 1.1: Add the module to your application `application.conf`
module.messages=[path to module]
+Play 1.2: Add the module to your `dependencies.yml`
+
+ - play -> messages 1.1
+
Add the module to the `routes`
* / module:play-messages
@@ -30,5 +34,13 @@ Start your application and access the tool in @messages:
http://localhost:9000/@messages
+You can specify the source folders the tool scans in the `application.conf`, for example
+
+ messages.srcDir=app,public/javascripts
+
+if you want to include localizations in your javascripts. Default value for this property is `app`.
+
+
+
@@ -24,9 +24,22 @@ h2. New in version 1.1
h2. Message keys lookup
-The tool will use simple regexp to look for localization keys in the application sources. The default path used is **app**, but this can be configured with a property.
-
-The lookup will work in most cases, but it cannot of course find generated localization keys. For example consider the following code
+The tool will use simple regexp to look for localization keys in the application sources. The default path used is **app**, but this can be configured with the property **messages.srcDir**. The lookup uses regexp to scan the source files and finds the following patterns:
+bc. // localization in java
+Messages.get("keyname");
+// localization with arguments
+Messages.get("keyname", paramA, paramB);
+// validation error message
+Validation.addError("fieldName", "keyname", param1, param2);
+*{ localization in template }*
+&{'keyname', param1, param2}
+*{ template localization inside a tag }*
+%{ name = messages.get("keyname"); name2 = messages.get('keyname2'); }%
+*{ javascript localization with i18n }*
+#{i18n /}
+<script>alert(i18n('keyname'));</script>
+
+The lookup will work in most cases, but it cannot of course find the right value for generated localization keys. For example consider the following code
bc. UserType type = UserType.ADMIN;
String localizedString = Messages.get("user.type." + userType.name().toLowerCase());

0 comments on commit 57255b3

Please sign in to comment.