1

Topic: Chinese language

Hi everybody - and Happy new year :-)

I placed this question in an incorrect part of the forum, but believe this is the correct place to ask.

I am just writing as the university that I have just installed indicia for requires that the indicia form displays with an option of two languages - English and Chinese.  This is so that the form can be used here in the UK and by Chinese form viewers.  Is it possible to configure this?  If so, then I would appreciate it if someone could provide me with the required steps.

Best wishes and thanks.

Mark

2

Re: Chinese language

Hi Mark
Indicia uses UTF-8 which does support Chinese characters so this ought to be OK, though I've not tested it outside European character sets. I assume you will stick to left-to-right reading orientation?

So, you will first need to configure your Drupal install to allow users to pick their preferred language. There are ways of doing this in Drupal rather than Indicia - see documentation at https://drupal.org/taxonomy/term/34342. Note that because Indicia can run outside Drupal, although we rely on Drupal for language selection, we don't use Drupal to do the translation itself but instead have our own set of language files.

Next, you'll need to find out what 2 character ISO language code is being picked up in the drupal global $language->language variable when your user picks the Chinese language. From what I understand this will be zh. Now, assuming that you want to translate a page built using the dynamic_sample_occurrence.php prebuilt form, you can create a simple text file (in utf-8 encoding of course) called iform/client_helpers/prebuilt_forms/lang/dynamic_sample_occurrence.zh.php. There are some notes on how to fill this file at http://indicia-docs.readthedocs.org/en/ … age-files. You could also create a file called node.n.zh.php to create a page specific translation. In practice, you will want to be populating the $custom_term_overrides variable with translations from the text you see on screen into the Chinese versions.

Hope that helps,
Best wishes
John

John van Breda
Biodiverse IT

3

Re: Chinese language

Hi John

I am looking at translations for a form based on the dynamic_sample_occurrence prebuilt form at this moment. While the method you describe above works well for the labels of form elements it looks like helpText goes largely untranslated so I'll work on patching that.

I'm just thinking about text that is derived from a term list in the warehouse, appearing in a select input for example. I believe you have to add synonyms to the terms followed by a pipe and a 3-character country code. Furthermore, the prebuilt form would then have to call data_entry_helper::outputAttribute with the $options array containing a matching language value and I am not sure this is in place.

Jim Bacon.

4 (edited by Jim Bacon 06-01-2014 08:48:17)

Re: Chinese language

Hi

I have committed changes to the client_helpers which provides translation of helpText for all controls and also for blankText for select controls.

A couple of other tips.

If using the tabs or wizard interface to present your form then your form structure will contain =Tab Name= elements. The array key needed in your language file to translate these is LANG_Tab_tabname where tabname is the name in the form structure with all non-alphanumeric characters removed and in lowercase.

If your form structure contains ?Instructions? or @helpText= then you can supply a short value which is a key in to the array in your language files. Provide an English language file to translate these keys in to English. This avoids tremendously long keys.

If you are using a wizard interface, the array keys needed to translate the buttons are 'next step', 'prev step' and 'save'. Other keys you may want to override can be found in client_helpers/lang/default.php.

Jim Bacon

5

Re: Chinese language

Hi

A couple of other keys in to the language terms array that I had to hunt down were
'LANG_Date' for the label to the date control and
'occurrence:taxa_taxon_list_id' for the label to the species control.

Also caught a glimpse of a setting for the dynamic_sample_occurrence form called 'Internationalise lookups' which is explained thus: 'In lookup custom attribute controls, use the language associated with the current user account to filter to show only the terms in that language.' I haven't tried this but clearly there has been some work done on it that I was unaware of.

Jim Bacon.