onaio / fhir-tooling

A command line utility to support FHIR Core content authoring
Other
2 stars 1 forks source link

Configs extraction and localization enhancements #69

Closed lincmba closed 10 months ago

lincmba commented 10 months ago

Addresses two things:

Fixes https://github.com/onaio/fhir-tooling/issues/68 , Fixes https://github.com/onaio/fhir-tooling/issues/62

Engineer Checklist

ndegwamartin commented 10 months ago

I ran the tool, here are some observations.

Command:

java -jar build/libs/fhircore-tooling-2.3.1-SNAPSHOT-release.jar translate -m extract -rf ~/Workspace/path/to/app_configs/ -et configs
  1. It was able to successfully generate the strings_configs.properties file but the original json config files are not replaced with the placeholder values i.e. title: {{ 0aa0ff9c7f02dbddf3009006720e487a }} . Is this scoped to be handled by the merge command? I think it should be part of the extract

  2. I wonder if we should consider backward compatibility with existing translations or just force all projects to migrate?

See extraction below. Here I ran the tool with some pre-existing previously localized configs. Looking at the last entry it adds the translates value as the already human localized version of the value.

0aa0ff9c7f02dbddf3009006720e487a=Patient profile configuration
31d4eed7402fbe85169766614762b524=Inventory profile configuration
d0c7235ab0bbcaa7abe7e1f6cd596acf={{ search.name.or.id }}

Perhaps the easiest way to fix this is to search for the "{{" placeholder literal and skip extraction for that element. This way the two (manual and tooling) approaches could co-exist.

The alternative is to force replace the existing manual placeholders with newly generated ones that follow the tooling format.

lincmba commented 10 months ago

@ndegwamartin Following our discussion and to address the above comment, this is now updated to perform the following:

output:

  1. config.json
    {
    "title": "{{ ad311e7b380238310da8fae4b28236ca }}"
    }
  2. strings_config.properties
    old.title.format=Old Title Format
    ad311e7b380238310da8fae4b28236ca=This is a title

This is also backward compatible with former translation standards as items in {{ ...}} are not extracted. Both translations can work together in this.