metanorma / metanorma-iso

Metanorma processor for ISO standards
BSD 2-Clause "Simplified" License
13 stars 5 forks source link

Phrase about edition superseding #1103

Closed Intelligent2013 closed 6 months ago

Intelligent2013 commented 6 months ago

Source issue: https://github.com/metanorma/metanorma-iso/issues/1089

The 2nd, etc. ISO publications from 1951 to 1971 contains the sentence about superseding the previous edition. Need to add the localized resource.

Examples:

opoudjis commented 6 months ago

Is the phrase more generally "This n-th edition supersedes the n-1-th edition"? I'd have to assume so...

Intelligent2013 commented 6 months ago

Is the phrase more generally "This n-th edition supersedes the n-1-th edition"? I'd have to assume so...

@opoudjis yes, sure.

opoudjis commented 6 months ago

For Russian, this will become the very first time we will have had to allow for case inflection in i18n (we will need both nominative and accusative). I will need to work out whether I hard code casing in i18n processing, or build a metalanguage like Fluent (if not Fluent itself) into the template. But unless we do a lot more Russian than we have been doing, that would be overengineering.

If it's Настоящее второе издание заменяет первое издание, then I see "edition" is neuter, with the same inflection for nominative and accusative, so in this one instance, I would not need to build case inflection. But that's a happy accident, and I want to be safe...

opoudjis commented 6 months ago

Again, while this solution is overkill for this instance ("edition" in Russian is neuter, so it's the same in the nominative and accusative), I'm using this as an opportunity to refactor i18n.

The current uninflected (so nominative) i18n templates for "first edition" and "1st EDITION" in Russian are:

%Spellout and %Ordinal are special variables, to be populated from metadata, and formatted according to the word after %, and twitter-cldr-rb.

We have variables in general in our YAML, indicated by %, %1, %2, etc.

We now need to introduce case inflection on variables, and on words that already occur in our i18n.

Fluent https://projectfluent.org/fluent/guide/terms.html would express the case for "This n-th edition supersedes the n-1-th edition" as:

ordinal_edition = { NUMBER($edition, type: "ordinal") ->
   [1] You finished first!
   [one] You finished {$pos}st
   [two] You finished {$pos}nd
   [few] You finished {$pos}rd
  *[other] You finished {$pos}th
}

-this(case: "nominative", gender: "neuter") 
-ordinal_edition(case: "nominative", gender: "neuter", number: "singular") 
{ -edition(case: "nominative") ... }

Fluent... as I said, does not actually do that much, other than passing attributes into the i18n word lookup. We're not going to get that much out of adopting it.

But it's clear that we should add the following functionality to our i18n manipulation of YAML:

With a conservative approach (allowing words to remain hard-coded if they do not vary), and allowing default values (which isodoc-i18n already knows about, given INFLECTION_ORDER = %i(voice mood tense number case gender person).freeze ), we can do:

Настоящее %Ordinal(nom) издание заменяет %Ordinal(acc) издание

If we unify variables and Liquid, and allow dynamic entry of word inflection, as a maximimalist solution, we end up with:

variable1 = ...edition
variable2 = ...edition - 1

{{ labels["this"] | inflect: sg,nom,neut }} 
{{ variable1 | ordinal | inflect: sg,nom,neut }} {{ labels["edition"] | inflect: sg,nom }} 
{{ labels["replace" | inflect: act,ind,pres,sg,3rd }} 
{{ variable2 | ordinal | inflect: sg,acc,neut }} {{ labels["edition"] | inflect: sg,acc }}

This is overkill. But if we do serious work with Russian or Arabic, we need this level of overkill; and even if we don't, we should not perpetuate ad hoc solutions to inflection. The solution I'll implement will be more conservative, and it will still make the foregoing possible:

variable1 = ...edition
variable2 = ...edition - 1

Настоящее {{ variable1 | ordinal | inflect: sg,nom,neut }} 
издание заменяет 
{{ variable2 | ordinal | inflect: sg,acc,neut }} издание

And I will gradually or suddenly replace %, %1, %2 with {{variable1}}, {{variable2}} in i18n.

opoudjis commented 6 months ago

Done:

<bibdata>
...
<ext>
...
<edn-replacement>Настоящее второе издание заменяет первое издание</edn-replacement>
</ext>
</bibdata>

Element will only appear if edition is > 1 and document scheme is 1951