[CONF] Apache Tapestry > Localization

2013-01-24 Thread confluence







Localization
Page edited by Bob Harner


Comment:
Added Polish to list of built-in locales


 Changes (6)
 




...
While your application can support any locale (and thus any language) that you want, Tapestry provides only a limited set of translations for its own built-in messages. As of Tapestry 5.3, the following locales have translations provided:  
| en (English)| es (Spanish)   | ja (Japanese)| ru (Russian) pt (Portuguese) | zh (Chinese)   | 
| bg (Bulgarian)  | fi (Finnish)   | mk (Macedonian)  | sr (Serbian) ru (Russian)|| 
| da (Danish) | fr (French)| nl (Dutch)   | sv (Swedish) sr (Serbian)|| 
| de (German) | hr (Croatian)  | no (Norwegian)   | vi (Vietnamese) sv (Swedish)|| 
| el (Greek)  | it (Italian)   | pt (Portuguese)  | zh (Chinese)   
| el (Greek)  | it (Italian)   | pl (Polish)  | vi (Vietnamese) || 
 h3. Providing translations for Tapestry built-in messages 
...


Full Content

Localization


Related Articles


 Page:
 Templating and Markup FAQ





 Page:
 Component Classes





 Page:
 Component Parameters





 Page:
 Localization




 

Localization (aka L10n) is all about getting the right text to the user, in the right language.

Localization support is well integrated into Tapestry. Tapestry allows you to easily separate the text you present to your users from the rest of your application ... pull it out of your Java code and even out of your component templates. You can then translate your messages into other languages and let Tapestry put everything together.

Component Message Catalogs

Each component class may have a component message catalog. A component message catalog is a set of files with the extension ".properties". These property files are the same format used by java.util.ResourceBundle, just lines of key=value. These files are stored on the classpath, in the same package folder as the page or component's compiled Java class.

So for a class named org.example.myapp.pages.MyPage, you would have a main properties file as org/example/myapp/pages/MyPage.properties.

If you have a translations of these values, you provide additional properties file, adding an ISO language code before the extension. Thus, if you have a French translation, you could create a file MyPage_fr.properties.

Any values in the more language specific file will override values from the main properties file. If you had an even more specific localization for just French as spoken in France, you could create MyPage_fr_FR.properties (that's a language code plus a country code, and you can even go further and add variants ... but its unlikely that you'll ever need to go beyond just language codes in practice).

The messages in the catalog are accessed by keys. Tapestry ignores the case of the keys when accessing messages in the catalog.

Component Message Catalog Inheritance

If a component class is a subclass of another component class, then it inherits that base class' message catalog. Its own message catalog extends and overrides the values inherited from the base class.

In this way, you could have a base component class that contained common messages, and extend or override those messages in subclasses (just as you would extend or override the methods of the base component class). This, of course, works for as many levels of inheritance as you care to support.

Application-wide Message Catalog

If the file WEB-INF/AppName.properties exists in the context, it will be used as an application-wide message catalog. The AppName is derived from the name of the filter inside the web.xml file; this is most often just "app", thus WEB-INF/app.properties. The search for the file is case sensitive. The properties files may be localized.

Individual pages and components can override the values defined in the message catalog.

Avoid BOMsMake sure that your properties files don't contain byte order marks (BOM), because Java – and thus Tapestry – doesn't support BOM

[jira] [Commented] (TAP5-2055) Polish translations

2013-01-24 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13561593#comment-13561593
 ] 

Hudson commented on TAP5-2055:
--

Integrated in tapestry-trunk-freestyle #1015 (See 
[https://builds.apache.org/job/tapestry-trunk-freestyle/1015/])
TAP5-2055 (Polish translations) (Revision 
5c650b92c943aea3763dcbe84e7630e08f389bcb)

 Result = FAILURE
bobharner : 
Files : 
* 
tapestry-kaptcha/src/main/resources/org/apache/tapestry5/kaptcha/tapestry-kaptcha_pl.properties
* tapestry-core/src/main/resources/org/apache/tapestry5/core_pl.properties


> Polish translations
> ---
>
> Key: TAP5-2055
> URL: https://issues.apache.org/jira/browse/TAP5-2055
> Project: Tapestry 5
>  Issue Type: New Feature
>  Components: tapestry-core
>Affects Versions: 5.3.6
>Reporter: Ryszard Trojnacki
>Assignee: Bob Harner
> Fix For: 5.3.7, 5.4
>
> Attachments: BeanEditForm_pl.properties, core_pl.properties, 
> core_pl.properties, DateField_pl.properties, Errors_pl.properties, 
> GridColumns_pl.properties, GridPager_pl.properties, Palette_pl.properties, 
> tapestry-kaptcha_pl.properties, ValidationMessages_pl.properties
>
>
> Polish translations

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Resolved] (TAP5-2055) Polish translations

2013-01-24 Thread Bob Harner (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bob Harner resolved TAP5-2055.
--

Resolution: Fixed

Polish translations added to both 5.3 and 5.4 branches. Thanks to Ryszard 
Trojnacki for these!

> Polish translations
> ---
>
> Key: TAP5-2055
> URL: https://issues.apache.org/jira/browse/TAP5-2055
> Project: Tapestry 5
>  Issue Type: New Feature
>  Components: tapestry-core
>Affects Versions: 5.3.6
>Reporter: Ryszard Trojnacki
>Assignee: Bob Harner
> Fix For: 5.3.7, 5.4
>
> Attachments: BeanEditForm_pl.properties, core_pl.properties, 
> core_pl.properties, DateField_pl.properties, Errors_pl.properties, 
> GridColumns_pl.properties, GridPager_pl.properties, Palette_pl.properties, 
> tapestry-kaptcha_pl.properties, ValidationMessages_pl.properties
>
>
> Polish translations

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (TAP5-2055) Polish translations

2013-01-24 Thread Bob Harner (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bob Harner updated TAP5-2055:
-

Fix Version/s: 5.4
   5.3.7

> Polish translations
> ---
>
> Key: TAP5-2055
> URL: https://issues.apache.org/jira/browse/TAP5-2055
> Project: Tapestry 5
>  Issue Type: New Feature
>  Components: tapestry-core
>Affects Versions: 5.3.6
>Reporter: Ryszard Trojnacki
>Assignee: Bob Harner
> Fix For: 5.3.7, 5.4
>
> Attachments: BeanEditForm_pl.properties, core_pl.properties, 
> core_pl.properties, DateField_pl.properties, Errors_pl.properties, 
> GridColumns_pl.properties, GridPager_pl.properties, Palette_pl.properties, 
> tapestry-kaptcha_pl.properties, ValidationMessages_pl.properties
>
>
> Polish translations

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


git commit: TAP5-2055 (Polish translations)

2013-01-24 Thread bobharner
Updated Branches:
  refs/heads/5.3 54b23c461 -> 52e8ad578


TAP5-2055 (Polish translations)

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/52e8ad57
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/52e8ad57
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/52e8ad57

Branch: refs/heads/5.3
Commit: 52e8ad578831bfbf78376e1bcd4962e4eef0125f
Parents: 54b23c4
Author: bharner 
Authored: Thu Jan 24 06:58:56 2013 -0500
Committer: bharner 
Committed: Thu Jan 24 06:58:56 2013 -0500

--
 .../corelib/components/BeanEditForm_pl.properties  |   16 +++
 .../corelib/components/DateField_pl.properties |   15 ++
 .../corelib/components/Errors_pl.properties|   15 ++
 .../corelib/components/GridColumns_pl.properties   |   17 
 .../corelib/components/GridPager_pl.properties |   15 ++
 .../corelib/components/Palette_pl.properties   |   21 +++
 .../kaptcha/tapestry-kaptcha_pl.properties |   17 
 7 files changed, 116 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/52e8ad57/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanEditForm_pl.properties
--
diff --git 
a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanEditForm_pl.properties
 
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanEditForm_pl.properties
new file mode 100644
index 000..f84a6d9
--- /dev/null
+++ 
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/BeanEditForm_pl.properties
@@ -0,0 +1,16 @@
+# Copyright 2007, 2011 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+submit-label=Utwórz/Aktualizuj
+cancel-label=Anuluj

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/52e8ad57/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/DateField_pl.properties
--
diff --git 
a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/DateField_pl.properties
 
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/DateField_pl.properties
new file mode 100644
index 000..d505f50
--- /dev/null
+++ 
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/DateField_pl.properties
@@ -0,0 +1,15 @@
+# Copyright 2009 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+date-value-not-parseable='%s' nie jest poprawnym zapisem daty.

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/52e8ad57/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Errors_pl.properties
--
diff --git 
a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Errors_pl.properties
 
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Errors_pl.properties
new file mode 100644
index 000..b26ee1e
--- /dev/null
+++ 
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Errors_pl.properties
@@ -0,0 +1,15 @@
+# Copyright 2006 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See

git commit: TAP5-2055 (Polish translations)

2013-01-24 Thread bobharner
Updated Branches:
  refs/heads/master b91c11a15 -> 5c650b92c


TAP5-2055 (Polish translations)

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/5c650b92
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/5c650b92
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/5c650b92

Branch: refs/heads/master
Commit: 5c650b92c943aea3763dcbe84e7630e08f389bcb
Parents: b91c11a
Author: bharner 
Authored: Thu Jan 24 06:46:28 2013 -0500
Committer: bharner 
Committed: Thu Jan 24 06:47:11 2013 -0500

--
 .../org/apache/tapestry5/core_pl.properties|   65 +++
 .../kaptcha/tapestry-kaptcha_pl.properties |   17 
 2 files changed, 82 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5c650b92/tapestry-core/src/main/resources/org/apache/tapestry5/core_pl.properties
--
diff --git 
a/tapestry-core/src/main/resources/org/apache/tapestry5/core_pl.properties 
b/tapestry-core/src/main/resources/org/apache/tapestry5/core_pl.properties
new file mode 100644
index 000..08681a7
--- /dev/null
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/core_pl.properties
@@ -0,0 +1,65 @@
+# Copyright 2013 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# We try to keep the validation messages consistent, with the constraint
+# value (if applicable) as the first parameter, and the field's label as the
+# second parameter. Occasionally we must use specific indexing when that's
+# not the best order.
+
+core-ascending=[Ros.]
+core-block-error=Nie można odnaleźć bloku do edycji właściwości '%s', 
która jest typu '%s' dla obiektu %s: %s
+core-cancel-label=Anuluj
+core-date-value-not-parseable='%s' nie jest poprawnym zapisem daty.
+core-default-error-banner=Musisz poprawić następujące błędy, aby 
kontynuować.
+core-descending=[Mal.]
+core-dismiss-label=Odrzuć wszystkie
+core-form-nesting-not-allowed=Nie wolno używać komponentów Form wewnątrz 
komponentów Form.
+core-goto-page=Idź do strony %d
+core-invalid-form-request=Formularze wymagają, aby zapytanie było typu POST 
(method=POST) oraz aby parametr %s zapytania miał ustawioną wartość.
+core-no-grid-data-to-display=Brak danych do wyświetlenia.
+core-palette-available-label=Dostępne
+core-palette-deselect-label=< Usuń wybór
+core-palette-down-label=Przesuń w dół
+core-palette-select-label=Wybierz >
+core-palette-selected-label=Wybrane
+core-palette-up-label=Przesuń w górę
+core-progressive-display-loading=Wczytywanie...
+core-sortable=[Sortowalne]
+core-submit-label=Utwórz/Aktualizuj
+integer-format-exception=Musisz wprowadzić liczbę całkowitą w polu %s.
+invalid-email=Błędny adres e-mail.
+max-integer=Pole %2$s nie może mieć wartości większej niż %1$d.
+maximum-string-length=Możesz wprowadzić conajwyżej %d znaków w polu %s.
+min-integer=Pole %2$s nie może mieć wartości mniejszej niż %1$d.
+minimum-string-length=Musisz wprowadzić przynajmniej %d znaków w polu %s.
+number-format-exception=Musisz podać wartość liczbową w polu %s.
+regexp=Wartość pola %2$s nie jest zgodna z wyrażeniem '%1$s'.
+required=Pole %s nie może być puste.
+private-no-validation-for-field=wiadomość zastępcza
+
+core-page-initialization-template=\
+require(["t5/core/pageinit"], function(pi) { pi(%s, %s); });
+
+# Default values for selected core component parameters.
+
+core-components.beaneditform.class=well
+core-components.submit.class=btn btn-primary
+
+# Messages that exist specifically for the client side:
+
+core-input-not-numeric=Wartość nie jest liczbą.
+core-input-not-integer=Wartość nie jest liczbą całkowitą.
+
+core-datefield-today=Dziś
+core-datefield-none=Brak
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5c650b92/tapestry-kaptcha/src/main/resources/org/apache/tapestry5/kaptcha/tapestry-kaptcha_pl.properties
--
diff --git 
a/tapestry-kaptcha/src/main/resources/org/apache/tapestry5/kaptcha/tapestry-kaptcha_pl.properties
 
b/tapestry-kaptcha/src/main/resources/org/apache/tapestry5/kaptcha/tapestry-kaptcha_pl.properties
new file mo