Is it possible to mark GSettings/GSchema <flags> as translatable? - translation

I have a GSchema defining some flags like so:
<flags id="org.example.program">
<value nick="ENGLISH_WORD" value="1"/>
<value nick="ANOTHER_WORD" value="2"/>
</flags>
However I have been informed by a translator that these are not processed by gettext or offered in the .pot file. Is there a way I can mark these as translatable?

The default values can be translated but the translations are substituted from .mo files at runtime. You have to put the textdomain in the attribute "gettext-domain" of the "<schemalist>" resp. "<schema>" element. You also have to put the locale category into the attribute "category" of the "<default>" element. Read the paragraph "Description" in https://developer.gnome.org/gio/stable/GSettings.html for more information.
I recommend that you examine the sources of a recent Gtk application and see how the different components are localized. GNU gettext has recently been improved to offer better support for localizing desktop applications and therefore the process is currently evolving. In particular, you usually no longer need intltool.

Related

Weblate mark items as untranslated in the xliff-file?

I have the following xliff-Translation-Format. And i need to mark Textitems as untranslated within the xliff-file, so that Weblate displays those as untranslated.
<source>Delete</source>
<note priority="1" from="description">Delete alert dialog</note>
<note priority="1" from="meaning">Delete button label</note>
<target state="needs-translation">Delete</target>
It seems that the state attributes aren't recognized by weblate. Only when the Target-Tag is empty, Weblate displays the item as untranslated. But the Target-Tag always needs to be not empty, since the application doesn't have a fallback and will display nothing at this point.
The Weblate documentation is pretty clear that if a <target> element contains content, you can specify its state with the state attribute, e.g. with new, needs-translation, needs-adaptation, needs-l10n.
What you describe does not appear to conform to the above description. So after making sure the error is not on your end (you're using the correct XLIFF file and the latest Weblate version, you're not using any attributes on the <trans-unit> element that would conflict with the target status etc.), be sure to submit an issue.
In the meantime, you could experiment with the other status values listed above, maybe Weblate picks up those. Or you could try various upload options if they are available (the documentation mentions "Upload as translated" in passing).

Need to modify XLIFF XSD

I am converting DITA to XLIFF. In my technical solution I have to specialize (modify) xliff-core-1.2-strict.xsd to accommodate few DITA attributes. It means some attributes will go along with "g" tag. For Example:
<g id="00001" newAtt="this is new attribute" xid="009"/>
From the translation side I am not sure how it will work, so my questions:
Is it general practice that LSPs will get different flavor of XLIFF XSDs from different companies?
And is it possible for them to use it in their XLIFF editor by updating updated XLIFF XSD? I tried to explore “Transolution” but did not find any place where to place modified XSD.
Please let me know if you have any thought on this.
Thanks.
Here are my answers to your two questions:
I work for an LSP and I've seen all sorts and flavors of Xliff. Most of them try to stick to OASIS 1.2 transitional schema. Some of TMS/CAT producers added their own extensions. These producers normally provide an XSD so you can validate their Xliffs by adding that XSD to OASIS schema; e.g. SDL extensions to 1.2. When I'm customizing Xliff for a client, I normally do namespaces and provide a simple additional XSD; e.g.:
<trans-unit id="0" translate="yes" resname="msg_foo">
<superduper:uri>http://foo.bar/iJKLM9</superduper:uri>
<source>This is supposed to be a <superduper:g id="00001" newAtt="this is new attribute" xid="009"/> example.</source>
<target state="new"></target>
</trans-unit>
Most of the TMS/CAT tools are very basic (and closed) when it comes to their Xliff filters (or any of their filters for that matter) and I'm sorta kinda sure that they ignore your customized XSD.
Transolution is a very nice tool and my favorite Open Source translation tool. Unfortunately it's been long abandoned and has plenty of defects and shortcomings.
Anyway, if you provide a sample file, I can tell you what happens to non-conforming tags when it's imported into one of common, major CAT tools.
One final note; <g> seems to be retired in Xliff 2.0.
Forget about Transolution for one thing. I would try it with Trados, MemoQ or MemSource. Those are some of the big tools used in the translation business.
Personally I never got an XLIFF with a XSD, nor do I think Trados can handle it.
What do you need to change in the XLIFF?

Using MvxLang attribute in searchable.xml and menu.xml

I'm using the JSON localization plugin to add some string resource files to my xamarin.android project. Is there support for the MvxLang attribute in non-layout files such as searchable.xml and menu.xml files?
For example, I'd like to replace the below #string references with MvxLang attributes:
<?xml version="1.0" encoding="utf-8" ?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/ApplicationName"
android:hint="#string/SearchHint"
android:searchButtonText="#string/SearchHint">
</searchable>
Thanks
Mark
No. There's no built-in support for either of these.
For menu items, I'm sure you could add tokens to them fairly easily and then replace those tokens with strings when you load/inflate these files. Or alternatively you could even construct the menus in code.
For searchable I think the problem may be more difficult - I'm not sure that Android gives you much access to the searchable file or data object - I think the system uses them at a package level. I suspect for those few searchable text strings, you may have to use the built-in Android i18n system.

XLIFF with multiple target languages?

We would like to use the XLIFF format as base for translating certain texts from German into French and Italian. (The translations will be performed with SDL Trados.)
From the specification, there seems to be precisely one target language per XLIFF file, but additionally there can be specified further "alternate languages". Specifying two target languages would therefore be possible from the spec:
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="de" target-language="it">
<body>
<trans-unit id="hi">
<source>Betrieb</source>
<target>Divisione</target>
<alt-trans>
<target xml:lang="fr">Site</target>
</alt-trans>
</trans-unit>
</body>
</file>
</xliff>
Is this using XLIFF in the expected sense? Or would it be better to produce two documents, one with target language fr and another one with target language it? (I don't like the repetition)
<alt-trans> is not intended for having <target>s in more than one language in each trans-unit; it's rather intended for translation match be it translation memory, machine translation matches, or simple an outdated target string which needs to be updated according to most recent changes in the source string. Having said that, in some cases <alt-trans> is perceived as a workaround for translating what the industry calls "adaptive languages" (French for Canada is often adapted from French translation) without having separate files. As a localization practitioner who has to deal with Xliffs from various sources and presented in various schemas, I recommend to avoid this hack. It is more common and accepted to use the <file> tag to embed trans-units for multiple languages in one Xliff file:
<?xml version="1.0" encoding="utf-8" ?>
<xliff version="1.1" xml:lang='en'>
<file source-language='en' target-language='de' datatype="plaintext" original="Sample.po">
...
<body>
<trans-unit id="1" restype="button" resname="IDC_TITLE">
<source>Title</source>
</trans-unit>
<trans-unit id="2" restype="label" resname="IDC_STATIC">
<source>&Path:</source>
</trans-unit>
...
</file>
<file source-language='en' target-language='fr' datatype="plaintext" original="Sample.po">
<trans-unit id="1" restype="button" resname="IDC_TITLE">
...
</body>
</file>
</xliff>
I work for a translation agency.
I have not seen multilingual xliff files yet. So to make your and your agency's life easier, I would build individual files.
Also other tools like e.g. CenShare create individual files.
And it makes it easier to hand it over to different translators.
According to the OASIS wiki:
An XLIFF document is normally a bilingual file. It has one source language (the language of the original extracted file), and one target language.
However, the <alt-trans> elements can be in language other than the source or target one.
Source: How many languages can I put in an XLIFF document?

Overriding JSF's default I18N handling

Like the asker of the question here
Variable substitution JSF Resource Bundle property file
I'm slightly aghast at the inability to reference the value of other property keys in the message bundle.
Although I see how easy to write my own rubbish handler[0] that can do what I want in a custom component, that would leave expressions in templates calling the message bundle still using the default JSF implementation.
Is it possible to override the default JSF handling of the message bundle?
[0] Or better, to use code referenced in one of the answers to the above question
https://code.google.com/p/reflectiveresourcebundle/
You can provide the fully qualified name of a concrete ResourceBundle implementation as "base name" instead of alone the path and filename of the properties files.
E.g.
public class YourCustomResourceBundle extends ResourceBundle {
// ...
}
which can be registered as follows
<application>
<resource-bundle>
<base-name>com.example.YourCustomResourceBundle</base-name>
<var>text</var>
</resource-bundle>
</application>
or declared on a per-view/template basis as follows
<f:loadBundle baseName="com.example.YourCustomResourceBundle" var="text" />
Here are several related questions/answers which contain some concrete code which you could use as a kickoff example:
How to remove the surrounding ??? when message is not found in bundle
internationalization in JSF with ResourceBundle entries which are loaded from database
i18n with UTF-8 encoded properties files in JSF 2.0 appliaction
Everything is possible for those who try. The question is not whether it is is possible but should you do it. And the answer to that question is: probably not.
Referencing other message in a message bundle means you want to build a compound message. So you can re-use part of the message many times just to save small fraction of the disk space or small fraction of development time.
If that is the case, I have a message for you. What you plan to do is called a concatenation and it is the second most common I18n defect. And its implications are as bad as those of hardcoded strings.
Why? Because target languages do not follow the English grammar rules. First, it is common need to re-order the sentence while translating. This might be easy to fix by using (numbered or named) placeholders. On the other hand though, the translation might differ depending on the context. That is, it might need to be translated in totally other way, or simply the word endings might need to be different depending on a grammar case, mood or gender.
My advice is, do not use such shortcuts, it will create more problems than it fixes.
Now you should know why "those stupid Romans" didn't implement it like this: it is against I18n best practices.

Resources