Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Version published after converting to the new editor

...

  1. Define a basic table that includes the information you'd like to store.  Here is an example of a table that stores States.  Note: I've set this table up so that its visible to all users (for simplicity).
    Image RemovedImage Added
  2. Download the table from CommCareHQ to add language information. 
    Image RemovedImage Added
  3. Modify the types sheet to identify which columns will have multiple languages.  This is done by adding an extra property on the field that will indicate the language.   This is highlighted in Red below. 

    Delete(Y/N)table_idis_global?field 1field 2field 3field 3 : property 1
    Nstateyespopulationidnamelang


  4. Modify the state sheet to add the list of states with each language.  We'll also need to modify this sheet's columns to include the additional language information.  You will need to add columns for each language supported.  The example below includes two languages, but you can add additional columns titled name: lang X and field: name X for more languages.  

    In the lang column, specify the language code used in CommCareHQ for the language.  You can find this by reviewing the language configuration page in CommCareHQ.  In this example, I've used English and Hindi.   (Note: For new rows, you can ignore the UID and Delete(Y/N) columns).  

    UIDDelete(Y/N)field: populationfield: idname: lang 1field: name 1name: lang 2field: name 2


      1000upenUttar Pradeshhinउत्तर प्रदेश  


    1500gujuratenGujurathinगुजरात  


    1583biharenBiharhinबिहार


  5. Upload the updated Excel file to CommCareHQ.  You can check "Replace Existing Tables" to replace any existing data for this table on CommCareHQ.  
    Image RemovedImage Added

  6. You can review the uploaded data by clicking the View Table link next to the table on the page.  

...

  1. First we need to setup a label that contains the language codes that you want to use in your app.  In your form, add a label with the question ID of lang-code and label text that matches the language code for each language.  We'll also set a Display Condition of 1=2 on this to ensure that it doesn't appear in the form.  This label will be used to determine which language to display, based on what language is chosen. 
    Image RemovedImage Added

  2. Now add a single or multiple answer lookup table question question to the form 
    Image RemovedImage Added
  3. Choose the Lookup Table Data item
    1. Set the lookup table to the lookup table you uploaded (ex. state)
    2. Set the value field to the column in your table you want to store (ex. id)
    3. Set the display text field to the following: name[@lang = jr:itext('lang-code-label')] . You can replace name with the column that contains multiple languages. 



  4. Update and Save your form.  Now the list of options should change their label based on what language is chosen for the application.  However, the data stored will remain the same.

...

  1. Sync your application. Some users have reported this error with large lookup tables that have not properly downloaded which choosing "Update Commcare" from the menu. Run the sync to ensure all assets are properly downloaded to the device
  2. Make sure that the current user has lookup table rows assigned to them (Creating and Updating Lookup Tables
  3. Alternatively, setup your lookup table so that it is available for all users (For the lookup table, set it up so that it is "Visible to All Users" by clicking Edit Type). 
  4. Once you've done this, make sure you've synced your phone. 

...