Create a L10n:CompatTable JSON template and move strings from EmbedCompatTable into it

RESOLVED FIXED

Status

P5
normal
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: fscholz, Assigned: sebo)

Tracking

Details

(URL)

(Reporter)

Description

3 years ago
:: Developer Documentation Request

      Request Type: New Documentation
     Gecko Version: unspecified
 Technical Contact: 

:: Details

https://developer.mozilla.org/en-US/docs/Template:EmbedCompatTable contains a langDictionary with a lot of strings.

These strings should be in a separate macro like e.g. the one we have for CSS: https://developer.mozilla.org/en-US/docs/Template:L10n:CSS

New macro could be: https://developer.mozilla.org/en-US/docs/Template:L10n:CompatTable

In addition, mdn.replacePlaceholders() instead of the substitiute() function for replacing
placeholders within strings could be used for consistency.

This is not urgent, but will avoid potential conflicts when further developing the EmbedCompatTable macro.
It will make things easier to find and to maintain for localizers.
(Assignee)

Updated

3 years ago
Assignee: nobody → sebastianzartner
(Assignee)

Comment 1

3 years ago
I created the L10n:CompatTable template (currently keeping the sub-structures).
EmbedCompatTable still needs to be connected with the l10n template.

Sebastian
(Assignee)

Comment 2

3 years ago
Florian, should we keep the substructures from langDictionary in L10n:CompatTable or should the structure be flattened?

E.g. currently there is a 'browserTypes' substructure:
{
    // Browser Types
    "browserTypes": {
        "desktop": {
            "en-US": "Desktop",
            "de"   : "Desktop",
            "fr": "Ordinateur"
        },
        "mobile": {
            "en-US": "Mobile",
            "de"   : "Mobile",
            "fr": "Mobile"
        },
        "non": {
            "en-US": "Non-Browser Environment",
            "de"   : "Nicht-Browser-Umgebung"
        }
    }
}

Flattened it would look something like this:

{
    // Browser Types
    "browserTypeDesktop": {
        "en-US": "Desktop",
        "de"   : "Desktop",
        "fr"   : "Ordinateur"
    },
    "browserTypeMobile": {
        "en-US": "Mobile",
        "de"   : "Mobile",
        "fr"   : "Mobile"
    },
    "browserTypeNon": {
        "en-US": "Non-Browser Environment",
        "de"   : "Nicht-Browser-Umgebung"
    }
}

Flattening the structure would make it easier to get the localization status (bug 1223014). The adjustments required for the EmbedCompatTable template would probably be relatively small.

Sebastian
(Assignee)

Updated

3 years ago
Flags: needinfo?(fscholz)
(Reporter)

Comment 3

3 years ago
Yes, we want the same data structure for l10n in all macros.
(If it is this structure in the long run, we don't know yet, but for now we should have it consistent)
Flags: needinfo?(fscholz)

Comment 4

3 years ago
I would go for a flat structure too, other localization file formats use such flat structure and migrating (in a distant future) would be easier this way.
(Assignee)

Comment 5

3 years ago
Flattened the structure of L10n:CompatTable:
https://developer.mozilla.org/en-US/docs/Template%3AL10n%3ACompatTable$revision/948405

Changed EmbedCompatTable to use the strings from L10n:CompatTable:
https://developer.mozilla.org/en-US/docs/Template%3AEmbedCompatTable$revision/948465

Sebastian
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Summary: Create a L10n:CompatTable json macro and move strings from EmbedCompatTable into it → Create a L10n:CompatTable JSON template and move strings from EmbedCompatTable into it
You need to log in before you can comment on or make changes to this bug.