From 44d53d091ee1bbff799f8171762790897641f386 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Tue, 30 Apr 2024 10:38:51 +0300 Subject: [PATCH] =?UTF-8?q?Add=20Internationalization=20documentation=20?= =?UTF-8?q?=F0=9F=93=9D=20(#3221)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Internationalization documentation 📝 * Disable autobackup - not recommended * Pin Mac OS runner version to previous stable version | Fix build 💚 --- .github/workflows/ci.yml | 8 +- android/quest/src/main/AndroidManifest.xml | 1 - .../configuring/internationalization.mdx | 111 ++++++++++++++++++ 3 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 docs/engineering/android-app/configuring/internationalization.mdx diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3fcb5a7bac..b5f4c059bec 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: jobs: engine-tests: - runs-on: macos-latest + runs-on: macos-13 strategy: matrix: api-level: [30] @@ -94,7 +94,7 @@ jobs: run: bash <(curl -s https://codecov.io/bash) -F engine -f "engine/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" geowidget-tests: - runs-on: macos-latest + runs-on: macos-13 strategy: matrix: api-level: [30] @@ -174,7 +174,7 @@ jobs: run: bash <(curl -s https://codecov.io/bash) -F geowidget -f "geowidget/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" quest-tests: - runs-on: macos-latest + runs-on: macos-13 strategy: matrix: api-level: [30] @@ -251,4 +251,4 @@ jobs: - name: Upload Quest module test coverage report to Codecov if: matrix.api-level == 30 # Only upload coverage on API level 30 working-directory: android - run: bash <(curl -s https://codecov.io/bash) -F quest -f "quest/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" \ No newline at end of file + run: bash <(curl -s https://codecov.io/bash) -F quest -f "quest/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" diff --git a/android/quest/src/main/AndroidManifest.xml b/android/quest/src/main/AndroidManifest.xml index 3115ebf4d91..827f5d1abdd 100644 --- a/android/quest/src/main/AndroidManifest.xml +++ b/android/quest/src/main/AndroidManifest.xml @@ -4,7 +4,6 @@ First Name +``` + +Translated file in Swahili + +```xml +#res/values/strings-sw.xml +Jina la kwanza +``` + +### App Configs +App config localization is required for the configuration files that define the UI and workflow of the configurable views we have on FHIR Core e.g. the Profile and Register configs. The language files are of the `.properties` format. By convention, the files are stored in the `project/app_configs/translations` folder for versioning. Once translations are in place they are then uploaded as Binary's and are therefore are encoded in Base64 format in line with the HL7 FHIR Spec here https://www.hl7.org/fhir/binary.html. These are then linked to the application via the Composition resource. Files are named in the format `strings_config.properties` for the default and `strings_sw_config.properties` for the swahili translations e.g. + +```json +#app_configs/profiles/profile.json + +"searchBar": { + "visible": true, + "display": "{{ first.name }}", + "computedRules": [ + "familyName", + "familyId" + ] +} + +``` + +Default +```properties +first.name=First Name +``` + +Swahili +```properties +first.name=Jina la kwanza +``` + +### Content Configs +This covers Internationalization in the FHIR Resources e.g. Questionnaires. The FHIR Spec defines how localization is supported - https://www.hl7.org/fhir/languages.html. FHIR Core via the FHIR SDK Standard Data Capture library supports this implementation via the _Translation Extension_. + +An example of the First Name field in a Questionnaires that is localized in Swahili. + +```json + "text": "First Name", + "_text": { + "extension": [ + { + "extension": [ + { + "url": "lang", + "valueCode": "sw" + }, + { + "url": "content", + "valueString": "Jina la kwanza" + } + ], + "url": "http://hl7.org/fhir/StructureDefinition/translation" + } + ] + } +``` + +### Rule engine rules +Special note for rules. Sometimes you need to have one part of the output as a calculated value before display. FHIR Core i18n supports wrapping the calculated expression variable using `@{`and `}` characters. e.g. + +```json +{ + "viewType": "COMPOUND_TEXT", + "primaryText": "{{ task.start.date }}", + "primaryTextColor": "#5A5A5A", + "fontSize": 14.0 +} +``` + +Default +```properties +task.start.date=Start date: @{taskStartDate} +``` + +Swahili +```properties +task.start.date=Siku ya kuanza: @{taskStartDate} +``` + + +## Translation Process via Transifex +We use the Transifex service to manage the translation process. [Transifex](https://www.transifex.com/) is a well known platform that supports localization for many stacks including Android and is able to process files in different formats/extensions as used on FHIR Core. The process is such that we upload the default language files in the `xml`, `properties` formats and then the manual translators perform the localiztion on Transifex. The files are then synced back to the codebase for versioning. + + +## Tooling +- Efsity - FHIR Core Tooling supports the localization process for the App and Content configs by automating some aspects of it. For more see the documentation here : [FHIR Core Tooling Localization](https://github.com/onaio/fhir-tooling/tree/main/efsity#localization) +- Transifex - This is the tool describe in the above section - Also check out https://www.transifex.com/