Identifying messages in a Qt Linguist translation file (TS file) - qt

I hope this is the right forum to ask this question. If it is not, please redirect me to a more suitable forum.
I am trying to understand the format of a Qt Linguist TS file. I have modified a file and when I try to open it I get the error message "Duplicate messages found in ...". The file contains indeed one context with two messages that have
the same source
a location with the same file name but different line numbers
different translation
Here is the source code of a minimal file that gives this error:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="es">
<context>
<name>MyContext</name>
<message>
<location filename="../../../../../MyFile.cpp" line="605"/>
<source>Delete</source>
<translatorcomment>Menu option</translatorcomment>
<translation type="unfinished">&Borrar</translation>
</message>
<message>
<location filename="../../../../../MyFile.cpp" line="1572"/>
<source>Delete</source>
<translation>Eliminar</translation>
</message>
</context>
</TS>
To my knowledge, each message is identified by context, source and location so this should not be a problem because the line numbers are different. Notice also that you cannot combine the two message elements into one, because they contain different translation texts.
So it is not clear to me what can cause the error message. I am using Qt version 4.6.2.
I have looked in the following documents: Qt Linguist Manual: Translator, Qt Linguist Manual: Programmers, Linguist TS file format, but in none of them I have found the information I am looking for, namely how each message is identified and what could cause the error message in Qt Linguist.
If you do not know the answer to this question, a link to further, more detailed information on the TS format would also be helpful.
UPDATE
I have found out that by using the optional tag TS/context/message/comment it is possible to
have different translation texts for the same context/message/source, e.g.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="es">
<context>
<name>MyContext</name>
<message>
<location filename="../../../../../MyFile.cpp" line="605"/>
<source>Delete</source>
<comment>Comment 1</comment>
<translatorcomment>Menu option</translatorcomment>
<translation type="unfinished">&Borrar</translation>
</message>
<message>
<location filename="../../../../../MyFile.cpp" line="1572"/>
<source>Delete</source>
<comment>Comment 2</comment>
<translation>Eliminar</translation>
</message>
</context>
</TS>
The above file can be opened without errors.
This seems to solve my problem but it would be good to have some precise documentation about this format.

The error message reported by Qt linguist is meaningfull.
Try this modified version of your TS file:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="es">
<context>
<name>MyContext</name>
<message>
<location filename="../../../../../MyFile.cpp" line="605"/>
<source>Delete</source>
<translatorcomment>Menu option</translatorcomment>
<translation type="unfinished">&Borrar</translation>
</message>
</context>
<context>
<name>MyOtherContext</name>
<message>
<location filename="../../../../../MyFile.cpp" line="1572"/>
<source>Delete</source>
<translation>Eliminar</translation>
</message>
</context>
</TS>
Duplicates are identified by context (i.e. MyContext vs. MyOtherContext) and source (Delete).
Edit:
I have scrutinized Qt Linguist's source code. As far as I can tell it never make use of ts.dtd for validation purpose, everything is hardcoded (See the TSReader class in ts.cpp).
The moral is: you can do every manipulation you want if and only if the resulting ts file can be loaded again by Qt Linguist and accepted by lupdate (to resync the application).

The complete lookup key for a translation is
Context + source string and, when present, disambiguation string
see http://qt-project.org/doc/qt-4.8/i18n-source-translation.html#disambiguation
The disambiguation string is stored in the comment field since this was also, in older Qt versions, the way to insert a developer comment (it is still recognized as such by Qt Linguist and so is the new comment (extracomment in the .ts file see http://qt-project.org/doc/qt-4.8/i18n-source-translation.html#translator-comments)).
So, as you noticed, you can have two strings with the same context and source string as long as they have different disambiguation strings (or one of them has one and the other does not).

Related

ASP.NET Web Forms - Adding Hebrew characters in web.config gives internal server error

In my web.config file I am trying to add a key like that:
<add key="DefaultUserErrorPayMessage" value="רווית" />
but I get an internal server error doing that...
(when I add a value in English letters it works ok)
In the globalization tag I tried to add:
<globalization culture="he-IL" uiCulture="he-IL" fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8"/>
but still no luck there.
I also have this at the top of the file:
<?xml version="1.0" encoding="UTF-8"?>
Can anyone point out what is the desired solution for this?
OK found the answer...
It is quite stupid I must admit.
when publishing the website the web.config file is ANSI encoded, so need to overwrite this file as UTF-8 encoded.

Where is the update site for `org.eclipse.fx.javafx` (Unable to locate installable unit)?

I have a plugin based product file using:
org.eclipse.fx.javafx
org.eclipse.fx.osgi
I think these plugins come from the e(fx)clipse project.
I am trying to build a target file providing those plugins (a maven+tycho build will be my next step). I thought I could get them on this p2 update site:
http://download.eclipse.org/efxclipse/updates-released/1.0.0/site
My target file looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="my_target" sequenceNumber="1">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.fx.javafx" version="2.2.0.201408150502"/>
<unit id="org.eclipse.fx.osgi" version="1.0.0.201408150502"/>
<repository location="http://download.eclipse.org/efxclipse/updates-released/1.0.0/site"/>
</location>
</locations>
</target>
But I get this error: "Unable to locate installable unit org.eclipse.fx.javafx".
If I edit the location, I can select one of those items:
I have the same behavior with the nightly update site:
http://download.eclipse.org/efxclipse/updates-nightly/site
You should NOT use this update-site to setup a target platform! Use http://download.eclipse.org/efxclipse/runtime-shared-released/1.1.0/site when creating target platforms.
.
The XML content of the Target file looks like this:
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.fx.runtime.min.feature.feature.group" version="1.1.0.201411050602"/>
<repository location="http://download.eclipse.org/efxclipse/runtime-shared-released/1.1.0/site/"/>
</location>
The feature with minimal content is described here: Easier runtime consumption through special features.
in this there is org.eclipse.fx.*
http://download.eclipse.org/efxclipse/updates-nightly/site
if you have problem you can dowload in zip:
http://download.eclipse.org/efxclipse/updates-nightly/site_assembly.zip

Are there any docx repair tools that give a meaningful error message?

I am struggling to find the cause of a corrupt docx file.
It seems that there are millions tools out there for repairing corrupted files - I've tried 5 that all repaired beautifully, but none of them gave any indication of the error origin.
Does anybody know of one that does?
Open source would be a bonus.
Thanks.
UPDATE:
I tried using the Open XML SDK 2.0 Productivity Tool as recommended by frankpl. It looked promising, but it refused to open my corrupt file either standalone or to compare with another.
I found a difference between the [Content_Types].xml part of the file, but on closer It's just the order that's different - I presume this wouldn't account for corruption?
In the valid (repaired by Word) file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Default Extension="xml" ContentType="application/xml"/>
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
<Override PartName="/word/stylesWithEffects.xml" ContentType="application/vnd.ms-word.stylesWithEffects+xml"/>
<Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>
<Override PartName="/word/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
<Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/>
<Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"/>
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
</Types>
And in the corrupt file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="xml" ContentType="application/xml"/>
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
<Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
<Override PartName="/word/stylesWithEffects.xml" ContentType="application/vnd.ms-word.stylesWithEffects+xml"/>
<Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/>
<Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"/>
<Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/>
<Override PartName="/word/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
</Types>
Here's a list of DOCX repair tools that are free:
http://www.docxrepairtoolbox.com/
http://sourceforge.net/projects/damageddocx2txt/
http://sourceforge.net/projects/quickwordrecovr/
http://download.cnet.com/SysInfoTools-Docx-Repair/3000-2248_4-75330500.html
Not a docx repair tool, but the Open XML SDK 2.0 for Microsoft Office contains a tool named "Open XML SDK 2.0 Productivity Tool for Microsoft Office" that you can use to compare two docx files (like the corrupt and the working one).
Old question I know, but just to say for anyone with similar problems.
The above content files wont be source of issue. (order isn't an issue it's just what word does on repair - renumbers ids and reorders)
Something that can cause corruption is simply having extra files in the zip that doesn't belong there.
Most of the time when it throws it's hand up in air and doesn't give you a hint, it's the structural metadata that has gone wrong.
By that I mean, not an invalid pointer to a relationship id in the document.xml (for example), but an invalid relationship file itself. For example, pointing to a content type in document.xml.rels that isn't in [Content_Types].xml.
However, when word repairs everything it renumbers all it's ids (and reorders) so compare tools are difficult.
Check the list of files is same, concentrate on things such as [Content_Types].xml and document.xml.rels (and other rels files), and good luck!
Many years late, but you can create your own error checker using DocumentFormat.OpenXml.Validation: https://msdn.microsoft.com/en-us/library/office/bb497334.aspx

Can Adobe's filevault tool (VLT) be configured to ignore files?

If it can, where would this be configured?
From the documentation, all mention of ignoring files is about excluding .vlt from SVN commits, but we're facing the opposite issue — we'd like to exclude files that are on the file system from VLT commits — e.g. .DS_Store, *.iml, etc.
VLT creates a .vault folder in the user's home directory, similar to .subversion, but this just seems to hold authentication details.
The programme also doesn't seem to allow an ignore property to be set via propset — I tried this with a similar syntax to SVN (vlt propset -R vlt:ignore .DS_Store *) and received a fairly useless, (& overly optimistic for future improvement) error message:
Generic properies not supported, yet
Any pointers would be great!
Just add the ignores to your META-INF/vault/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<vault version="1.0">
<ignore name=".svn"/>
</vault>
sure.
In the vault config directory, where the filter.xml is, create a file settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<vault version="1.0">
<ignore name=".svn"/>
<ignore name=".DS_Store"/>
</vault>
If you wanna solve it in a more general matter you can use a user-config similar to SVN in your home directory.
$ cat ~/.vault/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<vault version="1.0">
<ignore name=".svn"/>
<ignore name="._*"/>
<ignore name="release.txt"/>
<ignore name=".git"/>
<ignore name=".gitignore"/>
<ignore name="*/generated(/?)*"/>
</vault>
Where .svn, .git and so on is ignored as well as generated AEM files (s.a. less to css).
just go to the src/main/content folder where jcr_root folder lie.
You will see the folder "META-INF" and go in to META-INF/vault folder.
open the setting.xml file. You will see the following content.
<?xml version="1.0" encoding="UTF-8"?>
<vault version="1.0">
<ignore name=".svn"/>
<ignore name="._*"/>
<ignore name="release.txt"/>
<ignore name=".git"/>
<ignore name=".DS_Store"/>
<ignore name=".gitignore"/>
<ignore name="*/generated(/?)*"/>
</vault>
You can add the ignoring files/folder here. I have added the Eclipes project folder .DS_Store.

How to change the assemblyIdentity of an executable?

I want to hide the tool I used to create an .exe file. I am not doing anything illegal, I just want to protect my intellectual property from being copied. If I open the exe file in a text editor I see the following section.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="XXX.XX"
processorArchitecture="X86"
name="Microsoft.Windows.NameOfTheTool"
type="win32"
/>
</assembly>
I have attempted to change the name to:
name="Microsoft.Windows.SomeOtherName"
This resulted in the following message when I attempted to execute the file.
"This application has failed to start because its side-by-side configuration is incorrect."
How can I solve this?
I've never changed the manifest data, but it might be possible. You should check the linker options.
Regardless, an exe packer like .NETZ may obfuscate things sufficiently.
Now that I look again: the name attribute should be the name of your assembly, not the program (such as VisualStudio) used to create it. If it's not, you'll have to tell us more for us to figure out why. If your program is really script that's fed into some other program, all bets are off.

Resources