← Back to team overview

dhis2-users team mailing list archive

Re: Two translation questions ...

 

How did you import this? Sorry, I think I was being unclear before.

So the translations work as any other endpoint, which means that
/api/translations only accept -one- translation, if you want to send
multiple you need to use the /api/metadata endpoint, and wrap it in:
{
  "translations": [ ... ]
}

Probably it was related to this? if not, I will try and have a look later
today and provide a fix if necessary

--
Morten

On Mon, Dec 14, 2015 at 11:01 AM, David Hagan <david.hagan@xxxxxxxxxxxxx>
wrote:

> Hmmmm ...
>
> Here's the response I get from the destination server:
>
> {"httpStatus":"OK","httpStatusCode":200,"status":"OK","message":"Import
> was
> successful.","response":{"responseType":"ImportTypeSummary","status":"SUCCESS","importCount":{"imported":0,"updated":0,"ignored":0,"deleted":0},"type":"Translation","importConflicts":[{"object":"org.hisp.dhis.translation.Translation","value":"Validation
> Violations: [ValidationViolation{property='value', message='Required
> property missing.', value=null}]"}]}}
>
> And here's a JSON fragment from the import file  (with seemingly a 'value'
> ...
>
>     {
>       "className": "DataElement",
>       "created": "2015-02-18T09:14:04.102+0000",
>       "id": "ELNNfQ6k6Rp",
>       "lastUpdated": "2015-02-18T09:14:04.102+0000",
>       "locale": "en",
>       "objectUid": "LUOUdi4F8PU",
>       "property": "name",
>       "value": "HR_maternal health_vilage midwife"
>     },
>
> Any thoughts welcome!
>
> David
>
>
> On 14 December 2015 at 10:52, Morten Olav Hansen <mortenoh@xxxxxxxxx>
> wrote:
>
>> Hi David
>>
>> Translations have their own endpoint at /api/translations
>>
>> If you simply want to export all translations from one system and import
>> into another, you could do something like:
>> GET /api/translations.json?paging=false&fields=:owner > t.json
>>
>> Then you could just POST this into your second instance (using endpoint
>> /api/translations)
>>
>> Using the output as a template, you can easily see how to create your own
>> translations externally and then import them.
>>
>> --
>> Morten
>>
>> On Mon, Dec 14, 2015 at 8:45 AM, David Hagan <david.hagan@xxxxxxxxxxxxx>
>> wrote:
>>
>>> Morning all,
>>>
>>> I have two related questions:
>>>
>>>    - I know that in the later builds of DHIS2 one can 'extract' the
>>>    translated metadata via the API using the 'locale' argument. Is there an
>>>    easy way to extract translations from one instance and then import
>>>    translations for existing objects using this new ability (the current
>>>    approach I'm using is to extract from the translation table and 'Curl' the
>>>    resulting file into the target system)?
>>>    - Is there an easy way to prepare and import long lists of metadata
>>>    in multiple languages (e.g. we have thousands of facilities in Arabic and
>>>    English, or in another case, hundreds of option-set values in Russian,
>>>    Ukrainian and English? We've imported the initial list using the base
>>>    language, but now want to import the other two languages.
>>>
>>> Any other hints, shortcuts etc. appreciated.
>>>
>>> David
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>

Follow ups

References