xmlformstranslationodk

GeoODK Collect forms not translating when switching phone's language


as the title says, when I specify a translation language for the labels of the xml form, and I go switch my mobile's language to the specified language, the application itself gets translated properly but the forms stay in English.

At first I wanted to translate to arabic and I specified العربية as language translation. Nothing happened. I referred to the documentation and specified "label::Español" to detect spanish and translate when spanish is used on the phone, as I thought maybe "العربية" wasn't the right selector for arabic. Still with Español, the forms remained untranslated.

I need anyone with experience on ODK Collect Form translation to help me with this. The XML I used:

<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <h:head>
        <h:title>arabic sample</h:title>
        <model>
          <itext>
            <translation default="true()" lang="default">
              <text id="/sampletest/select_example/yes:label">
                <value>Yes</value>
              </text>
              <text id="/sampletest/select_example/no:label">
                <value>No</value>
              </text>
              <text id="/sampletest/select_example:label">
                <value>This is a select_one type question.</value>
              </text>
            </translation>
            <translation lang="العربية">
              <text id="/sampletest/select_example/yes:label">
                <value>نعم</value>
              </text>
              <text id="/sampletest/select_example/no:label">
                <value>كلا</value>
              </text>
              <text id="/sampletest/select_example:label">
                <value>اختر واحد</value>
              </text>
            </translation>
          </itext>
          <instance>
            <sampletest id="arabic sample">
              <select_example/>
              <required_text/>
              <datetime_test/>
              <geopoint_test/>
              <meta>
                <instanceID/>
              </meta>
            </sampletest>
          </instance>
          <bind nodeset="/sampletest/select_example" type="select1"/>
          <bind nodeset="/sampletest/required_text" required="true()" type="string"/>
          <bind nodeset="/sampletest/datetime_test" type="dateTime"/>
          <bind nodeset="/sampletest/geopoint_test" type="geopoint"/>
          <bind calculate="concat('uuid:', uuid())" nodeset="/sampletest/meta/instanceID" readonly="true()" type="string"/>
        </model>
      </h:head>
      <h:body>
        <select1 ref="/sampletest/select_example">
          <label ref="jr:itext('/sampletest/select_example:label')"/>
          <hint>In the type column you must include the name of a choices list that sets the available options. Choices lists are specified on the choices sheet.</hint>
          <item>
            <label ref="jr:itext('/sampletest/select_example/yes:label')"/>
            <value>Yes</value>
          </item>
          <item>
            <label ref="jr:itext('/sampletest/select_example/no:label')"/>
            <value>no</value>
          </item>
        </select1>
        <input ref="/sampletest/required_text">
          <label>Required field</label>
          <hint>You have to enter something to continue.</hint>
        </input>
        <input ref="/sampletest/datetime_test">
          <label>Enter a date and a time:</label>
        </input>
        <input ref="/sampletest/geopoint_test">
          <label>Record your location:</label>
          <hint>GPS coordinates can only be collected when outside.</hint>
        </input>
      </h:body>
    </h:html>

Solution

  • I think your XForm might be okay. Did you switch the form language in ODK Collect itself after loading the form? (click menu button when you're in the form view). I believe that's the only way to change the form language.