citation-style-language / locales

Official repository for Citation Style Language (CSL) locale files.
https://citationstyles.org/
140 stars 199 forks source link

Terms "collection-number" and "number" are missing #282

Closed denismaier closed 9 months ago

denismaier commented 1 year ago

I don't remember if that was on purpose or an oversight, but looks like the term for collection-number is missing. Any objections if I add it?

@adam3smith @bwiernik

adam3smith commented 1 year ago

No objections; I'd assume this was an oversight

denismaier commented 1 year ago

Ok, I'll add it. Just a question: Do we have a way to add to it all locales where the term is missing? IIRC, @zepinglee had something like this.

bwiernik commented 1 year ago

I've just done it manually in the past

zepinglee commented 1 year ago

Previously I wrote a script to resolve duplicate terms in all locale files (#269). It was relatively easy so I split each locales-*.xml file into lines and made some modifications. However adding missing terms is not trivial and special care must be taken. First, some terms are missing because they are identical to their default "long" forms. For example, in locales-nn-NO.xml the <term name="no-place" form="short"> is missing and we cannot copy the one from locales-en-US.xml.

https://github.com/citation-style-language/locales/blob/a7c6f63e25323ac2f375943417d7f778f875f11c/locales-nn-NO.xml#L27-L29

https://github.com/citation-style-language/locales/blob/a7c6f63e25323ac2f375943417d7f778f875f11c/locales-en-US.xml#L39-L42

Secondly, in some edge cases the position of copied terms is not as expected. This is similar to git merge which may have conflicts.

I've written a script https://gist.github.com/zepinglee/e6d0076a89b0266c9c9886fd83aacd99 and it should work in most cases.

bwiernik commented 1 year ago

I open up VS Code, select the line before the one I want to add, then use find-and-replace to replace that line with two lines (the existing one and the new one). I then click on each file in the left sidebard and click the replace all button for each. Takes about 4 minutes to update all the locales.

bwiernik commented 9 months ago

I noticed that "number" is also missing. We should double check that all of the number variables are correctly listed.