Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6068765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:45:00+00:00 2026-05-23T09:45:00+00:00

I have a JSF2 application and so far I’m doing the internationalization in a

  • 0

I have a JSF2 application and so far I’m doing the internationalization in a typical way with a message resource bundle; example:

<f:view contentType="text/html" locale="#{loginHandler.currentLocale}">

<f:loadBundle basename="MessageResource" var="msg" />

<h:outputText value="#{msg.user_firstNameLabel}" />

My problem is I have an information page with paragraphs of content in two languages. I prefer not to take every line of text on the page and make them key|values in the message properties file.

If the content is in two html files; say contactus_en.html and contactus_fr.html, what would be the right way to display the right language based on the current locale?

Thanks!
Rob

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:45:00+00:00Added an answer on May 23, 2026 at 9:45 am

    The easiest way to do what you are asking for is to create a controller that would read the contents of your HTML files and return them on demand. In such case you can write out it from your JSF page with very simple declaration:

    <h:outputText escape="false" value="#{yourController.contactus}" />
    

    Since you are going to read the contents of HTML file(s), you need to tell JSF not to escape them (thus escape=”false”).
    Of course your controller need to provide method named getContactus() which should read the contents of HTML files of your interest and return them as String. I believe you can easily handle it 🙂


    Edit – adding information about how to choose file.

    If your HTML files are locale-dependent so these are already bi-lingual but different for English and French, you can easily get current view Locale from UIViewRoot:

    Locale currentLocale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
    String fileName = "contactus_" + currentLocale.toString() + ".html";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using RichFaces on my JSF2 application, and I need a way to have
I have a JSF2 (GlassFish 3.0) application which security constraints defined (example below). My
My JSF2 application is fully internationalized, using a ResourceBundle. Now i have a lot
How can I control my web application's resource handling? I have users with extremely
I have simple JSF2 application running on glashfish 3.1. I want to add a
I have a JSF2 application that uses Spring 3.0. I have a bean that
I have a JSF2 application and a page with the following code: <h:inputText id=someInput
I am running an application using JSF2.0 and Primefaces 2.2RC2 I have run the
I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a
In my JSF2 application, I have Clear button, which is supposed to clear all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.