Codename – language DataPicker Calendar - codenameone

How change or configure default localize language for a DataPicker “com.codename1.ui.Calendar”

To localize strings for month names use the values "Calendar.Month" using the 3 first characters of the month name in the resource localization e.g. "Calendar.Jan", "Calendar.Feb" etc...
To localize strings for day names use the values "Calendar.Day" in the resource localization e.g. "Calendar.Sunday", "Calendar.Monday" etc...
From https://www.codenameone.com/javadoc/com/codename1/ui/Calendar.html
When we say localize we mean a resource bundle: https://www.codenameone.com/javadoc/com/codename1/ui/plaf/UIManager.html#setBundle-java.util.Map-

Related

WPF Localization Language Groups

I have a standard WPF localized application using .resx files. At the moment I have support for en-US (default) en-AU, es, and zh-CN.
Do I need to have a separate resx file for each language, or is there some way to group them? For example, I imagine people with region id en-GB would prefer en-AU over en-US. or zh-TW would definitely prefer zn-CN over en-US. I could certainly just copy the files, but is there an easier way?
You need a seperate resx file for every language and each file has to have the same keys. The matching resx file will be choosen automatically.
You can have one default resx file if that's what you wanted to know, too.
A bit late to this question but I just found it so I might as well give an answer.
I guess there are two options, depending on your needs:
You can define a "Resources.en.resx" that en-GB users will fall back to if there is no specific en-GB resource file defined.
en-GB users will try to look for resources in the following order:
Resources.en-GB.resx
Resources.en.resx
Resources.resx
This works per resource entry. You can define all common "en" resources in Resources.en.resx, and only the differences in Resources.en-AU, so you don't have to copy paste all resources.
You can also manually set the culture depending on the language code: if the user is in en-GB, you could just set the culture to en-AU:
CultureInfo userCulture = CultureInfo.InstalledUICulture;
if(userCulture.Name == "en-AU") // do what you want

Is there any way to create custom locale in Java?

I am using Vaadin calendar and want to change month, weeks to my own language (Mongolian). Java doesn't have Mongolian locale so I need to create custom locale.
Any suggestion?
The valid way to create Mongolian Locale is to use its constructor:
new Locale("mon", "MN")
Arguments of the constructor are ISO 639 and ISO 3166 codes of Mongolian language and country.
Note, that it doesn't mean that Vaadin must implement Mongolian version of its Calendar widget. So you still may see English calendar unfortunately.

Generate english versions of same content on Drupal?

My website needs to be able to support multiple languages for multiple countries. For example, the US might have English and Spanish, while the UK might only have English. If two countries use the same language, it DOES NOT mean the content is the same.
For this reason, I decided to use the internationalization module (i18n) and I created language codes as follows:
gb-en - UK English
us-en - US English
us-es - US Spanish
I set this up with no issues, but my problem comes in with creating all the default content. For each content type, I want to:
Set the content types default language as "English"
Create translated versions of each content type for each language
I know this will mean that the Spanish content would still be in English, but it's the first step towards translating it.
What is the easiest way to create all these "default" content pages?
You could create a module implementing hook_node_insert(). This module would intercept the creation of a new node (stored with the default language) and create as many copies as needed. Each of these copies should have a different value in the field language. These copies colud be easily stored in the dabase using node_save() function.

Arabic(hijri) calendar/datepicker using smartclient

I am working on an arabic language support project using smartclient 10.0.
It requires an arabic(hijri) calendar support for date picker component.
How can I add arabic(hijri) calendar for date picker component in smartclient?
I suppose you want to define month names in arabic, and maybe the picker grid to be ordered in another way. Then you will need to extend the DateItem for DynamicForm. Check here: http://www.smartclient.com/docs/10.0/a/b/c/go.html#class..Class
http://www.smartclient.com/docs/10.0/a/b/c/go.html#object..ClassFactory
If that is not the case, and you just need to define the order of days, months, years according to arabic specifics, please check here:
http://www.smartclient.com/docs/10.0/a/b/c/go.html#type..DateInputFormat
http://www.smartclient.com/docs/10.0/a/b/c/go.html#type..DateDisplayFormat
Also take a look here:
http://www.smartclient.com/docs/10.0/a/b/c/go.html#group..i18n
Hope this helps.

How to translate role in Drupal?

If I want to translate the role to other language, how do I do it?
I can change that to other language as the default but I would like to use English so I don't have to deal with UTF8 issue in my code with Asian charactors.
if(in_array("administer nodes", $user->roles))
I have tried to find it from translation module but this seems not translatable as other text in Drupal.
So I'm assuming you've already tried using the t() or st() functions?
If that's so, you may need to try a client-side AJAX translation solution. One way you might do this is to create a vocabulary of terms (corresponding to the English role names), and have the Asian character translation as a secondary field. Then use views to create a view of this vocabulary, and create a lightweight module that:
1) loads a Drupal AJAX script on every page (or every page where role names might be utilized)
2) the script looks for a list of specified containers by id that you know will contain role names
3) searches the view you created for the English pattern, and replaces it in the container with any positive matches
Drupal API's example AJAX module
You could then expand the module/AJAX script to solve other similar translate fails on your site.

Resources