跳转至
For the complete DHIS2 documentation index, see llms.txt.

I18n{ #i18n }

语言环境

DHIS2 支持用户界面和数据库的翻译 内容。

UI语言环境

您可以通过以下方式检索用户界面的可用区域设置 以下资源带有 GET 请求。 XML 和 JSON 资源 支持表示。

/ api / 33 / locales / ui

数据库内容语言环境

Name Measles doses and code MEASLES_DOSE

用代码YELLOW_FEVER_DOSE命名_黄热病剂量_

翻译

Observe that the root org unit Sierra Leone has the code OU_525, which is equal to the source instance.

Open an HTTP tool such as Postman and put together the following aggregate data exchange payload in JSON.

获取翻译

请注意,期间为202201或_2022 年1 月_。请注意,时间段可能需要随着时间的推移而更新。

Run the POST request to create the aggregate data exchange definition. Confirm that the API response status code is 201. Note that the name of the data exchange is unique. Take a note of the ID of the newly created object by looking at response > uid in the response body.

Run the newly created data exchange with a POST request (replace {id} with the ID of the data exchange): Confirm that the API response indicates that three data values were successfully imported.

在**目标**实例中,导航到*数据录入*应用项目,选择组织单位_塞拉利昂_、数据集_数据交换_和期间_2022 年 1 月_。观察交换的数据值在表单中是否可见。

创建/更新翻译{ #createupdate-translations }

I18n

语言环境 { #webapi_locales }

DHIS2 支持用户界面和数据库的翻译 内容。

UI locales

您可以通过以下方式检索用户界面的可用区域设置 以下资源带有 GET 请求。 XML 和 JSON 资源 支持表示。

/ api / 33 / locales / ui

Database content locales

You can retrieve and create locales for the database content with GET and POST requests through the dbLocales resource. XML and JSON resource representations are supported. To POST data, there are two required parameters: country and language.

/api/locales/dbLocales?country=US&language=en 描述
名称 That means you can retrieve and update translations using metadata class resources such as api/dataElements, api/organisationUnits, api/dataSets, etc.
Get translations You can get translations for a metadata object such as DataElement by sending a GET request to api/dataElements/{dataElementUID}
描述 ```json
{
"id": "fbfJHSPpUQD",
"href": "https://play.dhis2.org/dev/api/29/dataElements/fbfJHSPpUQD",
"created": "2010-02-05T10:58:43.646",
"name": "ANC 1st visit",
"shortName": "ANC 1st visit",
"translations":
[
{
"property": "SHORT_NAME",
"locale": "en_GB",
"value": "ANC 1st visit"
},
{
"property": "NAME",
"locale": "fr",
"value": "Soin prénatal 1"
},
{
"property": "NAME",
"locale": "en_GB",
"value": "ANC 1st visit"
}
]
}
```

下表列出了支持翻译的类。

{
  "translations": 
  [
    {
      "property": "SHORT_NAME",
      "locale": "en_GB",
      "value": "ANC 1st visit"
    },
    {
      "property": "NAME",
      "locale": "fr",
      "value": "Soin prénatal 1"
    },
    {
      "property": "NAME",
      "locale": "en_GB",
      "value": "ANC 1st visit"
    }
  ]
}

| Create/Update translations | 描述 | json { "translations": [ { "property": "SHORT_NAME", "locale": "en_GB", "value": "ANC 1st visit" }, { "property": "NAME", "locale": "fr", "value": "Soin prénatal 1" }, { "property": "DESCRIPTION", "locale": "fr", "value": "description in french" }, { "property": "FORM_NAME", "locale": "fr", "value": "name in french" } ] } | |---|---|---| | Alternatively, you can also just update the object with payload including the translations property. | 类别选项 | | | json { "id": "fbfJHSPpUQD", "created": "2010-02-05T10:58:43.646", "name": "ANC 1st visit", "shortName": "ANC 1st visit", "translations": [ { "property": "SHORT_NAME", "locale": "en_GB", "value": "ANC 1st visit" }, { "property": "NAME", "locale": "fr", "value": "Soin prénatal 1" }, { "property": "NAME", "locale": "en_GB", "value": "ANC 1st visit" } ] } | 类别 | | | The common properties which support translations are listed in the table below. | 不 | | | 数据元素 | 数据元素 | | | 删除来源,添加目标 | 数据元素组 | | | shortName | Object short name | | | 指示符 | 指示符 | 下表列出了支持翻译的类。 | | Table: Class names | Class name | | | 删除源指标,增加目标指标 | Other translatable Properties | | | DataElementCategoryOption | 类别选项 | | | 组织单位 | 组织单位 | | | DataElementCategoryCombo | 组织单位组 | | | 数据元素 | 数据元素 | | | 数据集 | 资料集 | | | 删除源指标,增加目标指标 | Data element group set | | | Attribute for metadata | 指示符 | numeratorDescription, denominatorDescription | | IndicatorType | Indicator type | | | 程序 | 程序 | IndicatorGroupSet | | 程序阶段 | 程序阶段 | 组织单位 | | 跟踪实体属性 | 跟踪实体属性 | | | OrganisationUnitGroupSet | Organisation unit group set | | | 关系类型 | 资料集 | Section | | 选项集 | 网址 | | | 属性 | Validation rule group | | | 项目通知模板 | 项目 | TrackedEntity | | 项目阶段 | 项目阶段 | TrackedEntity | | 跟踪实体属性 | 跟踪实体属性 | TrackedEntity | | 将任何源引用替换为目标引用作为排序维度 | 将任何源引用替换为目标引用作为排序维度 | Relationship type for tracked entity instances | | 项目规则行动 | 选项集 | 项目规则--动作类型 | | 预测变量 | 预测变量 | 属性 | | Attribute for metadata | Attribute for metadata | Program Notification template |

国际化

为了检索翻译字符串的键值对,您可以使用 i18n 资源。

/ api / 33 / i18n

端点位于 /api/i18n 并且请求格式是一个简单的 键值对数组:

[
  "access_denied",
  "uploading_data_notification"
]

请求必须是 POST 类型并使用 application/json 作为 内容类型。使用 curl 的示例,假设请求数据已保存 作为文件keys.json:

curl -d @keys.json "play.dhis2.org/demo/api/33/i18n" -X POST
  -H "Content-Type: application/json" -u admin:district

结果将如下所示:

{
  "access_denied":"Access denied",
  "uploading_data_notification":"Uploading locally stored data to the server"
}