0

I have .jspx template which has header, content and footer

<?xml version='1.0' encoding='UTF-8'?>

    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:tr="http://myfaces.apache.org/trinidad"
              xmlns:rah="http://xmlns.oracle.com/webcenter/resourcehandler"
              xmlns:wcdc="http://xmlns.oracle.com/webcenter/spaces/taglib">

and I have 2 properties files ar.properties and en.properties. in the footer I have a copyright message that will be displayed depending on the selected locale

so I've done that

 <af:outputFormatted value=" جميع الحقوق محفوظة "  rendered="#{facesContext.ELContext.locale eq 'ar'}" />
 <af:outputFormatted value="all right reserved "  rendered="#{facesContext.ELContext.locale eq 'en'}" />

and it work fine but this way isn't effiecient because i will have to duplicate every labael in the whole page

I tried to put

<c:set var="bundle" value="{#facesContext.ELContext.locale eq 'en' ? {adfBundle['com.en']} : {adfBundle['com.ar']}}" />

and used only one output label

<af:outputFormatted value="#{bundle.copyright}"  />

but it gives me a warning that reference bundle is not found. how to fix this?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
osfar
  • 401
  • 1
  • 4
  • 23

1 Answers1

0

As described in the, not yet validated, answer provided on your previous question, (Cant render an outputText depending on my systemLocal Variable)

You can follow this easy to read documentation on how to create a localization bundle : https://docs.oracle.com/cd/E15051_01/web.1111/b31973/af_global.htm#ADFUI433

You are right to use your second approach with bundles to have a translatable value. If you have a "reference bundle is not found" warning it means that you missed the part where you have to define the bundle in your project properties.

See 21.2.1 How to Set Resource Bundle Options:

After you have created a project, you can set resource bundle options in the Project Properties dialog.

To set resource bundle options for a project:

In the Application Navigator, double-click the project.

In the Project Properties dialog, select Resource Bundle to display the resource bundle options, as shown in Figure 21-3.

Figure 21-3 Project Properties Resource Bundle dialog

Project Properties Resource Bundle. If you want JDeveloper to automatically generate a default resource file, select Automatically Synchronize Bundle.

Select one of the following resource bundle file options:

One Bundle Per Project - configured in a file named .properties.

One Bundle Per Page - configured in a file named .properties.

Multiple Shared Bundles.

Select the resource bundle type from the dropdown list:

XML Localization Interchange File Format (XLIFF) Bundle

List Resource Bundle

Properties Bundle

Click OK.

Cedric
  • 977
  • 2
  • 11
  • 23