Skip to content

Commit e093834

Browse files
committed
Merge remote-tracking branch 'origin/main' into main-validate-extracted-resources
2 parents 415e647 + e485e26 commit e093834

File tree

3 files changed

+112
-2
lines changed

3 files changed

+112
-2
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,4 @@ jobs:
251251
- name: Upload Quest module test coverage report to Codecov
252252
if: matrix.api-level == 30 # Only upload coverage on API level 30
253253
working-directory: android
254-
run: bash <(curl -s https://codecov.io/bash) -F quest -f "quest/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml"
254+
run: bash <(curl -s https://codecov.io/bash) -F quest -f "quest/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml"

android/quest/src/main/AndroidManifest.xml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
<application
66
android:name=".QuestApplication"
7-
android:allowBackup="true"
87
android:enableOnBackInvokedCallback="true"
98
android:hardwareAccelerated="true"
109
android:icon="@drawable/ic_launcher"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Internationalization (i18n)
2+
3+
On FHIR Core, we have three categories of entities that need localization:
4+
1. Android views
5+
2. App configs
6+
3. Content configs (FHIR Resources)
7+
4. Rule engine rules
8+
9+
## Application localization
10+
11+
### Android Views
12+
The translations for these are found in the android app's `res/values/strings-*xml` files. These need to follow the [https://developer.android.com/guide/topics/resources/localization](android developer guidelines as documented here).
13+
As an example, for an app with English and French translations, the folder will contain `res/values/strings.xml`, the default english file and `res/values/strings-fr.xml` for the corresponding French translations.
14+
Note, for FHIR Core
15+
16+
Default file in English.
17+
```xml
18+
#res/values/strings.xml
19+
<string name="first_name">First Name</string>
20+
```
21+
22+
Translated file in Swahili
23+
24+
```xml
25+
#res/values/strings-sw.xml
26+
<string name="first_name">Jina la kwanza</string>
27+
```
28+
29+
### App Configs
30+
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.
31+
32+
```json
33+
#app_configs/profiles/profile.json
34+
35+
"searchBar": {
36+
"visible": true,
37+
"display": "{{ first.name }}",
38+
"computedRules": [
39+
"familyName",
40+
"familyId"
41+
]
42+
}
43+
44+
```
45+
46+
Default
47+
```properties
48+
first.name=First Name
49+
```
50+
51+
Swahili
52+
```properties
53+
first.name=Jina la kwanza
54+
```
55+
56+
### Content Configs
57+
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_.
58+
59+
An example of the First Name field in a Questionnaires that is localized in Swahili.
60+
61+
```json
62+
"text": "First Name",
63+
"_text": {
64+
"extension": [
65+
{
66+
"extension": [
67+
{
68+
"url": "lang",
69+
"valueCode": "sw"
70+
},
71+
{
72+
"url": "content",
73+
"valueString": "Jina la kwanza"
74+
}
75+
],
76+
"url": "http://hl7.org/fhir/StructureDefinition/translation"
77+
}
78+
]
79+
}
80+
```
81+
82+
### Rule engine rules
83+
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.
84+
85+
```json
86+
{
87+
"viewType": "COMPOUND_TEXT",
88+
"primaryText": "{{ task.start.date }}",
89+
"primaryTextColor": "#5A5A5A",
90+
"fontSize": 14.0
91+
}
92+
```
93+
94+
Default
95+
```properties
96+
task.start.date=Start date: @{taskStartDate}
97+
```
98+
99+
Swahili
100+
```properties
101+
task.start.date=Siku ya kuanza: @{taskStartDate}
102+
```
103+
104+
105+
## Translation Process via Transifex
106+
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.
107+
108+
109+
## Tooling
110+
- 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)
111+
- Transifex - This is the tool describe in the above section - Also check out https://www.transifex.com/

0 commit comments

Comments
 (0)