Questions tagged [resourcebundle]

Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.

Resource bundles contain locale-specific objects. When your program needs a locale-specific resource, a String for example, your program can load it from the resource bundle that is appropriate for the current user's locale. In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles. This allows you to write programs that can:

be easily localized, or translated, into different languages handle multiple locales at once be easily modified later to support even more locales Resource bundles belong to families whose members share a common base name, but whose names also have additional components that identify their locales. For example, the base name of a family of resource bundles might be "MyResources". The family should have a default resource bundle which simply has the same name as its family - "MyResources" - and will be used as the bundle of last resort if a specific locale is not supported. The family can then provide as many locale-specific members as needed, for example a German one named "MyResources_de".

Each resource bundle in a family contains the same items, but the items have been translated for the locale represented by that resource bundle. For example, both "MyResources" and "MyResources_de" may have a String that's used on a button for canceling operations. In "MyResources" the String may contain "Cancel" and in "MyResources_de" it may contain "Abbrechen".

If there are different resources for different countries, you can make specializations: for example, "MyResources_de_CH" contains objects for the German language (de) in Switzerland (CH). If you want to only modify some of the resources in the specialization, you can do so.

763 questions
11
votes
2 answers

internationalization in JSF with ResourceBundle entries which are loaded from database

I'm working on a Java EE6 project using JPA/EJB/JSF and I'm having some trouble designing multiple language support for entities. There are three relevant entities: Language (has id) Competence (has id) CompetenceName (has Competence reference,…
Rasmus Franke
  • 4,434
  • 8
  • 45
  • 62
11
votes
2 answers

JSF converter resource bundle messages

Does anyone know where I can get a list of the converters used by JSF so I can set a custom message for them in the resource bundle?
Gerrie
  • 3,873
  • 4
  • 23
  • 26
11
votes
4 answers

How to add specific files to assetic?

I have my custom resources directory for my bundle where there are some files: /longpathtoSymfony/src/MyOwn/Bundle/MyOwnBundle/Resources/public |-- bootstrap | |-- css | | |-- bootstrap-theme.css | | |-- bootstrap-theme.min.css | | |--…
Olivier Pons
  • 15,363
  • 26
  • 117
  • 213
10
votes
2 answers

How can I check if a resource bundle key does not exist using JSTL tags?

I have a resource file that will have some optional keys. If the optional resource key is not present, I set a default instead. It appears that there is no easy way to determine if a key exists in the resource bundle. So this is what I'm doing to…
Dave Jensen
  • 4,574
  • 1
  • 40
  • 45
10
votes
3 answers

Tool for checking Java resource bundles (i18n)

I'm searching for a tool, ant-task, IDE plugin, ... which helps with I18N of a Java application using the standard message-properties resource bundles. Both open source and commercial solutions are welcome. Specifically I'm searching for support…
rfalke
  • 451
  • 4
  • 7
10
votes
4 answers

Where does ResourceBundle.getBundle("ResourceFile", new Locale("us", "US")) look for the file?

I'm running Eclipse and trying to create a simple test program trying our ResourceBundle with a couple of different files. The file is properly named as ResourceFile_us_US.properties. But I'm getting an exception on the getBundle() call because it…
Craig A
  • 101
  • 1
  • 1
  • 3
10
votes
2 answers

Java Properties property value - message with leading white space

I have messages in properties file and reading these properties file using spring and spring message tag, For example I have : key.red=Red
key.blue= blue blue message text coming as "blue" but not as " blue". The leading white spaces are…
Sri
  • 1,205
  • 2
  • 21
  • 52
10
votes
3 answers

Is there any way to know the language by default by country on Locale?

I have these lines of code: Locale[] cosas = Locale.getAvailableLocales(); for (int i = 0; i < cosas.length; i++) { log.info(cosas[i]); } I obtain this…
10
votes
4 answers

Loading with ResourceBundle from inside a jar

I have seen some answers concerning how to load a particular file within a jar through getResourceAsStream, and I can manage this. However I am facing something really specific an I could not find an answer about this on the forum. Here is the…
Yann Leglise
  • 101
  • 1
  • 1
  • 3
9
votes
1 answer

Bean Validation's resourcebundle parameterization possibility in JSF 2?

Using the resourcebundle with BV in JSF 2 would look something like this : public class UserBean { @Size(min=13, message="{creditcard.length}") public String getCreditCard() { return this.creditCard; } } And i have to define the…
Bertie
  • 17,277
  • 45
  • 129
  • 182
9
votes
1 answer

Prevent default formatting (comma insertion) of long argument in s:message tag

I have a jsp in which I use spring s:message tag applicationRefId is a long variable added to the model. In my resource bundle, I have defined message code quite regularly…
Sumit Jain
  • 1,484
  • 2
  • 25
  • 44
9
votes
2 answers

xcode ios files not recognized in bundle

i want to play a video, but i noticed that my files are not importing to the bundle?? so I just drag and drop the AA.mp4 file to my project, it shows ok on the project navigator, I give it show in finder, and confirm the file exists in the project…
manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216
8
votes
2 answers

How to remove the surrounding ??? when message is not found in bundle

In JSF 2.0, if a message is not found in the message bundle, then by default, the key is surrounded with ???. This is a very usable hint during development. However, in my particular case, I really would like that those ??? were not present. I…
rose
  • 103
  • 1
  • 8
8
votes
7 answers

Java: How to write "Arabic" in properties file?

I want to write "Arabic" in the message resource bundle (properties) file but when I try to save it I get this error: "Save couldn't be completed Some characters cannot be mapped using "ISO-85591-1" character encoding. Either change encoding or…
SmoothCriminel
  • 367
  • 1
  • 7
  • 17
8
votes
1 answer

Integer gets formatted with commas when it gets fetched from a ResourceBundle

year.of.birth={0} was born on {1} If I pass 2000 or 2008 to {1} the value gets parsed as 2,000 or 2,008. I don't want the commas as part of my translated string. How should I avoid this?
user339108
  • 12,613
  • 33
  • 81
  • 112
1 2
3
50 51