How do I set the complied docx's language?

js
jstovell
Posts: 22
Joined: Mon Apr 15, 2013 12:56 am
Platform: Mac

Mon Apr 15, 2013 1:24 am Post

I have my Mac configured to use Canadian English as my primary language, and thus Scrivener uses that as my composition language, just as expected. The documents I write are mostly in Canadian English and also use other languages as well. It all works nicely within Scrivener.

However, when I compile my documents into .docx files and open them in Word, all the text in the document has its language set to "English (UK)" rather than "English (CAN)" and the various other language codes as appropriate for a given bit of text. Now, if my document was written in nothing but English, I'd just use a couple of mouse clicks to switch the language for all the text in the document to "English (CAN)" and be done with it. But since I use multiple languages, I end up needing to go through the whole document and find every instance of every language and set it to the correct one. This, of course, is rather frustrating and time-consuming, but for my purposes I can't just leave it with the incorrect language assigned to it, so I have to waste the effort.

So, what I am wondering is whether there is any way to get Scrivener to preserve the correct language for any given block of text when compiling a .docx file?

User avatar
KB
Site Admin
Posts: 20920
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Mon Apr 15, 2013 9:26 am Post

There's no way in Scrivener for one block of text to have a different language assigned to it to another block of text, as Scrivener uses the standard OS X text system which doesn't allow for this. It's strange that the language is coming out as UK English in your .docx document, though. Internally, to generate .docx documents, Scrivener generates an RTF document and then converts it to .docx using a third-party converter, but the RTF generated again uses Apple's text system which should produce the most appropriate language. If you go into Edit > Spelling and Grammar > Show Spelling and Grammar, what language is set there? My guess is that it is "Automatic By Language", which allows OS X to guess which language you are writing as you go along (rather than forcing the entire document to one language). My guess is that when the RTF document is created, because it's set to "Automatic By Language", no language is explicitly set, so the OS X text system probably examines the text and guesses that the language is UK English (based on the similar spellings).

To test this out, could you please open TextEdit, copy and paste a swathe of text from Scrivener into it, save the document in TextEdit as RTF, and open that in Word - do you see the same behaviour?

All the best,
Keith
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

js
jstovell
Posts: 22
Joined: Mon Apr 15, 2013 12:56 am
Platform: Mac

Mon Apr 15, 2013 5:59 pm Post

Hi Keith,

Too bad about the individual text blocks, but oh well. Thanks anyway. :)

Based on your suggestion, I just ran a series of tests that I hope will be helpful. For all tests, I used the same individual document within my Scrivener project (or the text from it when creating RTFs via TextEdit). The result is the language of the document when I open it Word 2011.

Code: Select all

Method of         |  Doc/docx    |  Spelling language |  Result in Word
generation        |  converter   |  setting           |
-------------------------------------------------------------------------

RTF via TextEdit  |  N/A         |  Automatic         |  English (US)
RTF via TextEdit  |  N/A         |  Canadian English  |  English (US)

DOC via TextEdit  |  N/A         |  Automatic         |  English (US)
DOC via TextEdit  |  N/A         |  Canadian English  |  English (US)

DOCX via TextEdit |  N/A         |  Automatic         |  English (UK)
DOCX via TextEdit |  N/A         |  Canadian English  |  English (UK)

Compiled to RTF   |  N/A         |  Automatic         |  English (US)
Compiled to RTF   |  N/A         |  Canadian English  |  English (US)

Compiled to DOC   |  Java-based  |  Automatic         |  English (UK)
Compiled to DOC   |  Java-based  |  Canadian English  |  English (UK)
Compiled to DOC   |  Standard    |  Automatic         |  English (US)
Compiled to DOC   |  Standard    |  Canadian English  |  English (US)

Compiled to DOCX  |  Java-based  |  Automatic         |  English (UK)
Compiled to DOCX  |  Java-based  |  Canadian English  |  Englist (UK)
Compiled to DOCX  |  Standard    |  Automatic         |  English (UK)
Compiled to DOCX  |  Standard    |  Canadian English  |  English (UK)


By the look of it, it seems that (at least on my computer):
  1. the language specified in the Spelling settings in Scrivener and/or TextEdit make no difference,
  2. RTF files always end up in American English no matter what software is used to create them,
  3. DOCX files always end up in British English no matter what software is used to create them,
  4. DOC files compiled by Scrivener using the standard converter end up in American English, but
  5. DOC files compiled by Scrivener using the Java-based converter end up in British English.

So, the only thing that appears to make any difference in the process is if I use the Java-based converter to compile to DOC. So what I am wondering now is whether it would be possible to coerce the Java-based converter into setting a specific language for the document when I compile.
Last edited by jstovell on Mon Apr 15, 2013 6:08 pm, edited 1 time in total.

js
jstovell
Posts: 22
Joined: Mon Apr 15, 2013 12:56 am
Platform: Mac

Mon Apr 15, 2013 6:04 pm Post

Actually, on second thought, there probably isn't any reason to bother. Since at best we could only specify the default language for the whole document, I can just do that with a few clicks of the mouse in Word already. The tedious part is apparently beyond help anyway. :(

Oh well. Thanks anyway, Keith. I do love using Scrivener, by the way. Great software! :D

User avatar
xiamenese
Posts: 4636
Joined: Mon Jan 29, 2007 1:32 am
Platform: Mac
Location: London or Exeter, UK.

Wed Apr 17, 2013 1:53 am Post

My Mac uses British English, so my language in Scrivener is British English. I don't use Word, but Nisus Writer Pro, and it's possible that that makes a difference, but:

1) When I export .rtf from Scrivener and open it in NWP, the document is marked as being in British English and the spell check behaves accordingly. Clearly, to me, if Word would not do likewise, I would assume it to be an issue with Word, rather than with the Scrivener .rtf exporter;

2) The non-Java .doc export, is in fact .rtf with a changed creator code and extension, which is legal with Word (but can cause problems if you attach the file to an email that a Windows user then forwards to another recipient)**;

3) I too use mixed language documents, though in my case normally English and Chinese. As my documents are generally fairly short, not full-length books or articles running into thousands of words, I generally mark the Chinese in NWP by hand. Were I to need to do it with a long document, I'd do it using "Search and Replace", which in my case would be easy as I could simply search for any text in the Chinese font and mark that as Chinese. Between English and French, I would have to be more ruseful, so in Scrivener, either I would use a different font/size/style as necessary for French — using a preset for full paragraphs — that I could then have the Search look for and then Replace it marking the language as French and putting the text into the standard font, etc., or I would mark each stretch in French with a [fr] … [/fr], so S&R could look for those tags with the text in between, delete the tags and mark the text as French. I presume Word can do the same as NWP through Search and Replace.

Mark

EDIT: ** so of course, the .doc that results will behave like the .rtf export from the point of view of your test.
The Scrivenato sometimes known as Mr X.
iMac 27" (late 2015) 10.15.7, 24GB RAM, 512GB SSID
2017 iPad, iPadOS 14.3, 128GB, Apple Pencil
Scrivener, Scapple, Nisus Writer Pro, Bookends …

No
NouveauxEssais
Posts: 1
Joined: Thu Oct 01, 2020 11:21 am
Platform: Mac

Thu Oct 15, 2020 1:58 pm Post

Hello, this thread seem to be pretty old, but the issue is not (at least for me).
Is there finally a way to set the language for a project which is implemented in the .docx after compiling? I would be happy to skip the task of setting the correct language in Word. My documents are usually in German, and as the document is read as English (US), Word is – after opening the file – beginning to underline every single word, which can be quite annoying.
Thanks in advance for any reply!

User avatar
kewms
Posts: 7005
Joined: Fri Feb 02, 2007 5:22 pm
Platform: Mac

Thu Oct 15, 2020 4:28 pm Post

As noted upthread, this is probably an issue with Word.

One thing to try is to create German text in TextEdit, and then open the resulting file in Word and see what happens.

Also, if you're using Scrivener 3, you can use a different (undocumented, beta) format converter by going to Scrivener -> Preferences -> Sharing -> Conversions and *unchecking* the "use enhanced converters" box.

Katherine
Scrivener Support Team

User avatar
xiamenese
Posts: 4636
Joined: Mon Jan 29, 2007 1:32 am
Platform: Mac
Location: London or Exeter, UK.

Fri Oct 16, 2020 10:22 pm Post

NouveauxEssais wrote:Hello, this thread seem to be pretty old, but the issue is not (at least for me).
Is there finally a way to set the language for a project which is implemented in the .docx after compiling? I would be happy to skip the task of setting the correct language in Word. My documents are usually in German, and as the document is read as English (US), Word is – after opening the file – beginning to underline every single word, which can be quite annoying.
Thanks in advance for any reply!

Coming back to this thread, even though my last post was 7½ years ago! The version in use at the time was Scrivener 2, which didn't have styles, merely format "presets". I developed a system to mark paragraphs and headings with presets using slight colour variations, so I could use the Search and Replace in my word processor—actually automated in a macro—to replace the colour of text marked in each of those variations with the appropriate style. So body text was black, i.e. #FFFFFF, but block quotes could be #FFFFFD. The colour difference was indistinguishable to the human eye, but the two colours were clearly different to the word processor. In fact, my macro also made all the text #FFFFFF when it had run through.

I'm telling this, because it strikes me that a similar system could be used as a way to set up language marking, but in Scrivener 3 you would use character styles for this. So, for example, the default main language—English for me—would be #FFFFFF, but the character style for the secondary language, e.g. French, would be #FFFFFD. Then you would open the compiled document in your word processor and use Search & Replace/macro to find all text coloured #FFFFFD and give it the language attribute "French". Give your character style a shortcut, and every time you switch into or out of the secondary language just use the shortcut … no more arduous than typing Cmd-B for bold!

I haven't had to do this as my secondary language is Chinese, and my macro just searches for any glyphs within the Utf8 code spaces allocated to Chinese, Also, the styles I have set up in Scrivener 3 mean I no longer have to use the colour-coding.

My word processor is Nisus Writer Pro; I have no idea how to go about that part of it in Word or LibreOffice/NeoOffice/OpenOffice or any other word processor.

Mark
The Scrivenato sometimes known as Mr X.
iMac 27" (late 2015) 10.15.7, 24GB RAM, 512GB SSID
2017 iPad, iPadOS 14.3, 128GB, Apple Pencil
Scrivener, Scapple, Nisus Writer Pro, Bookends …