Jump to: navigation, search

Difference between revisions of "Scout/Concepts/Texts"

(TEXTS, Text Provider Services and merge content of http://www.eclipse.org/forums/index.php/mv/msg/367177/894843/#msg_894843)
Line 1: Line 1:
 
{{ScoutPage|cat=Shared}}
 
{{ScoutPage|cat=Shared}}
  
Texts is a class used for the localization of the texts in the user interface.
+
{{ScoutJavadoc|TEXTS|C}} is a convenience class to access the {{ScoutLink|Concepts|Text Provider Services}} used for the localization of the texts in the user interface.
  
 
== Description ==
 
== Description ==
Line 7: Line 7:
  
 
<source lang="java">
 
<source lang="java">
Texts.get("persons");
+
TEXTS.get("persons");
 
</source>
 
</source>
 
* TODO: explain the properties text files.
 
  
 
It is possible to use some Parameters:
 
It is possible to use some Parameters:
Line 17: Line 15:
 
int age = 13;
 
int age = 13;
  
Texts.get("NameWithAge", name, age);
+
TEXTS.get("NameWithAge", name, age);
 
</source>
 
</source>
  
Line 23: Line 21:
 
   NameWithAge={0} is {1} years old;
 
   NameWithAge={0} is {1} years old;
  
 +
=== properties files ===
 +
Scout uses the java.util.ResourceBundle mechanism for native language support. So whatever language files you have in your <code><project-prefix>.shared/resources/texts/*.properties</code> are taken as translation base.
 +
 +
Example setup:
 +
* <code><project-prefix>.shared/resources/texts/Texts.properties</code>
 +
* <code><project-prefix>.shared/resources/texts/Texts_fr.properties</code>
 +
 +
If your application starts with the -vmargs -Duser.language=fr or eclipse.exe -nl=fr the translations in <code>Texts_fr.properties</code> are considered. In case of any other user language the translations in <code>Texts.properties</code> are considered.
  
 
== See Also ==
 
== See Also ==
 +
* {{ScoutLink|Concepts|Text Provider Services}}
 
* {{ScoutLink|Concepts|Shared Plug-In|Shared Plug-In}}
 
* {{ScoutLink|Concepts|Shared Plug-In|Shared Plug-In}}

Revision as of 02:16, 11 July 2012


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitter
Bugzilla
Bugzilla
C obj.pngTEXTS is a convenience class to access the Text Provider Services used for the localization of the texts in the user interface.

Description

Note.png
TODO
Add a description


TEXTS.get("persons");

It is possible to use some Parameters:

String name = "Bob";
int age = 13;
 
TEXTS.get("NameWithAge", name, age);

In this case, some placeholders for the parameters are needed in the translated text:

 NameWithAge={0} is {1} years old;

properties files

Scout uses the java.util.ResourceBundle mechanism for native language support. So whatever language files you have in your <project-prefix>.shared/resources/texts/*.properties are taken as translation base.

Example setup:

  • <project-prefix>.shared/resources/texts/Texts.properties
  • <project-prefix>.shared/resources/texts/Texts_fr.properties

If your application starts with the -vmargs -Duser.language=fr or eclipse.exe -nl=fr the translations in Texts_fr.properties are considered. In case of any other user language the translations in Texts.properties are considered.

See Also