Different language for single reference in bibliography
Is there any way to change the language (guessing by switching locale) for a single reference in the bibliography list? For APA (at least as it's used in Sweden), a reference to a book chapter in English, for example, should be written in English: i.e. Ed./Eds. instead of Red./Reds, pp instead of ss and so on.
Any simple way to do this?
Any simple way to do this?
The syntax is documented here. I'm working on more detailed documentation of this and other features available in the experimental multilingual client, for inclusion in a book (draft text available here), but I won't get to the multilingual stuff for at least another month.
If it's only a few references, you're probably best off hand-editing in the final edit for the present.
If none of that makes much sense, you're probably safer waiting until this is a little closer to showtime (!).
There is no Lithuanian locale of csl. Can this be the reason of such behavior?
Or am I doing wrong something? I've read that: http://gsl-nagoya-u.net/http/pub/citeproc-js-csl.html#multilingual-layouts and that: http://forums.zotero.org/discussion/18482/?Focus=96869 I created four layouts (last without localization) but I don't know how to "move the content of the layout to a macro". Should I define entire layout of one language inside one macro and how to do that? Or should I define only terms in such a macro? But where define look of citations or bibliography in such a case if layout must have only one macro? Examples are too simple and my experience too small.
And this mess with multilanguage styles is main obstacle from moving toward Zotero for me. So is there any solution?
I'll be happy to look at your style, and fix any problems that turn up in testing. Can you paste the code of your style to http://gist.github.com, save it as a public gist, and post the URL from the address bar back here?
Here is my modification of Chicago manual style (full note): git://gist.github.com/3315481.git And Lithuanian terms overrides English ones in English references in this case. Lithuanian references are good.
Here is slightly modified that file (only different terms in locales): git://gist.github.com/3315497.git English terms overrides Lithuanian ones in Lithuanian references there. English references are good.
Russian terms are OK in both cases.
I can upload my modification of GOST style too. It produces the same situation - English overrides Lithuanian, but Russian "№" overrides english "no." in English references (all other English terms are OK).
What are my mistakes? :)
<locale>
<terms>
<term name="accessed">žiūrėta</term>
<term name="online">interaktyvus</term>
</terms>
</locale>
but result the same.
An ordinary CSL style like this one can only output with one locale setting per document; all references will be rendered in the same locale. You can switch locales (for the whole document) by changing the bibliography locale setting in Zotero.
Alternatively, you can anchor a style to a specific language, by setting a default-locale attribute in the cs:style node (the second line of the style). You can read about that here: http://citationstyles.org/downloads/specification.html#the-root-element-cs-style
Multiple locales in a single document are possible, following the documents you linked to, but let's get these simpler styles fixed first, and then move on to that.
The odd behaviour you see in this style is because it is invalid (the syntax of the file is broken). You can get information on validation of CSL styles here: https://github.com/citation-style-language/styles/wiki/Validation
Here are the validation errors in the version that you posted:
(1) There is a nesting error at line 44. Move the closing <term/> up by two lines.
(2) The "mont-1" etc. names need to be "month-01" etc.
(3) The "lang=" attributes should be "xml:lang="
(4) There is no "number" term, so that one should be removed.
Once the style is fixed and validating, you should be able to set default-locale="lt" in the style node, reinstall the style, and switch away from the style and back in any open document to find that the Lithuanian terms are used for all items. Changing to default-locale="en" and going through those steps, you should find English terms everywhere.
When that's confirmed to work, we'll be ready to go forward to a mixed-language style.
Error: Attribute locale not allowed on element layout from namespace http://purl.org/net/xbiblio/csl at this point.
From line 779, column 5; to line 779, column 60
rue">↩ <layout prefix="" suffix="." delimiter="; " locale="lt">↩
Error: Element layout from namespace http://purl.org/net/xbiblio/csl not allowed as child of element citation from namespace http://purl.org/net/xbiblio/csl in this context. (Suppressing further errors from this subtree.)
From line 815, column 4; to line 815, column 60
ayout>↩ <layout prefix="" suffix="." delimiter="; " locale="en">↩
Error: Element layout from namespace http://purl.org/net/xbiblio/csl not allowed as child of element citation from namespace http://purl.org/net/xbiblio/csl in this context. (Suppressing further errors from this subtree.)
From line 851, column 5; to line 851, column 60
yout>↩ <layout prefix="" suffix="." delimiter="; " locale="ru">↩
Error: Element layout from namespace http://purl.org/net/xbiblio/csl not allowed as child of element citation from namespace http://purl.org/net/xbiblio/csl in this context. (Suppressing further errors from this subtree.)
From line 887, column 5; to line 887, column 48
yout>↩ <layout prefix="" suffix="." delimiter="; ">↩
Error: Attribute locale not allowed on element layout from namespace http://purl.org/net/xbiblio/csl at this point.
From line 929, column 5; to line 929, column 35
sort>↩ <layout suffix="." locale="lt">↩
Error: Element layout from namespace http://purl.org/net/xbiblio/csl not allowed as child of element bibliography from namespace http://purl.org/net/xbiblio/csl in this context. (Suppressing further errors from this subtree.)
From line 948, column 5; to line 948, column 35
yout>↩ <layout suffix="." locale="en">↩
Error: Element layout from namespace http://purl.org/net/xbiblio/csl not allowed as child of element bibliography from namespace http://purl.org/net/xbiblio/csl in this context. (Suppressing further errors from this subtree.)
From line 967, column 5; to line 967, column 35
yout>↩ <layout suffix="." locale="ru">↩
Error: Element layout from namespace http://purl.org/net/xbiblio/csl not allowed as child of element bibliography from namespace http://purl.org/net/xbiblio/csl in this context. (Suppressing further errors from this subtree.)
From line 986, column 5; to line 986, column 23
yout>↩ <layout suffix=".">↩
There is "fixed" style: git://gist.github.com/3316761.git
Now Lithuanian terms disappeared completely. I set default locale to ru, lt and en. Terms are English all the time in Lithuanian and English references, but Russian terms all the time in Russian references. Changing default locale changes nothing.
You are right that the Lithuanian locale is being ignored because it is undefined. Let me do some testing to see how best to handle undefined locales set within a style, I'll get back in a few hours.
You might like to prepare a Lithuanian locale for use with CSL generally, by modifying the English locale file here. I'm sure the CSL group will be happy to add it to the official CSL distribution.
(Edit: amended to reflect the link provided by Rintze below.)
For the multiple language layout issue, I did some testing and found that undefined locales (i.e. a locale defined inside the style, but absent from the CSL locale set) are recognised by the processor. There was a bug, however, that could cause selection of the incorrect locale for some items. I've fixed the bug, and released an updated version of the citeproc-js CSL processor. The simplest way to test with it is to install this plugin, which replaces the CSL processor in Zotero with the latest version.
If you will be producing documents that span language boundaries, you might take a look at MLZ (Multilingual Zotero). This is a personal project of my own, that (among other things) allows flexible inclusion of translations and transliterations in printed citations. MLZ is not supported by the core Zotero team, and you will want to back up your Zotero database and other files before installing, but it may be useful in your environment.
I have MLZ installed and it works perfectly. Thank you for it.
I'll install new version of plugin to see how it works.
Maybe it is due bad construction of my style? It is the same as there: https://gist.github.com/3316761 I only removed default-locale.
One thing to confirm before I take a look: do you have "lt" set in the Language field of your Lithuanian entries? That's what should trigger the language switch. If that's in place, and the only errors in your style are those locale attributes, you may be experiencing a lingering bug in the processor. I'll take a look in a few hours.
Yes, I see, that my Zotero is 3.0m224.
O yes, I have locales defined. Actually, I am "playing" now with selected types of references and locales: I am testing, how different styles display them. Sometimes I am changing language field from "lt" to "ru" or "en" of selected entries. With "ru" and "en" there is no problem - after such a change terms of references in Writer document also changes (after refresh), as in Zotero CSL Editor or CSL preview. But references in Lithuanian are stuck to English.
@ Rintze,
sorry, I didn't notice that.
The Lithuanian terms in your style were not turning up due to a processor bug that caused locale nodes with specific xml:lang attributes to be masked in all styles, in both official Zotero and in MLZ. This must have been confusing to many style authors, and I'm very glad get it fixed.
If you update MLZ to the latest (m225), you should find that your style works as expected. For completeness, you might want to add all of the relevant nodes (style-options, date, and terms) from the locale you have prepared to the style, until your locale makes its way into a CSL release.
Let me know if you run into any more snags; but I think the tool will start doing its job for you now.
(Edit: If you haven't yet made major changes to the Chicago Fullnote style on which you're basing your work, you might take a look at the MLZ Chicago Fullnote style as an alternative. It validates against the MLZ extended CSL schema, which permits the multiple layout syntax. Validation works in the same way as for official CSL, but using the alternative schema. (I'll be reorganising the schema source soon, but that repo address will always contain the multilingual version.)
I am only testing styles and locales and therefore I am doing only essential changes to styles as described.
Is there opportunity to validate MLZ styles with validator.nu? I pasted this link: https://github.com/fbennett/schema/tree/multi to schemas field in it, but it validates all, even truly wrong styles.
There is my style modification: https://gist.github.com/3325436
There is my references: https://gist.github.com/3325361 Actually they are only for testing purposes, so they aren't real but created to fill as much fields as possible. Two of them are Lithuanian, one - Russian and one - English.
Hope this will help.
Validation against the MLZ extended CSL schema is a little awkward at present. I'll try to set up an easy validation channel sometime fairly soon, but you should be good with the style above for now.
(Edit: I made one small set of changes to the processor, to handle the switching of punctuation-in-quotes behaviour across locales in a multi-layout style. You can pick up the changes by updating MLZ.)
I upgraded MLZ.
There were some issues with the style file - bigger half of it was red when opened in Gedit. Because some remarks (in <!-- -->) maybe broke the code itself (apostrophe in "don't"). I don't know how this affected code. But there was no changes after I corrected that.
I think, that these problems will vanish after Lithuanian locale adding to Zotero. But there is languages without locales and it is not good if such a problem will continue.
Or problem is with my style.
How my style, modified by you, behaves with English references?
Now I am going to bed :).
(Edited. But when default locale is set to "ru" or "lt", all terms are Lithuanian of English and Lithuanian references and Russian - in Russian. I have one idea and will test it soon.)
http://img805.imageshack.us/img805/816/mixedlocales.png
That's all correct, I think.
Be sure that the language attribute in the locale nodes is set with xml:lang=, and not with plain lang=. The latter is not recognized, so that node would become the fallback. If a locale node in the style was set to <locale lang="lt"> with a full Lithuanian set of terms inside, that would produce the behaviour you describe (i.e. Lithuanian everywhere, unless overridden). But that's just a guess.
For final debugging, I'll need to see exactly what you are using for the style and for the entries for a specific error. The major wrinkles have all been ironed out, as far as I can tell; the problems are almost certainly with the input, and I'll need to see it directly in order to track down the cause of odd behaviour.
(Edit: we crossed in the post -- response below.)
For styles that use multiple layouts, I think our experience today suggests that setting default-locale on the style is indeed a good idea. :-)
(Edit: crossed in the post with your qualification above. Will look forward to hearing what you turn up. When you have a stable set of data that misbehaves, send it along and I'll take a look.)
But I must default locale set to "lt" in other bad my style to get it working properly.
(Edited. So, this depends not on Firefox (Iceweasell in my Debian) or on MLZ preferences.)