[Multilingual] Zotero fields and CSL variables

Most of Zotero fields (authors, title, date, etc.) are exposed as CSL variables, so the style can process them. However, "Language" field doesn't seem to have an equivalent variable. Is it possible to expose it?

This would allow style to detect the languages of a particular bibliography item and to process it accordingly. In effect, the locale can be set per item as opposed to per bibliography. Russian standard seems to require this behavior.

However, if we consider "Language" field as "What language is this book in?", then it would be probably better to create a new "Locale" ("How should this item be formatted?") field in Zotero and expose it as "itemlocale" through CSL.

P.S. May be this should be posted to Feature Request.
  • We have experimental code for exactly this, which will be considered for inclusion in CSL in due course (see this test case, and this one as well). The multilingual version of Zotero (see this skeleton manual for more details) has support for setting alternative field values for various languages, and for citation forms needed in cross-language publication. We welcome feedback on this work.
  • As far as I can tell , the second test case looks just like what I need. I'll install the multilingual version and give a try. Thank you!
  • My experience so far: installation over current Zotero (SLZ) results in empty UI language list, uninstall-then-install again solved the problem (NB: DB survived, not sure if this is a feature or a bug :).
    Could't add the first tag for a while, only right click on the language name worked, now adding works as expected. However, I can't remove "ru" tag, don't know why. Add and removing all other tags works fine.

    Now I am going to hack my style file. MLZ can tag almost every field, while both test seem to use "Language" filed. The first approach is much more flexible, but requires all the fields to be tagged.

    Can I just use <layout locale="lang1"> ... </layout> <layout locale="lang2"> ... </layout> inside bibliography section, so that different layouts fire on different languages without tagging all the fields?

    Thank you!
  • Thanks for the feedback on the behavior after a fresh install. I'll try to spend some time looking at that situation soon, and smooth over any rough edges.

    On the last point, yes, that's the way it's set up currently -- it's a "big hammer" approach, that replaces the entire layout. A more refined approach would only replace locale terms, where that is sufficient to handle the content, but that's for a future extension to the experiment.

    I'm delighted that you've picked up the multilingual branch code for trials, but can I ask that the title of this thread be prefixed with "[Multilingual]", to avoid possible misunderstanding about the status of this variant of Zotero and CSL?
  • edited June 23, 2011
    <nevermind>
  • Since I have only two languages to worry about, "locale per item" approach would work fine for me, I'll just write two layouts. As a bonus, I don't have to tag all the fields in my library, setting one field work.
    I suspect that while "locale per bibliography" is too coarse, not many people really need "locale per field" control.

    I have checked out https://www.zotero.org/svn/extension/branches/trunk-multilingual but can't build currently. Does it makes sense to work with HEAD revision and build it myself? If so, then where should I post build-related comments?
  • It's probably just breakage in the script, which makes (unjustified) assumptions about the environment. The XPI is here. I'll try to improve the dependency situation with the build script.
  • Thank you for xpi, I've installed it over just in case :) Since nobody else is participating in this discussion, I'll share my experience with the build script.

    My box is running FreeBSD 7.4-STABLE. The 1st problem was with the 1st line :) I changed it to #!/usr/bin/local/bash as a quick-and-dirty solution. If the script doesn't use bash-specific features, #!/bin/sh is a better option.

    Right now it dies with the following message

    adding: chrome.manifest (deflated 76%)
    adding: COPYING (deflated 65%)
    adding: deleted.txt (deflated 36%)
    zip warning: name not matched: install.rdf
    zip error: Nothing to do! (zotero-multi-2.xpi)

    It seems that install.rdf is missing from SVN.

    Hope this will help you. If you are interested, I can test the build script on OSX.
    Thank you!
  • Update:
    1) re "Can't delete ru tag" -- turned out I had the "Citations and bibliographies/Sorting" checkbox checked, so it's a feature actually.

    2) MLZ seems to use en dash instead of hyphen. 50% of my problems are solved :)

    3)However, bibliography with different locales do not work for me. This is my test bibliography code:

    <bibliography et-al-min="4" et-al-use-first="1"
    entry-spacing="0" second-field-align="flush">

    <layout suffix=".">
    <text value="cite-gen"/>
    </layout>

    <layout locale="en" suffix=".">
    <text value="cite-en"/>
    </layout>

    <layout locale="ru" suffix=".">
    <text value="cite-ru"/>
    </layout>

    </bibliography>


    I have two items, the first one has Language=ru, the second -- "Language=en" (as seen in Zotero interface). The output looks like this:

    cite-gen.
    cite-gen. cite-en


    So it seems that without locale fire on both items (that is logical), fires on the second item (as it should), but somehow doesn't fire. Any ideas what should I check/test?

    Thank you!
  • edited July 4, 2011
    If you move the default layout from the top of the list to the bottom, it should work.

    (Edit: What you should get is just one "cite-*" output string per cite, with "cite-gen" firing where no language or an unlisted language is specified on the item "language" attribute, and "cite-ru" firing on the language-"ru" item.)
  • Thank you! I don't really need that cite-gen thing, the problem is that is I comment it like this

    <bibliography et-al-min="4" et-al-use-first="1"
    entry-spacing="0" second-field-align="flush">

    <layout locale="en" suffix=".">
    <text value="cite-en"/>
    </layout>

    <layout locale="ru" suffix=".">
    <text value="cite-ru"/>
    </layout>

    &lt!-- <layout suffix=".">
    <text value="cite-gen"/>
    </layout> --&gt

    </bibliography>

    then changing to that style gives me an error: "Zotero experienced an error updating your document. this.output.queue[0] is underfined".
    If I uncomment it:

    <bibliography et-al-min="4" et-al-use-first="1"
    entry-spacing="0" second-field-align="flush">

    <layout locale="en" suffix=".">
    <text value="cite-en"/>
    </layout>

    <layout locale="ru" suffix=".">
    <text value="cite-ru"/>
    </layout>

    <layout suffix=".">
    <text value="cite-gen"/>
    </layout>

    </bibliography>

    then I can (usually) change to this style, but the last part doesn't fire at all.
    Is this expected behavior? It used to confuse me, but it makes sense to require default handler.

    One more question concerning 's wrapped in . They are affected by language (i.e. the appropriate one is called, as far as I can see from the first example, but when is the language set? I.e., if I call a macro from without locale, will the with current item locale called?

    Thank you!

    Sorry, if my questions sound too vague :(
  • Great, it sounds like everything is working for you as designed.

    Currently, terms only follow the item locale if the locale set on one of the cs:layout nodes matches. If there is no match, terms from the style default locale will be used. We have talked about making this a little smarter (so that terms from the item locale can be used in the default layout), but for the time being, you need an explicit layout for each locale.
  • It took me some time to understand that cannot be localized, but they preserve locale. Anyway, I manged to modify existing GOST 2008 style by Maxim Yurkin. I'd love to upload my modifications, but it seems a special multilingual style repository should be established, since this style wouldn't work with stable Zotero.

    Anyway, MLZ seems to be pretty stable, so I believe its needs more exposure :) Thank you very much, and I'll glad to help: additional testing, manual writing, may be some boilerplate code (I am not a software developer but tend to know how things work), etc. Feel free to contact me!
  • Great. If you have a github account, send me the ID (via a forum message if you prefer) and I can set up a repository and give you direct checkin privileges.

    The documentation situation does need to be addressed. I'll study git a bit more, and see if I can set up a schema for validating multilingual styles. Once that's in place, I should be ready to provide some documentation.

    Thanks for your patience. Very glad to hear that it's worked for you.
  • Just created a GitHub account: NovemberZulu . It looks all the software was already in place, the problem for me was to understand how to use it :)
  • Yep. Documentation robs the world of all its mystery and wonder. :)

    (I noticed this morning that the site serving the multilingual client (gsl-nagoya-u.net) is down. I'll be calling the hosting service shortly when their help counter opens -- I think it's a problem with our DNS records, which we've been managing on a separate server. With luck we'll have it hooked up to the Internet again fairly soon.)
  • edited July 5, 2011
    It also hosts its documentation :) May be I should write a couple of paragraphs about creating multilingual styles, shouldn't I? It might help future style creators.

    Update: 203.105.81.135 seems to be down, so it looks like the problem is not DNS.
  • Anything you write will be of use, certainly.
  • I'll have a look at the documentation and write about creating styles. Is the documentation created with some kind of markup langage (like Tex, MediaWiki, etc.)?
  • The docs are written in reStructuredText. Anything in plain text is fine; it's easy to touch up the formatting.

    (On our server issue, this turns out not to be a problem in our DNS. Line was busy when I called at help-counter opening time, and a refresh of the support page now shows a report of service outage. It's one for the hosting service to sort out now ...)
  • Ok, I tried to summarize my experience with MLZ styles. Hope it will help someone.
    Unfortunately, formatting is lost if I paste it, so grab it here.
    P.S. My English is far from perfect, so feel free to edit.
  • Great, thanks! I'll try to get this online in the next few days.
  • You are welcome.
  • Maxim Yurkin (the author of the original GOST Numeric style) updated his style to CSL 1.0, so I made a multilingual version. You can find it at https://github.com/NovemberZulu/GOST-Numeric-style-for-MLZ .

    By the way, it looks like I found a bug in MLZ, what is the best way to report it?
  • You could use the main issue tracker (https://www.zotero.org/trac/) and mark the component as "multilingual". Alternatively, you could post a new thread here on the forums and put [Multilingual] in the thread title. Finally, Frank and everyone else involves reads zotero-dev (http://groups.google.com/group/zotero-dev), so you could post there.
Sign In or Register to comment.