无法根据我的 systemLocal 变量呈现 outputText [英] Cant render an outputText depending on my systemLocal Variable

查看:45
本文介绍了无法根据我的 systemLocal 变量呈现 outputText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 webcenter 门户中有一个页面模板,带有 2 个输出文本的页脚,这些文本将根据语言任务流中的所选语言进行呈现.

I have a page template that in webcenter portal with footer with 2 output text which will be rendered depending on the selected language from the language task flow.

我有使用 jdeveloper 创建的自定义模板并放置了以下输出标签:

I have custom template which I've created with the jdeveloper and had put the follwing output label:

 <af:outputFormatted id ="copyright" rendered="#    {facesContext.externalContext.requestLocale} eq 'en'" value="the english text"   />


 <af:outputFormatted id ="copyright" rendered="#{facesContext.externalContext.requestLocale} eq 'ar'" value="the arabic text"   />

而这个 El 表达式总是返回 false那么如何根据所选语言来呈现这些组件?

And this El expression always return false so how to render this components depending on the selected language?

推荐答案

问题是您过早关闭了 el 表达式 ("requestLocale }").要修复它,请替换:

The issue is that you are closing your el expression too soon ("requestLocale }") . To fix it, replace :

<af:outputFormatted id="copyright" rendered="#{facesContext.externalContext.requestLocale} eq 'en'" value="the english text"   />

<af:outputFormatted id="copyright" rendered="#{facesContext.externalContext.requestLocale eq 'en'}" value="the english text"   />

或者,作为替代解决方案,您可以只有一个 outputFormatted,其中的所有值如下所示:

Or, as an alternative solution, you can have only one outputFormatted with all values like this :

<af:outputFormatted id="copyright"  value="#{facesContext.externalContext.requestLocale eq 'en' ? 'the english text':(facesContext.externalContext.requestLocale eq 'ar' ? 'the arabic text' : 'Default text')}"   />

但是,如果您正在 ADF 中寻找翻译功能,则应该按照此处文档中的说明查找翻译包文件:https://docs.oracle.com/cd/E15051_01/web.1111/b31973/af_global.htm#ADFUI425>

However if you are looking for a translation functionnality in ADF you should go for a translation bundle file as explain in the documentation here : https://docs.oracle.com/cd/E15051_01/web.1111/b31973/af_global.htm#ADFUI425

国际化是设计和开发产品以方便地适应特定的当地语言和文化的过程.本地化是通过翻译文本和添加特定于语言环境的组件来使产品适应特定的本地语言或文化的过程.一个成功的本地化应用程序似乎是在当地文化中开发的.JDeveloper 支持使用抽象类 java.util.ResourceBundle 轻松本地化 ADF Faces 组件,以提供特定于语言环境的资源.

Internationalization is the process of designing and developing products for easy adaptation to specific local languages and cultures. Localization is the process of adapting a product for a specific local language or culture by translating text and adding locale-specific components. A successfully localized application will appear to have been developed within the local culture. JDeveloper supports easy localization of ADF Faces components using the abstract class java.util.ResourceBundle to provide locale-specific resources.

当您的应用程序将被多个用户查看时国家,您可以配置您的 JSF 页面或应用程序以使用不同的区域设置,以便它显示正确的语言用户浏览器的语言设置.例如,如果你知道你的页面将在意大利查看,您可以本地化您的页面,以便当用户的浏览器设置为使用意大利语,文本字符串在浏览器页面将以意大利语显示.

When your application will be viewed by users in more than one country, you can configure your JSF page or application to use different locales so that it displays the correct language for the language setting of a user's browser. For example, if you know your page will be viewed in Italy, you can localize your page so that when a user's browser is set to use the Italian language, text strings in the browser page will appear in Italian.

ADF Faces 组件可能包含作为组件一部分的文本,例如 af:table 组件使用资源字符串af_table.LABEL_FETCHING 用于显示在表在初始加载期间获取数据时的浏览器数据或在滚动表格时.JDeveloper 提供将这些文本资源自动翻译成 28 种语言.这些文本资源在资源包中被引用.如果你设置浏览器使用意大利语,包含在意大利语中的任何文本组件将自动以意大利语显示.更多有关皮肤和资源包的信息,请参阅第 20 章,使用样式和皮肤自定义外观".

ADF Faces components may include text that is part of the component, for example the af:table component uses the resource string af_table.LABEL_FETCHING for the message text that is displayed in the browser while the table is fetching data during the initial load of data or while the table is being scrolled. JDeveloper provides automatic translation of these text resources into 28 languages. These text resources are referenced in a resource bundle. If you set the browser to use the language in Italy, any text contained within the components will automatically be displayed in Italian. For more information on skins and resource bundles, see Chapter 20, "Customizing the Appearance Using Styles and Skins".

对于添加到组件的任何文本,例如,如果您定义af:commandButton 组件的标签,通过设置 text 属性,您必须提供一个包含实际文本的资源包,创建每个语言环境的资源包版本,并添加一个元素来定义默认和支持的语言环境应用程序的 faces-config.xml 文件.您还必须添加一个元素添加到应用程序的 faces-config.xml 文件中为了使资源包对中的所有页面可用你的申请.配置并注册资源后bundle,表达式语言 (EL) 编辑器将显示来自包,更容易在应用程序中引用包页.

For any text you add to a component, for example if you define the label of an af:commandButton component by setting the text attribute, you must provide a resource bundle that holds the actual text, create a version of the resource bundle for each locale, and add a element to define default and support locales in the application's faces-config.xml file. You must also add a element to your application's faces-config.xml file in order to make the resource bundles available to all the pages in your application. Once you have configured and registered a resource bundle, the Expression Language (EL) editor will display the key from the bundle, making it easier to reference the bundle in application pages.

简化为添加到的文本创建文本资源的过程ADF 组件,JDeveloper 支持自动资源捆绑可视化编辑器中任何可翻译字符串的同步.什么时候您可以直接在可视化编辑器或属性中编辑组件Inspector,文本资源自动创建在base中资源包.

To simplify the process of creating text resources for text you add to ADF components, JDeveloper supports automatic resource bundle synchronization for any translatable string in the visual editor. When you edit components directly in the visual editor or in the Property Inspector, text resources are automatically created in the base resource bundle.

这篇关于无法根据我的 systemLocal 变量呈现 outputText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆