facebook

Arabic Locale not working

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #311142 Reply

    amir55
    Participant

    hi all

    1 – I can save Arabic and display as plain text but incase of changing Locale it does not not.

    I use the utf-8 encoding for myeclipse and my page jsp.

    I can display many locales from Germany to French fine

    but when I add Arabic the windows shows gabage why?

    I use .propeties files to support as resoursebundles.

    I can read the internet Arabic sites fine so the brower is set to utf-8 too but in running the web application I do not get the Arabic scripts.

    Do I have to do some encoding cnanging a part from myeclipse and web ,jsp file or what

    All I want to make an Arabic site for myself using my fullversion myeclipse 8.5

    many thanks

    Amir

    #311153

    Amir,
    Your issue is not clear to me. Can you send us some screen shots showing the issue? Also, can you list out the steps in detail to replicate your issue.

    #311169

    amir55
    Participant

    hi dear sir

    My example is very simple but it has one bug that it does not show the Arabic text in spite of changing locale . It shows jargon of

    1 – localeChanger.jsp which is simply 3 radio boxes for locale selection which would display the welcome word accordingly

    <%@ page contentType=”text/html;charset=UTF-8″ language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
    <%@ taglib uri=”http://java.sun.com/jsf/html&#8221; prefix=”h”%>
    <%@ taglib uri=”http://java.sun.com/jsf/core&#8221; prefix=”f”%>
    <html lang=”ar” dir=”rtl”>
    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
    <f:view locale=”#{localeChanger.locale}”>
    <html>
    <head> <title></title> </head>
    <body bgcolor=”white”>
    <h:form>
    <h:panelGrid columns=”2″>
    <f:facet name=”label”>
    <h:outputText value=”#{labels.prefLangHeader}” />
    </f:facet>
    <h:outputText value=”Choose a language” /> <br/>
    <h:selectOneRadio value=”#{localeChanger.locale}”>
    <f:selectItem itemValue=”en” itemLabel=”English”/>
    <f:selectItem itemValue=”de” itemLabel=”German”/>
    <f:selectItem itemValue=”ar” itemLabel=”Arabic”/>
    </h:selectOneRadio>
    </h:panelGrid>
    <h:commandButton value=”Submit” action=”#{localeChanger.changeLocale}” />
    </h:form>
    <h:outputText value=”#{message.welcome}” />
    </body>
    </html>
    </f:view>

    2 – bean which only changes the locale

    package internationlise;
    import java.util.Locale;
    import javax.faces.context.FacesContext;

    public class LocaleChanger {
    private String locale ;

    public String getLocale() {return locale;}
    public void setLocale(String locale) {this.locale = locale;}

    public String changeLocale (){
    FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale(getLocale()));;
    return null;
    }
    }

    3 – faces-config.xml which shows the locales and the properties package

    <?xml version=’1.0′ encoding=’UTF-8′?>

    <faces-config xmlns=”http://java.sun.com/xml/ns/javaee&#8221;
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd&#8221;
    version=”1.2″>

    <application>
    <locale-config>
    <default-locale>en</default-locale>
    <supported-locale>en</supported-locale>
    <supported-locale>de</supported-locale>
    <supported-locale>ar</supported-locale>
    </locale-config>

    <resource-bundle>
    <base-name>bundles.Messages</base-name>
    <var>message</var>
    </resource-bundle>
    </application>

    <managed-bean>
    <managed-bean-name>localeChanger</managed-bean-name>
    <managed-bean-class>internationlise.LocaleChanger</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

    </faces-config>

    4 -. properties which contains one word each of welcome
    Messages.propertie welcome=Welcome
    Messages_ar.properties welcome=شس شس
    Messages_en.properties welcome=Welcome
    Messages_de.properties welcome=Welcomeen

    5 – Notes :
    1 – I use tha UTF-8 encoding in the jsp file as above
    2 – Also in myeclipse from windows -> preferences -> general -> Content Types -> Text -. UTF-8
    Also for jsp but here it restores the default value of ISO-8859-1 i.e does not save it why?
    3 – I use windows XP professional supporting English and Arabic
    4 – I changed the encoding in internet browser Tools as well

    I do appreciate the solution ASAP

    Amir

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Arabic Locale not working

You must be logged in to post in the forum log in