Is there any way to detect an RTL language in Java?
问题 I need to be able to detect whether the current language my user is viewing is an RTL (Right To Left) language like Arabic. At the moment I'm just detecting this based on the language code from the system property user.language, but there must be a better way. 回答1: ComponentOrientation.getOrientation(new Locale(System.getProperty("user.language"))).isLeftToRight(); Resource 回答2: I felt a bit dirty relying on AWT classes which are quite dated and I was dealing with BCP-47 language codes, so I