Localization of the constraint message

Hello,

My name is Ray Brunsting and, with some help and encouragement from Mohini
Bhavsar, I am working on a prototype pregnancy application using CommCare.
This week I have learned quite a bit about CommCare, and am impressed so
far. Thanks and keep up the great work!

Although the application will used by Spanish speaking users (click here for
background infohttp://mobileactive.org/case-studies/close-and-personal-tulasaluds-m-health-work-guatemala),
it will sometimes be used by English speakers (ie. myself) and users who
speak one of the many local languages of Guatemala. Similar to many
CommCare deployments, I expect, application localization is a significant
need.

Well, to get to the point of this message, I’m wondering how I can localize
the ‘Constraint Message’ that is displayed to users when they enter an
invalid value. I’ve tried doing this with the Vellum form designer (see
below), but the resulting XML does not use the ‘itext’-based localization,
as far as I can tell. Here is the resulting XML:

<bind nodeset="/comunes_consulta/patient_code" type=“xds:int"
constraint=”.>= 11001 and .<=11999" jr:constraintMsg=“Must be between
11000 and 11999”
required=“true()” />

If there is existing documentation in the Wiki or elsewhere related to this,
I’d appreciate a pointer.

On a somewhat related point, I’d appreciate knowing how to display the
’hint’ value on my Nokia 5130 – the hint automatically shows up below the
label on my Andriod phone, but I can’t figure out if/how to show it on my
Nokia.

Thanks, Ray Brunsting

https://lh5.googleusercontent.com/-QZReJ_fcYvs/TnuboHgtjII/AAAAAAAADv4/rPjCgBcuxcc/CommCareLocalizeQuestion.png

Hi Ray!

It's always good to have new people join our growing community :slight_smile:

I'm the the author of Vellum so let me respond to that query first:
I'm checking with our other engineers about the constraintMsg localization.
Up until very recently constraint messages were not localizable due to a
limitation of the software engine we wrote (that runs behind the scenes on
both android and Nokia type phones). This may have changed recently which
means we'll have to put that functionality in Vellum once we know it's
supported. Unfortunately, it's not possible to localize constraintMsg text
in Vellum right now but I'll let you know what that status on that is once I
find out a little more.

Regarding hints, I believe that hints are not supported on the Nokia type
platforms. This was a design decision based on the fact that screen size is
a lot smaller compared to the Android type phones. If possible I'd
recommend you avoid hints unless you plan on primarily running CommCare on
Android type devices.

Cheers,
Anton

··· On Fri, Sep 23, 2011 at 3:37 AM, Ray B wrote:

Hello,

My name is Ray Brunsting and, with some help and encouragement from Mohini
Bhavsar, I am working on a prototype pregnancy application using CommCare.
This week I have learned quite a bit about CommCare, and am impressed so
far. Thanks and keep up the great work!

Although the application will used by Spanish speaking users (click here
for background infohttp://mobileactive.org/case-studies/close-and-personal-tulasaluds-m-health-work-guatemala),
it will sometimes be used by English speakers (ie. myself) and users who
speak one of the many local languages of Guatemala. Similar to many
CommCare deployments, I expect, application localization is a significant
need.

Well, to get to the point of this message, I'm wondering how I can localize
the 'Constraint Message' that is displayed to users when they enter an
invalid value. I've tried doing this with the Vellum form designer (see
below), but the resulting XML does not use the 'itext'-based localization,
as far as I can tell. Here is the resulting XML:

<bind nodeset="/comunes_consulta/patient_code" type="xds:int"
constraint=".>= 11001 and .<=11999" jr:constraintMsg="Must be
between 11000 and 11999"
required="true()" />

If there is existing documentation in the Wiki or elsewhere related to
this, I'd appreciate a pointer.

On a somewhat related point, I'd appreciate knowing how to display the
'hint' value on my Nokia 5130 -- the hint automatically shows up below the
label on my Andriod phone, but I can't figure out if/how to show it on my
Nokia.

Thanks, Ray Brunsting

https://lh5.googleusercontent.com/-QZReJ_fcYvs/TnuboHgtjII/AAAAAAAADv4/rPjCgBcuxcc/CommCareLocalizeQuestion.png

--
Anton de Winter
Dimagi Inc http://www.dimagi.com
(617) 692 0786
529 Main St
Charlestown, MA
02129

Hi Anton,

Thanks for your feedback. Very helpful.

Re: localization of constraintMsg
If you end up finding out that constraintMsg localization can be done
’behind-the-scenes’ (ie. via XML), that would be fine for now. Our initial
forms are pretty simple and I’m actually using a combination of Excel,
Notepad++, cut-and-paste and Vellum to create and maintain the XForm XML.
While not a scalable long term solution, it has helped me learn quite a bit
of XForms. So, I could quite easily update my ‘development’ process to
inject some additional XML code if the engine supports it.

Re: other Vellum feedback and questions
A few other things I have noticed and wondered about…
a) I have noticed that Vellum sometimes injects a bunch of unused
translation “text id” attributes into the XML (ie. question32, question33).
I normally end up replacing al of the translation XML with generated
content, so it does not really affect me, but I thought I would mention it.
b) I make extensive use of the Advanced ‘View Source’ and 'Load Source’
operations, and it seems like I always need to hit ‘View Source’ before
hitting ‘Load Source’. If I don’t first ‘View’ the source, I end up with an
empty window when trying to Edit/Load source.
c) I have has several times when simply ‘tabbing’ into the “Audio URI” field
injects an empty audio XML attribute into my form that triggers an error. I
end up manually removing the inserted tag to eliminate the error.
d) I have been using the ‘Trigger’ data type as a type of ‘information
screen’ in my application, but I’m not sure if this is right. (e.g. to
include an initial ‘welcome’ and final ‘thanks’ message to the end user).
Is this an intended use of the ‘Trigger’?
e) I’m not sure what several of the ‘Advanced Properties’ are for, and don’t
use many of them. Do you have a Wiki page with any additional information
about these properties.

Thanks, Ray

Hi Ray,

Thanks for your attention to detail as you use our tools! As you’ve seen,
Vellum is still under development and does not yet support all xform
capabilities. Some of the items in your list are known bugs that our team is
currently working to fix, but others are new to us – thanks for bringing
them to our attention. We love getting user feedback and will certainly use
yours as we continue to develop Vellum.

In the future, if you encounter a bug in our systems you can report it
directly to our development team using our bug reporting template:
https://wiki.commcarehq.org/display/commcarepublic/Bug+Report+Template

As of CommCare 1.2, the constraint message can be localized in the xform.
(We recommend that you use CommCare 1.2 anyway, since that’s the latest
tested version.) To do this, you can use an itext reference as the
constraintMsg attribute: “jr:itext(‘message_key’)”. Then you can define
your translations for each language in the itext, just as if it was regular
question text.

Thanks for your feedback! Let us know if you’d like further clarification
on anything.

Amelia

··· On Fri, Sep 23, 2011 at 9:24 AM, Ray B wrote:

Hi Anton,

Thanks for your feedback. Very helpful.

Re: localization of constraintMsg
If you end up finding out that constraintMsg localization can be done
’behind-the-scenes’ (ie. via XML), that would be fine for now. Our initial
forms are pretty simple and I’m actually using a combination of Excel,
Notepad++, cut-and-paste and Vellum to create and maintain the XForm XML.
While not a scalable long term solution, it has helped me learn quite a bit
of XForms. So, I could quite easily update my ‘development’ process to
inject some additional XML code if the engine supports it.

Re: other Vellum feedback and questions
A few other things I have noticed and wondered about…
a) I have noticed that Vellum sometimes injects a bunch of unused
translation “text id” attributes into the XML (ie. question32,
question33). I normally end up replacing al of the translation XML with
generated content, so it does not really affect me, but I thought I would
mention it.
b) I make extensive use of the Advanced ‘View Source’ and 'Load Source’
operations, and it seems like I always need to hit ‘View Source’ before
hitting ‘Load Source’. If I don’t first ‘View’ the source, I end up with an
empty window when trying to Edit/Load source.
c) I have has several times when simply ‘tabbing’ into the "Audio URI"
field injects an empty audio XML attribute into my form that triggers an
error. I end up manually removing the inserted tag to eliminate the error.
d) I have been using the ‘Trigger’ data type as a type of ‘information
screen’ in my application, but I’m not sure if this is right. (e.g. to
include an initial ‘welcome’ and final ‘thanks’ message to the end user).
Is this an intended use of the ‘Trigger’?
e) I’m not sure what several of the ‘Advanced Properties’ are for, and
don’t use many of them. Do you have a Wiki page with any additional
information about these properties.

Thanks, Ray


Amelia Sagoff

Hi Amelia,

I successfully encoded and tested localized constraint messages on my Nokia
phone. However, the Android version (at least using the version of
CommCareODK that I am using) does not appear to support constraint message
localization. (ie. rather than displaying a localized string, it displays “
jr:itext(‘message_key’)”. This is not a big deal for me at the moment, but
I thought I would mention it.

Here is exact copy of my bind statement.

<bind nodeset="/consultation/community_code" type=“xsd:int"
constraint=”.>= 1603001 and .<= 1630075 and not((.>= 1603029 and
.<= 1608000)) and not((.>= 1608077 and .<= 1611000)) and
not((.>= 1611017 and .<= 1612000)) and not((.>= 1612082 and .<=
1613000)) and not((.>= 1613042 and .<= 1615000)) and not((.>=
1615052 and .<= 1617000)) and not((.>= 1617015 and .<= 1630000))" *
jr:constraintMsg=“jr:itext(‘community_code_error’)”* required=“true()”/>

Perhaps my custom version of ODK Collect (V1.1.5.13custom) is out-of-date (I
did re-install the application from
http://build.dimagi.com/commcare/opendatakit-collect.apk, in case my local
version was out-of-date).

Ray

Ray,

ODK and the commcare binaries do generally go back and forth a bit in terms
of compatibility. Localized constraint messages are relatively new and may
not be in odk core just yet. We’ll be rolling out a new version of ccodk
which will be caught up to the latest binary and have it rolled into the
commcare binary fairly soon. I’ll send updates to this list as they arrive.

-Clayton

Hi Amelia,

I successfully encoded and tested localized constraint messages on my
Nokia
phone. However, the Android version (at least using the version of
CommCareODK that I am using) does not appear to support constraint
message
localization. (ie. rather than displaying a localized string, it displays
"
jr:itext(‘message_key’)". This is not a big deal for me at the moment, but

I thought I would mention it.

Here is exact copy of my bind statement.

<bind nodeset="/consultation/community_code" type=“xsd:int"
constraint=”.>= 1603001 and .<= 1630075 and not((.>= 1603029 and
.<= 1608000)) and not((.>= 1608077 and .<= 1611000)) and
not((.>= 1611017 and .<= 1612000)) and not((.>= 1612082 and
.<=

··· On Oct 6, 2011 4:19 PM, "Ray B" wrote: > 1613000)) and not((.>= 1613042 and .<= 1615000)) and not((.>= > 1615052 and .<= 1617000)) and not((.>= 1617015 and .<= 1630000))" * > jr:constraintMsg="jr:itext('community_code_error')"* required="true()"/> > > > Perhaps my custom version of ODK Collect (V1.1.5.13custom) is out-of-date (I > did re-install the application from > http://build.dimagi.com/commcare/opendatakit-collect.apk, in case my local

version was out-of-date).

Ray