zotero / styles-repo

Zotero styles page
http://www.zotero.org/styles
14 stars 12 forks source link

Style previews aren't localized for dependent styles #34

Closed rmzelle closed 7 years ago

rmzelle commented 7 years ago

It looks like localization doesn't work anymore for the previews of dependent CSL styles.

E.g. https://www.zotero.org/styles?q=id%3Aabi-technik shows "Hisakata, Rumi, Shin ’ya Nishida, and Alan Johnston." and "edited by Andreas D. Baxevanis and B. F. Francis Ouellette". This same style does localize correctly to German when installed in Zotero Standalone.

dstillman commented 7 years ago

I doubt this ever worked — I don't think citeproc-node ever supported it (and I don't think it would be limited to dependent styles). @fcheslack would have to comment on how easy it would be to support this.

rmzelle commented 7 years ago

Independent styles properly localize: https://www.zotero.org/styles?q=id%3Achicago-author-date-de

dstillman commented 7 years ago

Ah, OK — then I guess it's just that we use the parent previews for the dependent styles, so we'll have to generate these separately.

dstillman commented 7 years ago

Fix here will be modifying generate-previews to check if the dependent style has a different default-locale from the parent and, if so, generating a new preview using the parent code with default-locale replaced. (If citeproc-node were updated to handle the dependent's default-locale, we could just send along the dependent code, but this way we could also cache the parent + default-locale combo. Not sure if there are enough default-locale dependents for that to matter.)

dstillman commented 7 years ago

@tnajdek: I haven't checked the code carefully, but it looks like this is doing some unnecessary work? I think dependent styles with default-locale="en-US" for parents without default-locale are all being regenerated (and aren't cached for the combo of parent + en-US, either, even if it ran that once, which it shouldn't need to, since the parent preview is en-US already).

tnajdek commented 7 years ago

@dstillman you're correct, seems I've forgot a type cast. Fix PR coming!

rmzelle commented 7 years ago

Thanks!