Skip to content
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

Accepting inconsistency in TxEditor changes behavior in translation #17

Open
mw-martin opened this issue Aug 13, 2018 · 2 comments
Open

Comments

@mw-martin
Copy link

I'm not sure if this behavior is intentional, but it is not how I understood the documentation.

Say you have a txd file with English (as primary) and French cultures, and a key that intentionally only has a translation for english:

<?xml version="1.0" encoding="utf-8"?>
<!-- TxTranslation dictionary file. Use TxEditor to edit this file. http://unclassified.software/txtranslation -->
<translation xml:space="preserve">
	<culture name="en" primary="true">
		<text key="minimum" comment="The english translation works also for french">Min</text>
	</culture>
	<culture name="fr" />
</translation>

Then Tx.SetCulture("fr"); Tx.T("minimum"); would result in "Min" as intended.

The TxEditor shows a "Missing translation" as a problem for that key, so you click on that (so it gets a green checkmark) to accept the inconsistency and mark it as intentional. This results in:

<?xml version="1.0" encoding="utf-8"?>
<!-- TxTranslation dictionary file. Use TxEditor to edit this file. http://unclassified.software/txtranslation -->
<translation xml:space="preserve">
	<culture name="en" primary="true">
		<text key="minimum" comment="The english translation works also for french">Min</text>
	</culture>
	<culture name="fr">
		<text key="minimum" acceptmissing="true" />
	</culture>
</translation>

With that file, the behavior is now different, and Tx.SetCulture("fr"); Tx.T("minimum"); results in an empty string.
I expected this to only affect the behavior in the TxEditor, not the actual translation.

@mw-martin
Copy link
Author

mw-martin commented Aug 13, 2018

Hm, I guess there is no way to distinguish between "Accept the empty string as the translation" and "Accept the fallback behavior as intended" in the current file format.
I think the latter case is more frequent (e.g. when you have abbreviations that are the same for most or all of the cultures).

@ygoe
Copy link
Owner

ygoe commented Aug 14, 2018

You're right to assume that using that "accept" option in TxEditor should not have any effect on programs using the dictionary file. And it's indeed probably because now a key exists. I guess I could add a behaviour to the TxLib code to ignore XML elements when there's no text and the acceptmissing attribute is set to "true". Because you were accepting it missing when it was empty. So it should be considered empty afterwards, too, even though it's technically there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants