← Back to team overview

dhis2-devs-core team mailing list archive

Re: Problem with translations and displayName

 

Hi there,

we need to always populate the display* properties. If the locale is null,
we need to simply use the base name. E.g. for displayName just use name if
locale is null.

That way clients can always use displayName without additional checks.



On Fri, Jul 1, 2016 at 12:46 PM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> You can try it out with ?locale=XX
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Fri, Jul 1, 2016 at 5:43 PM, Morten Olav Hansen <morten@xxxxxxxxx>
> wrote:
>
>> Hi Halvdan
>>
>> All our "demo db" users have null as locale, which means default.. no
>> translation, did you remember to change the user locale?
>>
>> --
>> Morten Olav Hansen
>> Senior Engineer, DHIS 2
>> University of Oslo
>> http://www.dhis2.org
>>
>> On Fri, Jul 1, 2016 at 5:39 PM, Halvdan Grelland <halvdanhg@xxxxxxxxx>
>> wrote:
>>
>>> Hi Morten (and devs),
>>>
>>> There seems to be an issue with translations currently. The expected
>>> behaviour would be for the displayName to be populated by the translated
>>> name of the object, but this is currently not happening.
>>>
>>> Example:
>>>
>>> POST french translation of “Reproductive health” to dev:
>>>
>>> curl 'https://play.dhis2.org/dev/api/24/dataSets/QX4ZTUbOt3a/translations' -X PUT -u admin:district 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' --data-binary $'{"translations":[{"property":"NAME","locale":"en_GB","value":"PHUF 3 - Reproductive health services"},{"property":"SHORT_NAME","locale":"en_GB","value":"PHUF 3"},{"property":"NAME","locale":"fr","value":"La sant\xe9 reproductive"},{"property":"SHORT_NAME","locale":"fr","value":"La sant\xe9 reproductive"}]}'
>>>
>>> GET the object
>>>
>>> curl 'https://play.dhis2.org/dev/api/24/dataSets/QX4ZTUbOt3a?fields=displayName,translations' 'Accept: application/json, text/javascript, */*; q=0.01'
>>>
>>> Output:
>>>
>>> {
>>>   displayName: "Reproductive Health",
>>>   translations:
>>>   [
>>>     {
>>>       property: "SHORT_NAME",
>>>       locale: "fr",
>>>       value: "La santé reproductive"
>>>     },
>>>     {
>>>       property: "SHORT_NAME",
>>>       locale: "en_GB",
>>>       value: "PHUF 3"
>>>     },
>>>     {
>>>       property: "NAME",
>>>       locale: "fr",
>>>       value: "La santé reproductive"
>>>     },
>>>     {
>>>       property: "NAME",
>>>       locale: "en_GB",
>>>       value: "PHUF 3 - Reproductive health services"
>>>     }
>>>   ]
>>> }
>>>
>>> ​
>>>
>>> --
>>> Mailing list: https://launchpad.net/~dhis2-devs-core
>>> Post to     : dhis2-devs-core@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs-core
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
> --
> Mailing list: https://launchpad.net/~dhis2-devs-core
> Post to     : dhis2-devs-core@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs-core
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
lars@xxxxxxxxx
http://www.dhis2.org <https://www.dhis2.org/>

Follow ups

References