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
21
votes
4 answers

String concatenation in EL for dynamic ResourceBundle key

I have a resource bundle with entries like these: entry1=value1 entry2=value2 entry3=value3 In my JSF page I'm trying to use these keys dynamically. The ID of the entry is coming from a managed bean. I think it should be something like…
21
votes
2 answers

Why does resource bundle copy .png as .tiff images?

I've created a static library and a resource bundle for reusing code and assets across several projects. Within the static library, I have a manager class whose sole purpose is to create other UIViewControllers, whose views are created from .xib…
JRG-Developer
  • 12,454
  • 8
  • 55
  • 81
18
votes
5 answers

Why does maven not copy the properties files during the build process?

Nothing I've found has been able to help me solve this one specific case. I recently switched from a plain old java web app project (which was working) to a maven web project. I get the following runtime…
Nicholas22j
  • 183
  • 1
  • 1
  • 5
16
votes
5 answers

XCode, Swift (Domain = NSPOSIXErrorDomain, Code = 22)

My friend came to me with a small request of creating a video portfolio app. I thought it was a good excuse to try out Swift, which is what I did. (The app is not intended for release on the app store, only to distribute via Testflight) I've run…
dnlmzw
  • 751
  • 1
  • 8
  • 20
16
votes
1 answer

Is there a single rule to cope with single quotes in writing Spring Resource Boundle?

Spring's ResourceBundleMessageSource uses MessageFormat for replacing placeholders ({0}) inside messages. MessageFormat requires that single quotes (') are escaped using two single quotes ('') (see: MessageFormat Javadoc). However, by default…
15
votes
2 answers

Getting localized message from resourceBundle via annotations in Spring Framework

Is it possible to do this ? Currently it is done like this : content.Language
lisak
  • 21,611
  • 40
  • 152
  • 243
14
votes
2 answers

Spring boot yml ResourceBundle file

I'm using MessageSource of Spring to load errors messages from a .properties file in classpath. My properties respect a certain "template" such as {Object}.{field}.{unrespectedConstraint} Example : userRegistrationDto.password.Size= Le mot de passe…
Radouane ROUFID
  • 10,595
  • 9
  • 42
  • 80
14
votes
2 answers

How do I avoid repetition in Java ResourceBundle strings?

We had a lot of strings which contained the same sub-string, from sentences about checking the log or how to contact support, to branding-like strings containing the company or product name. The repetition was causing a few issues for ourselves…
Hakanai
  • 12,010
  • 10
  • 62
  • 132
14
votes
2 answers

Access Resources in pod

I would like to include image assets in a cocoapod library, but I'm having trouble accessing them. I've read these resources for help: Cocoapods Resources Cocoapods Resource Bundles Mokacoding Resource Bundles David Potter Resource Bundles However,…
RileyE
  • 10,874
  • 13
  • 63
  • 106
14
votes
1 answer

How to get the default ResourceBundle regardless of current default Locale

I have three resource files in class path: labels.properties: language = Default labels_en.properties: language = English labels_fr.properties: language = French Is there a way to get a ResourceBundle object that always loads labels.properties NO…
user1089451
13
votes
2 answers

read resourcebundle as UTF-8. getString() Method seems to change encoding to ISO-8859

I have the honorable assignment to change the encoding of our complete workspace, projects and files to the UTF-8 encoding. We have several Resourcebundles which used to code special chars with unicode. We also wanted to get rid of that unicode…
izocan
  • 291
  • 1
  • 4
  • 16
13
votes
5 answers

Android supporting all tablets - categorize drawables and layouts

I have seen many thread discussing this problem in stackoverflow (like this, this and this), and I have read the documentation about supporting multiple screens, and designs. But I am still not clear about the folder structure for drawables and…
Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
13
votes
13 answers

ResourceBundle not found for MessageSource when placed inside a folder

I am trying to use resource bundles with Spring's Message Source. Here is the way I am doing it: @Component public class MessageResolver implements MessageSourceAware { @Autowired private MessageSource messageSource; public void…
Prasanth
  • 1,005
  • 5
  • 19
  • 39
12
votes
3 answers

JSTL Resource Bundle for Internationalization and Localization

We have an application that using the basic JSP/servlet that all text currently in English is hard coded in the JSP pages. We are considering about internationalizations of our app, so we need some sort of ways to extract the text out into…
Yudong Li
  • 1,784
  • 2
  • 17
  • 32
11
votes
3 answers

Pass parameters to messages from resource bundle to components other than **h:outputFormat**

Is there a convenient way to pass parameters to messages from resource bundle to components other than h:outputFormat? For instance, this is legal:
Andrey
  • 333
  • 3
  • 5
  • 16
1
2
3
50 51