-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOCX emitter doesn't set language for correction #1620
Comments
PRs are welcome! Specifiying the language of (parts of) the document is probably described in Microsoft's specification for the DOCX format, and that's basically just a ZIP with several XML files, so you should be able to reverse-engineer this by saving the same document with two different language settings. But the topic is not as simple as you might think: First of all, I think that the preview locale is definitely not the correct source for determining the locale. Sometimes, a report contains texts in more than one language. So, one metadatum for the languae of the document will not suffice. This is for the generated documents (eg. HTML or PDF). We would also need to specify how that languages are determined from the rptdesign file.
Otherwise, do not assume a language - I think we should not guess. I don't know if and how the locale is also part of CSS (or in BIRT speak: the style sheet). Adding metadata about the language of texts is also a precondition for creating accessible documents, BTW. |
@hvbtup thanks for the extensive reply. I wouldn't use the locale of the OS running BIRT as well, but I think using the locale in which the report is generated is a bit better than using nothing or defaulting to en_US. Since the user or report creator already set a locale for the complete report. Since the perfect solution with a language for each text in the report seems rather complex, using a "better" locale for the complete document would be a step in the right direction in my opinion. In my experience and user environment most documents contain only one language, so this could be an improvement, while not being perfect. What do you think about this? PS I'm glad that BIRT is alive again and that the issues are seen and read. @ all keep up the good work 👍 |
Yes, the tickets will be read :o) The solution to verify if we could set the property for the whole documents sounds good to me. The otherone would be that the language value would be set through a user-property as a docx-emitter specific user-property. |
@doortokaos Can you find out if the en-US locale is specified somewhere explicitly in the (etracted) DOCX file structure or if this is just a default which Word assumes if there is no explicit entry?
I'm strictly -1 on some kind of magic to determine the language if it is not explicitly defined in the rptdesign file.
Yes.
I don't think we need to extend the data model or use a UserProperty. The locale property of items should suffice. A good starting point for where to look into the code should be the DocxWriter.java file. It's perfectly possible to write xml fragments directly into the output. I did this in our fork to support Word "Felder" (probably called "fields" in English Word?). |
According to the docx-definition, the value is a part of the assigned "style" of the according document/paragraph/table. I will test the user-property option with a first draft on my side to verify the option a little bit more. |
@hvbtup here you go: So it seems, that BIRT sets en-US for the whole document as default. The unaltered file created by BIRT for reference |
@speckyspooky I don't quite get it why you want to use a user-property. Correct me if I'm wrong, but as far as I know, there is a locale in the report context, that is used to determine which translation is loaded, when you have assigned a localization text key to a label and registered resource files with the translated texts for the text key. Why can't we use this locale to set a default for the whole document? |
@doortokaos I'm with @hvbtup that not in every case the usage of the "Locale" is a good one My idea would be to test the following:
|
Ok, understand than it was my fault. |
Thanks for your patience with me. I'm new to the whole GitHub-thing and trying my best. @speckyspooky After clarifying your idea, I like it |
I added PR #1627. The enhancement include only the usage of the "report locale" without user-properties. In my test cases I used "MS Word based on Office 365". Example 01: "fr_FR" valueExample 02: "it" valueDemo report |
Thomas, I really like your example reports! |
The enhancement is merged to the master with PR #1627 |
MS Word has functionalities to help the user writing correctly in a chosen language.
Since I use a German Version of MS Word, I don't know exactly the name in the English UI, but I think it might be called something like "Language for correction assistance". Here a screen of the menu in my word:
The language is always set to "English (US)" no matter in which language I create the report:
The report I used for the example is this (remove the .txt 😉):
korrekturhilfe.rptdesign.txt
I generated the DOCX with the German locale active in the designer and no further settings on the report or eclipse.
The designer is 4.15 Release all in one eclipse.
It would be nice, if the emitter could set the "Sprache für die Korrekturhilfe" to the language in which the report was created. So the user of the DOCX report won't have to set it every time manually after creating the report.
The text was updated successfully, but these errors were encountered: