Win a copy of Rust Web Development this week in the Other Languages forum!

Mujtaba Alsaif

Greenhorn
+ Follow
since Dec 13, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mujtaba Alsaif

Thanks Tim

I was unaware. However, I was attempting to provide a generic template to develop multi lingual apps.
8 years ago
JSF
The default answer to having a multilingual page when developing an application is to develop two pages. This will usually add the complexity of managing the pages by resulting in the added effort of maintaining both pages/forms when having adding/amending a function. A simple solution to the problem is by considering the language to be as a separate function and manage it accordingly.

In-line with the function of multi-lingual, let us use the terminology of Function-Oriented application (as a sub-level of OO) where the function of presentation is isolated from the function of language and, as such, is isolated from the core function of the application. Within JSF, you can easily isolate the functionality of a multi lingual application. Let us start by a bundle two bundle files (This can be in a database if you prefer). Here I will use Arabic and English

BundleEn.bundle


BundleAr.bundle


Then Create a Managed Bean with the scope set as Session Scoped (This is to ensure you maintain the selected language)



Finally, your JSF page. Depending on the label you need to retrieve, you may use the expression language in the following form:


where dir while define the orientation of the page (left to right or right to left), next and previous will refer to the label title next and Previous respectively in the bundle bundle file based on the selected language. By implementing you code in the above manner, you open the opportunity to configure new languages as you feel free and it will require minimum maintenance from a technical perspective.

8 years ago
JSF