Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[I18n De-Angular] Remove angular-related parts of OpenSearch Dashboards i18n system #4018

Closed
ananzh opened this issue May 12, 2023 · 4 comments
Assignees
Labels
de-angular de-angularize work technical debt If not paid, jeapardizes long-term success and maintainability of the repository. v2.11.0

Comments

@ananzh
Copy link
Member

ananzh commented May 12, 2023

Introduction

OpenSearch Dashboards i18n system has two parts:

  • the i18n tools in src/dev/i18n directory
  • osd-i18n package

the i18n tools

The i18n tools is a set of developer tools for handling internationalized messages in the source code. Its primary functions include:

  • Extraction: This tool scans the source code to find and extract default messages. These messages are placed into a JSON file. This is a crucial step because it gathers all the messages that need to be translated.
  • Integration: After the translations are provided, this tool helps in integrating them back into the application. It verifies that the locale file is correct, finds any unused/missing messages, checks for key duplications, and etc. If everything works well, it organizes the messages and creates JSON files.
  • Validation: The validation function checks the internationalized labels and ensures they don't conflict with existing translations.

osd-i18n

The osd-i18n is a runtime library used for translating messages in the user interface based on the user's locale. It works in multiple environments (browser, NodeJS) and is compatible with several UI frameworks (ReactJS, AngularJS). It uses the JSON files generated by src/dev/i18n to provide translated messages to the user. When the application is running, it uses osd-i18n package to display the correct translations to the user. The package fetches the appropriate translations based on the user's set locale, and these translations are then displayed in the user interface. It uses i18n engine under the hood.

To summarize, src/dev/i18n is used during the development process to extract, integrate, and validate internationalized messages, while osd-i18n is used at runtime to provide translated messages to the user.

De-Angular task

the i18n tools

  • Remove the html.js extractor (src/dev/i18n/extractors/html.js): This file is responsible for parsing Angular HTML files and extracting translatable strings. We should completely remove it and related tests.
  • Check the index.js and other files in src/dev/i18n directory: Check any files that coordinate the extraction process and use the different extractors. Make sure that we no longer use the html.js extractor.
  • Update test and document

osd-i18n

osd-i18n includes both React and AngularJS versions of the i18n system. The AngularJS system is a wrapper around the main i18n engine, and it consists of four main components: a provider, a service, a directive, and a filter. We need to completely remove packages/osd-i18n/angular and packages/osd-i18n/src/angular. Also update test and document. Removal of packages/osd-i18n/src/angular will break all the usages of

import { I18nProvider } from '@osd/i18n/angular';

By a quick search, @osd/i18n/angular is used in the following places:

  • packages/osd-ui-shared-deps/entry.js
  • packages/osd-ui-shared-deps/index.js
  • src/plugins/dashboard/public/application/application.ts (will be removed in 2.9)
  • src/plugins/discover/public/get_inner_angular.ts
  • src/plugins/timeline/public/application.ts (will be removed in 2.8)
@ananzh ananzh added bug Something isn't working untriaged labels May 12, 2023
@ananzh ananzh added de-angular de-angularize work technical debt If not paid, jeapardizes long-term success and maintainability of the repository. and removed bug Something isn't working untriaged labels May 12, 2023
@seanneumann
Copy link
Contributor

OCI team is taking this task on.

@camreedOCI
Copy link
Contributor

@ashwin-pc Commenting here so the ticket can be assigned to me

@zashary
Copy link
Contributor

zashary commented May 25, 2023

@ashwin-pc Could you assign the ticket to me as well?

@ashwin-pc
Copy link
Member

Remaining work tracked in #5018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
de-angular de-angularize work technical debt If not paid, jeapardizes long-term success and maintainability of the repository. v2.11.0
Projects
Development

No branches or pull requests

5 participants