Internationalization for OpenMRS Core model entities

OpenMRS being a multilingual software (and especially with increasing cloud based provisions), I was wondering how others have gone about internationalising some meta information which are dynamic in nature.

  1. Attributes - Person, Location, Provider etc - e.g. if I use a custom attribute “department” - how would I go about providing translations for different languages?
  2. Encounter and Visit Type - same as above.
  3. Addresses

attn: @mksrom

Just in case: https://issues.openmrs.org/browse/TRUNK-51

thanks @dkayiwa. The spec seems to suggest an interface that would be able to manage the “key” (default locale or specified). However, I am wondering what and how would the “key” be.

take for example, a person attribute - “relative’s phone number”, or a provider attribute - ‘designated department’. What approach would you take to form a key and when?

  1. You could potentially create a key out of it (maybe even prefixed by something contextual) - e.g. RELATIVES_PHONE_NUMBER or PERSON_ATTR_RELATIVES_PHONE_NUMBER.

  2. What would be the right time to fetch the translation?

  • would the REST api send over the translated value to the requester? and then its upto the requester to make the appropriate call to fetch the translation by forming the “key”?

Are you asking for a key like this? ui.i18n.PersonAttributeType.name.uuid? Where uuid is replaced by the actual uuid value.

It is taken care of in the base class of the resource as the display property: https://github.com/openmrs/openmrs-module-webservices.rest/blob/bff28f99d0866e8ea2589ff8ff6d9f29d38ec820/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/resource/impl/MetadataDelegatingCrudResource.java#L158-L176