LonamiWebs / Stringlate

Android application to help in strings.xml translation
https://lonamiwebs.github.io/stringlate/index
MIT License
106 stars 48 forks source link

Add the possibility to mark a String as « need review » #136

Open milouse opened 7 years ago

milouse commented 7 years ago

Hi!

I'm not at all an android developper, thus I don't know if such a feature is possible with the DTD of the string.xml files. But something, which may be really good to ease collaboration between several translators for one language, is the possibility to mark one string as « need review » or « review wanted ». You know, some string may be more complex to translate than others (technical term involved, not really happy with our own phrasing…).

I know that's something that exists in both gettext source files and QT translator source files (which are xml based too). If it does not exists in android, is it problematic to add a custom attribute to the string tag, only understood by Stringlate or is there a risk of failed validation / compilation in this case?

Lonami commented 7 years ago

You mean like, the user doing the current translation may optionally flag it as "review wanted" or something like a second opinion on someone else translating it too? There's nothing official for Android as far as I know.

Adding another attribute to the XML tags doesn't stop Android from compiling these files, so I guess any other attribute that's not relevant gets ignored. Even adding a custom namespace works:

<resources xmlns:stringlate="https://lonamiwebs.github.io/stringlate/xml">
    <string name="str" stringlate:context="Optional…">String</string>
    <!-- ... -->

But… I'm sort of against this. I'm not sure about having Stringlate to add special metadata to the .xml files. I think it should interfere as little as possible with the main development. However, perhaps some sort of comment like:

<!-- Needs review: str, welcome, ... -->

Sounds more like something a translator would do if they had just opened the .xml on a text editor. The comments would signify the string immediately after or otherwise a single comment for a complete list.

milouse commented 7 years ago

You mean like, the user doing the current translation may optionally flag it as "review wanted" or something like a second opinion on someone else translating it too? There's nothing official for Android as far as I know.

Both usage in fact. The current translator may want to mark one of their translation as « good but you know maybe I'm wrong on this one, thus it's better than nothing but if someone could look after it, it would be good. » But it's true than another people may just flag a translation as « ugly for my eyes, but I'm not a translator, or I've no time for this now, thus please some review it ».

The aim of that flag is to be able to filter strings between the non-translated ones, the needing-review ones and all the strings. This idea come to me yesterday when I was reviewing all the string of the app. The majority of them were ok, but some needs proof reading. Thus having an option allowing us to know a bit more about the quality of a string may be good.

However I share your point about not interfering that much with main development. I know indroducing new non-standard metadata is an open gate to weird stuffs applications which dealt with this kind of files risk to badly support.

I was more looking for something like

<string name="about-icon" reviewneeded="true">À propos de l\'application</string>

For information, QT linguist use a « type » attribute, with an unfinished value

<message>
        <source>Very Strong</source>
        <translation type="unfinished">Vraiment très fort</translation>
</message>

But it's surely too much generic.

milouse commented 7 years ago

Ok, at second read of your comment, I understood your point about adding a comment above the translated string. I think it's a good idea, regarding the problem of avoiding to add custom metadata.

A good (and maybe easy to parse) shared habit is the use of the TODO comments in code sources. It could be good to generate this sort of line when someone flag the string as needing review:

<!-- TODO: this translation has been flagged by its author as needing proof reading -->
<string name="about-icon">À propos de l\'application</string>

That way it will be understandable both by people using the app and people working directly on XML files.

Lonami commented 7 years ago

Now how do we deal with this if we find a .xml with all the strings like:

<resources><string name="str">string</string><string name="welcome">welcome</string><!--
 etc --></resources>

Because this is valid .xml and Android won't complain. Sure it's not readable though, but some user may do that. The .xml can get pretty complicated :/

milouse commented 7 years ago

The XML parser you use cannot give you the string node immediately following a given comment node?

Lonami commented 7 years ago

Maybe, I haven't really tried. Applying the template when exporting is actually done through regex because the XML parser I use doesn't allow me to modify nodes while preserving the structure :/

gsantner commented 7 years ago

From developer/development point of view: Comments should come from development (e.g. note what this is about, context of this, where is this used), but not for asking questions or that alike .I suggest to make that external. e.g. add as PR message, on top of Gist, in body of email. Localization platforms (crowdin, transifex) also do store such things on their platform / make it possible to discuss there.

Additionally: If Stringlate may at some point support others than android xml (PO/gettext, ..) this can be used there too, otherwise each would require a "comment"/"review" thing again, which maybe not supported by everything.

Lonami commented 7 years ago

That's a fair point, but if it were to be made external, how would Stringlate know which strings have been flagged for a better review? Or would it just be left to the maintainer of the project? Maybe something like: "Note that the following strings should be reviewed by someone else" (or similar).

Localization platforms

That's a bit of the issue, Stringlate is not a platform per de but rather an application to ease interaction with the translation of Android resource files.

So all in all, you're right there @gsantner :P

gsantner commented 7 years ago

That's a fair point, but if it were to be made external, how would Stringlate know which strings have been flagged for a better review? Or would it just be left to the maintainer of the project? Maybe something like: "Note that the following strings should be reviewed by someone else" (or similar).

Would go for the latter