malaysia-api icon indicating copy to clipboard operation
malaysia-api copied to clipboard

Adding end point structure for different languages.

Open JianLoong opened this issue 2 years ago • 0 comments

Currently, all information is stored in the English language however, a more widely spoken language in Malaysia is Bahasa Malaysia or Bahasa Melayu. So, all entries should have a translated version in the national language itself.

All information with regards to the states can be found in the Wikipedia Bahasa Malaysia for example an entry for Selangor can be found here. essentially the BM entry of Wikipedia for the state of Selangor.

There are a few ways this can be approached either.

  1. Create more directories for example using endpoints like /malaysia-api/state/v1/en/selangor.json to denote that it would be in the English language and /malaysia-api/state/v1/zsm/selangor.json to denote that it would be in Bahasa Malaysia. With zsm denoting that it is standard Malay as per ISO specification here.. Basically, this way would involve creating a directory that house another set of JSON files in the Malay language.

  2. Introduce more fields into the JSON file itself and use _en and _zsm postfix to denote the language. So for example, instead of a single description string in the Selangor.json there would be two. One for the English description and another for the Malay description. (This just means, putting an extra description_zsm in the json file itself)

Both ways have their benefits and their disadvantages.

Notes.

It is indeed possible to use the Content-Negotiation strategy as mentioned here but it was decided not to do so.

30/09/2022 - Included notes regarding Content Negotiation as mentioned in the Stack Overflow post. Also edited post for clarity.

JianLoong avatar Oct 16 '21 08:10 JianLoong