Skip to content

Latest commit

 

History

History
172 lines (144 loc) · 7.29 KB

DEVELOPER_GUIDE.md

File metadata and controls

172 lines (144 loc) · 7.29 KB

Developer guide

We're glad you're here. dashboards-i18n is a community driven plugin for localization. To use it, here's what you need to do.

Forking and Cloning

Fork this repository on GitHub, and clone locally with git clone.

Environment Setup

  1. Download OpenSearch. You could clone the OpenSearch repo, use docker or artifact. Make sure the version matches the OpenSearch Dashboards version.

  2. Setup the environment to run OpenSearch Dashboards. You will need to install node.js, nvm, and yarn in your environment to properly pull down dependencies to build and bootstrap.

  3. Download the OpenSearch-Dashboards source code.

    See the OpenSearch Dashboards developer guide for more instructions on setting up your development environment.

  4. Change your node version to the version specified in .node-version inside the OpenSearch-Dashboards root directory.

  5. cd into the plugins directory of the OpenSearch-Dashboards source code directory. Clone dashboards-i18n into the plugins directory. Ultimately, your directory structure should look like this:

.
├── OpenSearch-Dashboards
│   └── plugins
│       └── dashboards-i18n
  1. Make sure the version of dashboards-i18n plugin in the opensearch_dashboards.json file matches the version of OpenSearch Dashboards. If the version needs to be updated, you can use the provided script to automatically update the opensearchDashboardsVersion in the opensearch_dashboards.json file. To update the version, run the following command in the dashboards-i18n directory:
yarn update-version
  1. Config localization in dashboards-i18n. Add a locale json file in translations directory of the dashboards-i18n. Specify the path in .i18nrc.json. For example, if the locale json file you added is called zh-CN.json, the path should be "translations": ["translations/zh-CN.json"].

  2. Config localization in OpenSearch Dashboards. cd into the config directory of the OpenSearch-Dashboards source code directory. Add i18n.locale: "{your locale}" in opensearch_dashboards.yml file.

  3. Run yarn osd bootstrap under Opensearch-Dashboards.

Run

  • yarn start

    • Starts OpenSearch-Dashboards and includes this plugin. A localized OpenSearch-Dashboards will be available on localhost:5601.
    • Please run in the OpenSearch-Dashboards root directory
    • You must have OpenSearch running.

Example

  1. Setup environment. Please refer to Environment Setup.
  2. Config localization in dashboards-i18n. Add the following example zh-CN.json file in translations directory. In .i18nrc.json, add the path "translations": ["translations/zh-CN.json".
{
    "formats": {
        "number": {
            "currency": {
                "style": "currency"
            },
            "percent": {
                "style": "percent"
            }
        },
        "date": {
            "short": {
                "month": "numeric",
                "day": "numeric",
                "year": "2-digit"
            },
            "medium": {
                "month": "short",
                "day": "numeric",
                "year": "numeric"
            },
            "long": {
                "month": "long",
                "day": "numeric",
                "year": "numeric"
            },
            "full": {
                "weekday": "long",
                "month": "long",
                "day": "numeric",
                "year": "numeric"
            }
        },
        "time": {
            "short": {
                "hour": "numeric",
                "minute": "numeric"
            },
            "medium": {
                "hour": "numeric",
                "minute": "numeric",
                "second": "numeric"
            },
            "long": {
                "hour": "numeric",
                "minute": "numeric",
                "second": "numeric",
                "timeZoneName": "short"
            },
            "full": {
                "hour": "numeric",
                "minute": "numeric",
                "second": "numeric",
                "timeZoneName": "short"
            }
        },
        "relative": {
            "years": {
                "units": "year"
            },
            "months": {
                "units": "month"
            },
            "days": {
                "units": "day"
            },
            "hours": {
                "units": "hour"
            },
            "minutes": {
                "units": "minute"
            },
            "seconds": {
                "units": "second"
            }
        }
    },
    "messages": {
        "console.devToolsDescription": "跳过 cURL 并使用 JSON 接口在控制台中处理您的数据。",
        "console.devToolsTitle": "与 OpenSearch API 进行交互",
        "core.ui.welcomeMessage": "正在加载 OpenSearch",
        "dashboard.featureCatalogue.dashboardSubtitle": "在控制板中分析数据。",
        "discover.discoverSubtitle": "搜索和查找数据分析结果。",
        "home.addData.sectionTitle": "获取你的数据",
        "home.breadcrumbs.homeTitle": "主页",
        "home.header.title": "欢迎归来",
        "home.manageData.sectionTitle": "管理你的数据",
        "home.tutorialDirectory.featureCatalogueDescription": "从热门应用和服务中采集数据。",
        "home.tutorialDirectory.featureCatalogueTitle": "添加数据",
        "opensearchDashboardsOverview.opensearchDashboards.solution.subtitle": "可视化和分析",
        "opensearch-dashboards-react.osdOverviewPageHeader.addDataButtonLabel": "添加数据",
        "opensearch-dashboards-react.osdOverviewPageHeader.devToolsButtonLabel": "开发工具",
        "opensearch-dashboards-react.osdOverviewPageHeader.stackManagementButtonLabel": "管理",
        "opensearch-dashboards-react.pageFooter.appDirectoryButtonLabel": "查看应用目录",
        "opensearch-dashboards-react.pageFooter.changeHomeRouteLink": "登录时显示不同页面"
    }
}
  1. Config localization in OpenSearch Dashboards. Add i18n.locale: "zh-CN" in opensearch_dashboards.yml file.
  2. Run OpenSearch and OpenSearch Dashboards. Verify the login and home pages are correctly translated.

New locale

Currently, we support en/en-US (English), es/es-LA (Spanish), fr/fr-FR (French), de/de-DE (German), ja/ja-JP (Japanese), ko/ko-KR (Korean), ru/ru-RU (Russian), zh/zh-CN (Chinese). If your locale is not in it, please open an issue in OpenSearch Dashboards.

Contribute

Are you ready to contribute? You could send a PR to upload a new locale file or add up the existing locale. You could also contribute by opening an issue for any translation errors or just sharing some thoughts.