Load resources via a resources file : ResourceBundle « I18N « Java Tutorial

Home
Java Tutorial
1.Language
2.Data Type
3.Operators
4.Statement Control
5.Class Definition
6.Development
7.Reflection
8.Regular Expressions
9.Collections
10.Thread
11.File
12.Generics
13.I18N
14.Swing
15.Swing Event
16.2D Graphics
17.SWT
18.SWT 2D Graphics
19.Network
20.Database
21.Hibernate
22.JPA
23.JSP
24.JSTL
25.Servlet
26.Web Services SOA
27.EJB3
28.Spring
29.PDF
30.Email
31.J2ME
32.J2EE Application
33.XML
34.Design Pattern
35.Log
36.Security
37.Apache Common
38.Ant
39.JUnit
Java Tutorial » I18N » ResourceBundle 
13.4.2.Load resources via a resources filePrevious/Next
import java.util.Locale;
import java.util.ResourceBundle;

public class Main {
  public static void main(String[] argvthrows Exception {

    ResourceBundle rb = ResourceBundle.getBundle("res.ResourcesDynamic", Locale.getDefault());
    System.out.println(rb.getString("title"));
  }
}

[RresourcesDynamic.properties]

title=Example

[RresourcesDynamic_en.properties]

title=Example

[ResourcesDynamic_fr.properties]

title=Exemple

[ResourcesDynamic_de.properties]

title=Beispiel
13.4.ResourceBundle
13.4.1.File name for java.util.ResourceBundle
13.4.2.Load resources via a resources file
13.4.3.Reading Properties Files using ResourceBundle
13.4.4.Convert ResourceBundle to Properties
13.4.5.Convert ResourceBundle to Map
13.4.6.An Internationalized Swing Application
13.4.7.JOptionPane Resources
13.4.8.Using the JDK 6 ResourceBundle class
13.4.9.Displaying Calendar Names
13.4.10.Customizing Resource Bundle Loading
13.4.11.XML resource bundle
13.4.12.Get resource bundle for a certain locale
13.4.13.Java file based resource bundle
13.4.14.ResourceBundle: avoid a performance penalty by superfluous resource (and classes loaded by Class.forName) lookups on web server in applets.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.