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

Handle <alias> nodes #78

Open
movermeyer opened this issue Oct 5, 2021 · 1 comment
Open

Handle <alias> nodes #78

movermeyer opened this issue Oct 5, 2021 · 1 comment
Assignees

Comments

@movermeyer
Copy link
Collaborator

movermeyer commented Oct 5, 2021

The root locale contains <alias> elements that tell the reader that they should restart their search with a different key.

Example resolution

For example, resolving //ldml/dates/fields/field[@type="hour-narrow"]/relative[@type=0] for en_GB in CLDR v34 (for example) should look at:

  • //ldml/dates/fields/field[@type="hour-narrow"]/relative[@type=0] in common/main/en_GB.xml
  • //ldml/dates/fields/field[@type="hour-narrow"]/relative[@type=0] in common/main/en_001.xml
  • //ldml/dates/fields/field[@type="hour-narrow"]/relative[@type=0] in common/main/en.xml

Before finally //ldml/dates/fields/field[@type="hour-narrow"]/relative[@type=0] in common/main/root.xml, where it finds the alias:

<field type="hour-narrow">
  <alias source="locale" path="../field[@type='hour-short']">
</field>

And restarts the search using hour-short, which in turn leads to another alias, restarting the search using hour, which is eventually resolves to:

this hour from //ldml/dates/fields/field[@type="hour"]/relative[@type=0] in common/main/en.xml.

Steps to reproduce

thor cldr:export --locales 'en' 'en_GB' --components Fields --merge
  • I expected data/en-GB.yml to contain a en-GB.fields.hour-narrow.relative.0 key with the value of this hour
  • I expected data/en.yml to contain a en.fields.hour-narrow.relative.0 key with the value of this hour

Once exported, there is no information in the exported YAML files about aliases.
This means that a client cannot know to use the en-GB.fields.hour.relative.0 key instead (for en-GB), which exists.

(Aside: this example uses --merge, but it equally applies to the non-merged case. I used the --merge case for simplicity)

Impact of this issue

Data exports are incomplete. Any aliased field is missing a corresponding value in the exported files.
The above hour-narrow example is not that impactful (clients lose access to the hour-narrow format 🤷).

In other cases, <alias> elements are used for more impactful values. For example, the Buddhist calendar data are largely aliased to Gregorian calendar data.
While ruby-cldr doesn't currently export Buddhist calendar information, if it were to, it's lack of <alias> handling would mean that the Buddhist calendar would be missing most of its data entirely.

Another example: The symbols for many numbering systems are aliased to the Latin number symbols. Without resolving the aliases, the symbols are not present in the exported data (Actually, they are, but that's due to another bug).

Potential Solution

Output aliases in the manner supported by ruby-i18n/i18n's Symbol resolving.

If --merge flag is used, resolve the value and output that instead.

@movermeyer
Copy link
Collaborator Author

movermeyer commented Nov 13, 2021

Another example:

The root locale contains <alias> nodes for calendar eras:

These are incorrectly getting output as:

eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''

movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 13, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
@movermeyer movermeyer changed the title Resolve <alias> tags Handle <alias> tags Nov 15, 2021
@movermeyer movermeyer changed the title Handle <alias> tags Handle <alias> nodes Nov 15, 2021
movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 15, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 15, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 15, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 15, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 15, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
movermeyer added a commit to movermeyer/ruby-cldr that referenced this issue Nov 15, 2021
`type` is a required attribute of `era` tags.

`<alias>` tags are present in the `:root` locale and were incorrectly getting output as:

```yaml
eras:
  abbr:
    0: BCE
    1: CE
  name:
    0: ''
  narrow:
    0: ''
```

Until ruby-i18n#78 is addressed, I figure it is better not to output any data, rather than incorrect data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants