Is it possible to change the name of a database locale?

Can I change the name of a given locale? For example, could I change name the property of the “English” locale to read “Klingon” and then add Klingon translation strings?

If this is possible I assume I would use a PUT request via the API, or perhaps I can POST a whole new Locale?

EDIT: I got a 405 “Method not supported” error for all three: PUT, PATCH, and POST on the /api/locales/db endpoint

2 Likes

Hi @chase.freeman,

You are right, I’m able to reproduce this when using the POST even though the docs state that it is possible:

Database content locales

You can retrieve and create locales for the database content with GET and POST requests through the following resource. XML and JSON resource representations are supported.

/api/33/locales/db

@chase.freeman would you like to create a Jira bug issue on jira.dhis2.org and we could follow up on this? It’s either a bug or there’s a change that we need to update the docs. (:

Thanks! :+1:

No I don’t think it is a bug but would rather lack of documentation. By tracing the network request I think there are required parameters (country and language) in order to POST a new locale. See below for example:

https://play.dhis2.org/2.37.5/api/29/locales/dbLocales?country=IT&language=te

Anyway, part of what I was trying to do is covered in maintenance > other > locales … I just didn’t know it :smile:

3 Likes

Great! Thanks! I tested it as well using the API and it’s working when using dbLocales + parameters. I’m glad it’s working, would you like to create a pull request to fix the docs?

Thanks! :+1:

Qapla’!

1 Like

Done :check: Update i18n.md by chaseTfreeman · Pull Request #990 · dhis2/dhis2-docs · GitHub

Thanks for the quick link @Gassim

1 Like

Sure @chase.freeman! I added my review with link to this topic post and confirmation. Thanks for the update! :+1:

It’s great to see community members helping with keeping the docs up to date! :pray:

1 Like