WeblateOrg / WeblateOrg/weblate

Support extra fields for FormatJS like labels and flags

Open
#15,131 5 comments 0 reactions 0 assignees View on GitHub
Area: File format support Waiting for: Demand
Dominant language
Python
Stars
6.1k
Forks
1.4k
Avg merge
9h 53m
Merged PRs (30d)
395

Description

### Describe the problem

the FormatJS format already supports a `description` field, which is very handy in Weblate as it provides context for the translators. It is however not possible to set the weblate **Labels** and **Flags** from the source translation files.

### Solution brainstorm

Given the FormatJS is already a structured JSON object, and is extensible, we could imagine that the source file would be enriched with labels/flags fields.

A sample message today looks like this:

```json
{
"some-message-id": {
"defaultMessage": "Control Panel",
"description": "title of control panel section"
}
}
```

We could have an extended message like this:

```json
{
"some-message-id": {
"defaultMessage": "Control Panel",
"description": "title of control panel section",
"labels": ["one label", "another label"],
"flags": ["priority:1000", "max-length:30"]
}
}
```

### Describe alternatives you have considered

None

### Screenshots

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the FormatJS import or parser entry point and trace the existing handling for the description field; the issue names no files or tests, so some repository reading is required. Done means labels and flags from the structured message object are imported into Weblate alongside the description, with coverage for both fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
localization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.