Click here to Skip to main content
15,914,391 members
Home / Discussions / Java
   

Java

 
Question[Help]How to use throw and throws? Pin
tuanvu_n6-May-11 2:15
tuanvu_n6-May-11 2:15 
AnswerRe: [Help]How to use throw and throws? Pin
TorstenH.6-May-11 2:19
TorstenH.6-May-11 2:19 
GeneralRe: [Help]How to use throw and throws? Pin
tuanvu_n6-May-11 2:32
tuanvu_n6-May-11 2:32 
AnswerRe: [Help]How to use throw and throws? Pin
Luc Pattyn6-May-11 3:59
sitebuilderLuc Pattyn6-May-11 3:59 
AnswerRe: [Help]How to use throw and throws? Pin
rahul23334313-Mar-12 7:45
rahul23334313-Mar-12 7:45 
QuestionArabic Font in Java program Pin
TorstenH.5-May-11 2:22
TorstenH.5-May-11 2:22 
AnswerRe: Arabic Font in Java program Pin
Nagy Vilmos5-May-11 3:32
professionalNagy Vilmos5-May-11 3:32 
GeneralRe: Arabic Font in Java program Pin
TorstenH.5-May-11 4:42
TorstenH.5-May-11 4:42 
thanks Nagy. I'm already taking care of these things.


This seems to be a fairly common problem.

To get a bit more precise on what I'm doing right now:

- Eclipse RCP application
- Eclipse owned buttons / labels and JFace/SWT Components have to be displayed Arabic or English by preference.

It all depends pretty much on the charset I'm using. I changed the RCP based NLS to my own "MultiLanguageSupport":
public final class MultiLanguageSupport{
	
	private final static String strPROPERTIES = "/resource/language/";
	private static HashMap<String, String> oMap;
	
	static{
		loadMap();
	}
	
	
	private static void loadMap(){
		oMap =  new HashMap<String, String>();
		try {
			String strLanguage = "language.txt";
			
			String strPref = AccountManager.getGeneralStore().getString(
				GeneralPreferenceConstants.LANGUAGE
			);
			if(false == strPref.isEmpty()){
				strLanguage = strPref;
			}
			
			
			ClassLoader oClassLoader = MultiLanguageSupport.class.getClassLoader(); 
			URL oURL = oClassLoader.getResource(strPROPERTIES + strLanguage);
			InputStream oInputStream = oClassLoader.getResourceAsStream( strPROPERTIES + strLanguage ); 
			StringWriter writer = new StringWriter();
			IOUtils.copy(oInputStream, writer, "UTF8");
			String strValues = writer.toString();
			
			StringTokenizer oLineTokenizer = new StringTokenizer(strValues, "\n");// split text
			while(oLineTokenizer.hasMoreElements()){ 
				String strLine = oLineTokenizer.nextToken();// read line
				if (strLine.length()>0 && 
						strLine.charAt(0) != '#' &&
						strLine.charAt(0) != '{' &&
						strLine.charAt(0) != '\\' ){
					StringTokenizer oTokenizer = new StringTokenizer(strLine, "=");
					if(2 == oTokenizer.countTokens()){
						oMap.put(oTokenizer.nextToken().trim(), oTokenizer.nextToken().trim());
					}
				}
			}
		} 
		catch (FileNotFoundException e) { e.printStackTrace(); } 
		catch (IOException e) { e.printStackTrace(); }
		
	}
	
	public static final String getString(final String strKey){
		return oMap.get(strKey);
	}

}


Now I can load these Strings from a *.txt file. This is needed as *.properties are not able to hold Arabic characters (to my knowledge).

Now I'm struggling on the charset to be used. Word tells me, that ISO-8859-6 ("Window Arabic") is not capable to save the Arabic characters I was able to produce with word ( " ٰ١٢٣ٵڅکګڪ " - I hope my random selection of characters is nothing offensive Confused | :confused: )

So how can I achieve my goal to display Arabic text in my RCP-application? I also thought about loading another font, but also that one would need "some arabic command" to display the chars right (at least on my European Latin character based machine...)

regards
Torsten
I never finish anyth...

GeneralRe: Arabic Font in Java program Pin
jschell5-May-11 8:17
jschell5-May-11 8:17 
GeneralRe: Arabic Font in Java program Pin
TorstenH.5-May-11 9:13
TorstenH.5-May-11 9:13 
GeneralRe: Arabic Font in Java program Pin
Richard MacCutchan5-May-11 21:29
mveRichard MacCutchan5-May-11 21:29 
GeneralRe: Arabic Font in Java program Pin
TorstenH.5-May-11 22:12
TorstenH.5-May-11 22:12 
GeneralRe: Arabic Font in Java program Pin
Nagy Vilmos5-May-11 22:29
professionalNagy Vilmos5-May-11 22:29 
GeneralRe: Arabic Font in Java program Pin
Richard MacCutchan6-May-11 2:41
mveRichard MacCutchan6-May-11 2:41 
GeneralOT: Woking - European City of Skank 1973-Present Pin
Nagy Vilmos6-May-11 2:57
professionalNagy Vilmos6-May-11 2:57 
GeneralRe: Arabic Font in Java program Pin
Richard MacCutchan6-May-11 2:43
mveRichard MacCutchan6-May-11 2:43 
GeneralRe: Arabic Font in Java program Pin
TorstenH.5-May-11 22:17
TorstenH.5-May-11 22:17 
GeneralRe: Arabic Font in Java program Pin
TorstenH.5-May-11 21:21
TorstenH.5-May-11 21:21 
Answernearly SOLVED - some more questions Pin
TorstenH.6-May-11 4:24
TorstenH.6-May-11 4:24 
AnswerRe: nearly SOLVED - some more questions Pin
Nagy Vilmos10-May-11 5:07
professionalNagy Vilmos10-May-11 5:07 
QuestionCron Expression Pin
R V Reddy5-May-11 0:58
R V Reddy5-May-11 0:58 
AnswerRe: Cron Expression Pin
Luc Pattyn5-May-11 1:51
sitebuilderLuc Pattyn5-May-11 1:51 
AnswerRe: Cron Expression Pin
Richard MacCutchan5-May-11 4:20
mveRichard MacCutchan5-May-11 4:20 
Questionhow to write a simple Client Server Program using Jabber XMPP Pin
williamroma3-May-11 0:55
williamroma3-May-11 0:55 
AnswerRe: how to write a simple Client Server Program using Jabber XMPP Pin
Nagy Vilmos3-May-11 1:13
professionalNagy Vilmos3-May-11 1:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.