iodide-project / iodide-project/iodide

Proposal of Localization Support for Iodide Notebook Cells

Open
#2,032 0 comments 0 reactions 0 assignees View on GitHub
l10n
Dominant language
JavaScript
Stars
1.5k
Forks
145
PR merge metrics
No merged PRs in 30d

Description

# Localization Support for Iodide Notebook Cells

## Objective

This proposal makes it possible for Iodide notebooks to have localized content. This proposal aims to provide a way to achieve this in a single notebook. Separation of localization cells to another notebook will be a proposal of itself but is not a necessity.

This proposal is a BCP 47 (see: locale-registry) compliant localization support for Iodide notebooks. The intent here goes by a variety of names like translation, localization, localizability, multilingualization, and this document tries to include possible intricacies implied by such different wording, effectively producing notebooks that can have displays in different languages without generating redundancy.

Principles:

- Inherent properties against redundancy.
- Inherent properties against friction.
- Least impact on the organization of Iodide notebooks.
- Support for all types of Iodide cells.
- Features for extended localization needs.

## Motivation

Iodide is a project that is going to end up democratizing access to computational exploration environment, making it possible to access to a proper environment from a broader range of devices with less friction. It is necessary to take this mission one step forward and support the languages of different communities. As language is an essential part of many identities, the United Nations declares the right to revitalize, use, develop, and transmit to future generations languages, oral traditions, philosophies, writing systems, and literature.

## User Benefit

This feature benefits notebook authors, consumers, and communities themselves. With this proposal authors can have more people understand their intentions, consumers can get to read content in a language they feel less constrained, and communities can translate notebooks, effectively helping with local scientific literacy (given that someday Iodide will host publishable science literature, ranging from papers to books).

## Related Work

Localization is already a widely inspected topic. However, no related work in the field of computational notebooks exists, at least in a way that can translate all cells of notebooks. Moreover, it would be impractical to support things like literal extraction that is a widely accepted practice in localization, given the variety of execution environments and future projection of Iodide. This situation makes any localization solution for Iodide notebooks an animal of its own for the time being.

## Design Proposal

This feature works with a cell parameter that activates the selector parameter of that cell. Thus, a cell is a localization cell if it contains a `locale` parameter and a `selector` parameter. Supplied value to the locale parameter should be a BCP-47 compliant locale code.

When Iodide system detects a locale in a notebook, it displays a new drop-down menu at the top bar for locale selection. A user's notebook locale can differ from the preferred Iodide system language.

Notebook metadata specifies default locale of a notebook. If not specified, the drop-down menu should have an option called "Default" to make it possible to display notebook.

The behavior of localization cells is to replace selected cells with the localization cells. The language of selected cells does not have to match with localization cells. A markdown cell can replace javascript cell.

A notebook with localization cells effectively produces an intermediate representation notebook. This representation should be displayed by default if a locale is selected, but it should be possible to toggle it off through top bar too.

Example:

Original Notebook:

```
%% md id="definition"
Iodide is a computational notebook format.

%% js
console.log("A code.");

%% md locale="tr-TR" selector="#definition::before"
# Eşleştirme
Iodide: Iodide
Sayımsal Yazım: Computational Notebook
Tür: Format

%% md locale="tr-TR" selector="#definition"
Iodide bir sayımsal yazım türüdür.

%% js locale="tr-TR" selector="js::before"
console.log("Bu sürümde JavaScript bölümleri Türkçe değildir.");
```

Intermediate Representation of `tr-TR` locale:

```
%% md
# Tanımlar
Iodide: Iodide
Sayımsal Yazım: Computational Notebook
Tür: Format

%% md
Iodide bir sayımsal yazım türüdür.

%% js
console.log("Bu sürümde JavaScript bölümleri Türkçe değildir.");

%% js
console.log("A code.");
```

## Questions and Discussion Topics

- How to handle links? Having the same link of different locales point to the same cell would be better.

- If an identifier exists, should identifiers of selected first representation cells propagate to replaced cells?

- Should Iodide API provide selected notebook locale? Should both system and notebook locales be supplied? This information could help authors and translators utilize localization features of their runtimes (e.g., Intl of JavaScript).

- Are there any sentences or sentence groups that would benefit from further clarification in this proposal?

Contributor guide

Open the contributing guide

Research direction

The proposal names no files or tests; start by reviewing notebook metadata, cell-parameter handling, and top-bar locale selection. Resolve the listed questions about links, identifiers, locale APIs, and clarification before defining the implementation, with localized intermediate representations and support for all cell types as the intended outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.