Summary page translation

Hi Sheel,
Thanks for your answer. However I am not I totally understand you: could you give me a code example?
Many thanks,
Charles

··· Sheel Shah wrote:

Hi Charles,

Instead of putting the logic to calculate a summary inside a hidden value, you could directly put the logic for this inside the label question.

So instead of your label being 'Summary: ', you could change it to Summary: .

Then you can slightly modify the logic in the different labels for English and Burmese to change the concatenated text as needed.

Thanks!

Sheel

On Sun, Jun 22, 2014 at 3:47 AM, Charles Flèche mhealth-myanmar@tsfi.org wrote:

Hi everyone,

We want to implement a summary of actions to do at the end of a form, something like :
"Consultation summary :

  • Refer within 24H
  • Give pain killers
  • Etc"

We took example on the m4Change application. As such we have :

  • a “Label” screen containing
  • a hidden “action_summary” value that is a concatenation of other action strings : concat(/anc/action1, /anc/action2,…)
  • action strings where the logic either return a null string (if it doesn’t need to be displayed) or a string : if(selected(/anc/fundus_height, “high_ftt”) or selected(/anc/fundus_height, “low_ftt”), "Abnormal fundus Refer for follow up ---- ", “”)

While hacky, it works well. But what would be the way to manage translations ? I see two ways :

  1. Putting the translation in the action strings
    We would have someting like this :

if need_to_display_this_action
if language1
return language1_string
if language2
return language2_string
else
return null_string

How can the current language be queried in a hidden value calculate condition ?

  1. Create hidden values for each translation of each action string

Summary screen :
English: Summary
Burmese: အက်ဥ္း

/anc/action_summary_en
concat(/action1_en, /action2_en, …)

/anc/action_summary_mmr
concat(/action1_mmr, /action2_mmr, …)

/action1_en
if need_to_display_action1
return action1_string_en
else
return null

/action1_mmr
if need_to_display_action1
return action1_string_mmr
else
return null

The solution 1 seems better as the need_to_display_action* don’t have to be duplicated for each language. We can think of extracting the condition on need_to_display_action* conditions in their own hidden values, but suddenly we triple the number of hidden values and it somewhat feels “wrong”.

What do you guys think ? Is there a better way ?

Many thanks,


Charles Flèche
mHealth advisor
Télécoms Sans Frontières http://www.tsfi.org
Première Urgence - Aide Médicale Internationale http://www.pu-ami.org
+95 9 431 978 25
Skype: charles.fleche


You received this message because you are subscribed to the Google Groups “commcare-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hey Charles,

Sure, here’s a quick example:

EN:

Burmese:

Thanks,
Sheel

··· On Mon, Jun 23, 2014 at 8:26 PM, Charles Flèche wrote:

Hi Sheel,
Thanks for your answer. However I am not I totally understand you: could
you give me a code example?
Many thanks,
Charles

Sheel Shah sshah@dimagi.com wrote:

Hi Charles,

Instead of putting the logic to calculate a summary inside a hidden value,
you could directly put the logic for this inside the label question.

So instead of your label being 'Summary: ', you could change it to Summary: .

Then you can slightly modify the logic in the different labels for English
and Burmese to change the concatenated text as needed.

Thanks!
Sheel

On Sun, Jun 22, 2014 at 3:47 AM, Charles Flèche mhealth-myanmar@tsfi.org wrote:

Hi everyone,

We want to implement a summary of actions to do at the end of a form,
something like :
"Consultation summary :

  • Refer within 24H
  • Give pain killers
  • Etc"

We took example on the m4Change application. As such we have :

  • a “Label” screen containing
  • a hidden “action_summary” value that is a concatenation of other action
    strings : concat(/anc/action1, /anc/action2,…)
  • action strings where the logic either return a null string (if it
    doesn’t need to be displayed) or a string : if(selected(/anc/fundus_height,
    “high_ftt”) or selected(/anc/fundus_height, “low_ftt”), "Abnormal fundus
    Refer for follow up ---- ", “”)

While hacky, it works well. But what would be the way to manage
translations ? I see two ways :

  1. Putting the translation in the action strings
    We would have someting like this :

if need_to_display_this_action
if language1
return language1_string
if language2
return language2_string
else
return null_string

How can the current language be queried in a hidden value calculate
condition ?

  1. Create hidden values for each translation of each action string

Summary screen :
English: Summary
Burmese: အက်ဥ္း

/anc/action_summary_en
concat(/action1_en, /action2_en, …)

/anc/action_summary_mmr
concat(/action1_mmr, /action2_mmr, …)

/action1_en
if need_to_display_action1
return action1_string_en
else
return null

/action1_mmr
if need_to_display_action1
return action1_string_mmr
else
return null

The solution 1 seems better as the need_to_display_action* don’t have to
be duplicated for each language. We can think of extracting the condition
on need_to_display_action* conditions in their own hidden values, but
suddenly we triple the number of hidden values and it somewhat feels
"wrong".

What do you guys think ? Is there a better way ?

Many thanks,


Charles Flèche
mHealth advisor
Télécoms Sans Frontières http://www.tsfi.org
Première Urgence - Aide Médicale Internationale http://www.pu-ami.org
+95 9 431 978 25
Skype: charles.fleche


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

<b


Sheel Shah
Project Manager | Dimagi
m: +1.781.428.5419 | skype: sheel_shah

Hi Sheel,

··· On 24/06/2014 09:33, Sheel Shah wrote: > Sure, here's a quick example: > > EN: > > > Burmese: >

Many thanks, I better see what you mean. It is not ideal because there
are a lot of code duplication with this method (the concats and the
ifs), but it is definitely better than what I had so far. I’ll implement
your idea, seems like the best compromise for now.

Many thanks for your support,


Charles Flèche
mHealth advisor
Télécoms Sans Frontières http://www.tsfi.org
Première Urgence - Aide Médicale Internationale http://www.pu-ami.org
+95 9 431 978 25
Skype: charles.fleche