Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
amir55
Post subject: Arabic Locale not working  PostPosted: Sep 06, 2010 - 02:31 PM
Registered Member
Registered Member


Joined: Oct 15, 2005
Posts: 173

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
 
 View user's profile Send private message  
Reply with quote Back to top
support-shalini
Post subject: RE: Arabic Locale not working  PostPosted: Sep 07, 2010 - 10:05 AM
Registered Member
Registered Member


Joined: May 18, 2009
Posts: 1532

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.

_________________
Shalini
MyEclipse Support
 
 View user's profile Send private message  
Reply with quote Back to top
amir55
Post subject:   PostPosted: Sep 07, 2010 - 06:37 PM
Registered Member
Registered Member


Joined: Oct 15, 2005
Posts: 173

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" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
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
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits