Mixed image-based forms in multiple languages

Hi there,

I noticed a curious feature/bug relating to image-based forms, I'm
sure you might be aware of already, but it might be good to mention on
http://opendatakit.org/help/image-based-forms/. Currently developing a
data collection form for a project taking place in both India and
Pakistan. Hence we need localization in English, Urdu and Hindi for
all forms. The English and Urdu versions will be plain text and the
Hindi version will be image-based shots of Devnagari script.

Let's say we have a label that should say "Village Name" in English,
Urdu and Hindi dep. on language chosen. Then we might have XML code
like this:

    <translation lang="eng">
      <text id="/data/VILLAGE_NAME:label">
	<value>Village Name</value>
      </text>
      ....
    <translation lang="urd">
      <text id="/data/VILLAGE_NAME:label">
	<value>گاؤں کا نام</value>
      </text>
       ....
    <translation lang="hin">
      <text id="/data/VILLAGE_NAME:label">
             <value form="image">jr://images/villagename.png</

value>

However, this makes ODK Collect crash as soon as we switch to Hindi
with exception

"org.javarosa.core.util.NoLocalizedTextException: Error loading locale
hin. There were 2 keys which were contained in this locale, but were
not properly registered in the default Locale. Any keys which are
added to a locale should always be added to the default locale to
ensure appropriate functioning" (run from Eclipse using the source
code).

So after a bit of interpretation, I realised ODK Collect as is only
works with text rendering in one locale and image rendering in another
locale if you have a element inside every itext
element in the English version that has an image-based component in
the corresponding Hindi version. So changing the above to

    <translation lang="eng">
      <text id="/data/VILLAGE_NAME:label">
	<value>Village Name</value>
            <value form="image"></value>
      </text>
      ....
    <translation lang="urd">
      <text id="/data/VILLAGE_NAME:label">
	<value>گاؤں کا نام</value>
      </text>
       ....
    <translation lang="hin">
      <text id="/data/VILLAGE_NAME:label">
             <value form="image">jr://images/villagename.png</

value>

fixed it.

Best wishes,

Lu

Hi Lu,

This is a known issue (see
http://code.google.com/p/opendatakit/issues/detail?id=562).

Basically, you cannot have one jr:text definition in one language that
you have defined with an image, and the same jr:text definition in
another language you have defined only text. Both prompts must have
both images and text. It is fine if those definitions they are blank
or empty.

If you are using XLSForm, this should be fixed. I have also added this
explanation under the notes section of
http://opendatakit.org/help/image-based-forms/. Until we can fix the
underlying issue in the Javarosa library, this is about the best we
can do.

Yaw

··· On Tue, May 15, 2012 at 10:25 AM, Lu Gram wrote: > Hi there, > > I noticed a curious feature/bug relating to image-based forms, I'm > sure you might be aware of already, but it might be good to mention on > http://opendatakit.org/help/image-based-forms/. Currently developing a > data collection form for a project taking place in both India and > Pakistan. Hence we need localization in English, Urdu and Hindi for > all forms. The English and Urdu versions will be plain text and the > Hindi version will be image-based shots of Devnagari script. > > Let's say we have a label that should say "Village Name" in English, > Urdu and Hindi dep. on language chosen. Then we might have XML code > like this: > > > > Village Name > > .... > > > گاؤں کا نام > > .... > > > jr://images/villagename.png value> > > > However, this makes ODK Collect crash as soon as we switch to Hindi > with exception > > "org.javarosa.core.util.NoLocalizedTextException: Error loading locale > hin. There were 2 keys which were contained in this locale, but were > not properly registered in the default Locale. Any keys which are > added to a locale should always be added to the default locale to > ensure appropriate functioning" (run from Eclipse using the source > code). > > So after a bit of interpretation, I realised ODK Collect as is only > works with text rendering in one locale and image rendering in another > locale if you have a element inside every itext > element in the English version that has an image-based component in > the corresponding Hindi version. So changing the above to > > > > Village Name > > > .... > > > گاؤں کا نام > > .... > > > jr://images/villagename.png value> > > > fixed it. > > Best wishes, > > Lu > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en