用Java写阿拉伯字母 [英] Writing arabic letters in Java
问题描述
我想使在服务器中用阿拉伯语书写成为可能.它可以正常工作,但是从左到右,所以我使用了StringUtils.reverse(_text)
,现在我的文本是从RTL编写的,但是问题是这样的:
文本是分别编写的(e x a m p l e
)
I want to make it possible to write in Arabic in my server. It works but from left to right so I used that StringUtils.reverse(_text)
now my text is written from RTL but the problem is this:
the text is written separately ( e x a m p l e
)
在我的记录器中
Log.LogChat(_type.name(), activeChar.getName(), _target, _text);
聊天记录正确地写在了我的log.txt中,但在游戏中却写有空格
the chat is written correctly in my log.txt, but in the game it's written with spaces
// arabic chat
Say2 cs = new Say2(activeChar.getObjectId(), _type, activeChar.getName(), StringUtils.reverse(_text));
有人知道为什么吗?
推荐答案
您不想反转字符串"!
相反,您希望将应用程序的文本转换为阿拉伯语...,并且希望该文本以阿拉伯语显示.它将自动处理从右到左的操作.
Instead, you want to translate your application's text to Arabic ... and you want that text displayed in Arabic. Which will automatically handle Right-to-Left.
您想利用Java语言环境".
You want to utilize Java "locales".
查看以下链接:
http://www.oracle.com/technetwork/articles/javase/locale-140624.html
http://docs.oracle.com/javase/tutorial/i18n/locale/create.html
https://blogs.oracle.com/geertjan/entry/tips_for_arabic_java_desktop
这篇关于用Java写阿拉伯字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!