Discussion:
[sane-devel] Supported languages?
Jeff Sadowski
2017-09-29 19:56:19 UTC
Permalink
I only speak english however is there a way to make scanimage print out
help in another language? or is scanimage english only?

I tried

export LANG=de_DE.UTF-8
export LANGUAGE=de_DE
scanimage -h

and

export LANG=de_DE.utf8
export LANGUAGE=de_DE
scanimage -h

and made sure I had de_DE.UTF-8 to choose from via

locale -a|grep DE
de_DE.utf8

but I only get english. Have various systems to test from Ubuntu and Fedora
Jeff
2017-09-30 20:33:18 UTC
Permalink
Post by Jeff Sadowski
I only speak english however is there a way to make scanimage print out
help in another language? or is scanimage english only?
Assuming that the de_DE locale is installed, the following should work
(no need to export):

LC_ALL=de_DE LC_MESSAGES=de_DE LC_CTYPE=de_DE LANG=de_DE LANGUAGE=de_DE
scanimage

Regards

Jeff
Jeff Sadowski
2017-09-30 23:52:36 UTC
Permalink
I set all those and I still get English.

export LANG=de_DE.utf8
export LANGUAGE=de_DE
export LC_ALL=de_DE
export LC_MESSAGES=de_DE
export LC_CTYPE=de_DE
export LANG=de_DE
export LANGUAGE=de_DE
scanimage -h

Or maybe I've been speaking German all along.
Or maybe there is a TARDIS translating it for me.
Post by Jeff
Post by Jeff Sadowski
I only speak english however is there a way to make scanimage print out
help in another language? or is scanimage english only?
Assuming that the de_DE locale is installed, the following should work
LC_ALL=de_DE LC_MESSAGES=de_DE LC_CTYPE=de_DE LANG=de_DE LANGUAGE=de_DE
scanimage
Regards
Jeff
--
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
Yury Tarasievich
2017-10-01 04:18:40 UTC
Permalink
Does scanimage actually contain the l10n
functionality?

-Yury
Post by Jeff Sadowski
I set all those and I still get English.
export LANG=de_DE.utf8
...
--
sane-devel mailing list: sane-***@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
to sane-devel-***@lists.alioth.debian.org
Jeff
2017-10-01 07:15:15 UTC
Permalink
Does scanimage actually contain the l10n functionality?
Indirectly. scanimage pulls in the option title and description from the
backend. Therefore, if the backend has translations, then scanimage will
pass them on. e.g. fujitsu:

https://anonscm.debian.org/cgit/sane/sane-backends.git/tree/backend/fujitsu.c

if(option==OPT_GAMMA){
opt->name = "gamma";
opt->title = SANE_I18N ("Gamma function exponent");
opt->desc = SANE_I18N ("Changes intensity of midtones");

SANE_I18N is the C macro that fetches the translations.

Regards

Jeff
Olaf Meeuwissen
2017-10-01 11:18:34 UTC
Permalink
Hi Yury,
Post by Yury Tarasievich
Does scanimage actually contain the l10n
functionality?
Good question!

While the backends have their messages translated to some 20 languages,
it is the SANE frontend's responsibility to activate translation. I did
a quick check of the scanimage source code and it doesn't seem to do so.

Hope this helps,
--
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13 F43E B8A4 A88A F84A 2DD9
Support Free Software https://my.fsf.org/donate
Join the Free Software Foundation https://my.fsf.org/join
--
sane-devel mailing list: sane-***@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
to sane-devel-***@lists.alioth.debian.org
Jeff Sadowski
2017-10-01 17:04:15 UTC
Permalink
I'm not sure I grasp it.

So if I install ubuntu on a vm for each language I want to support would I
be able to copy the output for each language?
Or would it be better to do a google translate for the languages? I can add
tables for translating the common options if need be.
Post by Olaf Meeuwissen
Hi Yury,
Post by Yury Tarasievich
Does scanimage actually contain the l10n
functionality?
Good question!
While the backends have their messages translated to some 20 languages,
it is the SANE frontend's responsibility to activate translation. I did
a quick check of the scanimage source code and it doesn't seem to do so.
Hope this helps,
--
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13 F43E B8A4 A88A F84A 2DD9
Support Free Software https://my.fsf.org/donate
Join the Free Software Foundation https://my.fsf.org/join
--
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
abel deuring
2017-10-01 19:41:41 UTC
Permalink
Post by Jeff Sadowski
I'm not sure I grasp it.
So if I install ubuntu on a vm for each language I want to support would
I be able to copy the output for each language?
No: The i18n concept for Sane is this:

- The backends return in every case the Endlish strings as they appear
in the source code.
- A frontend can/should use the PO files to replace the english strings
with the desired language.

The problem is that scanimage, the frontend, does not support i18n/l10n.

Perhaps one more reason to follow Jeff's advice not to call scanimage
but to write a Sane library for PHP ;)
Post by Jeff Sadowski
Or would it be better to do a google translate for the languages? I can
add tables for translating the common options if need be.
Well, the translations are all there, in .po/.mo files -- just use them
;) But again, this is much easier to do if a PHP wrapper for Sane
backends directly passes the English strings to your application than to
search for these strings in the output from scanimage.

I am not at all familiar with PHP, but I'd bet that it supports gettext().

Abel
Post by Jeff Sadowski
On Sun, Oct 1, 2017 at 5:18 AM, Olaf Meeuwissen
Hi Yury,
Post by Yury Tarasievich
Does scanimage actually contain the l10n
functionality?
Good question!
While the backends have their messages translated to some 20 languages,
it is the SANE frontend's responsibility to activate translation.  I did
a quick check of the scanimage source code and it doesn't seem to do so.
Hope this helps,
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join
--
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
<http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel>
Unsubscribe: Send mail with subject "unsubscribe your_password"
--
sane-devel mailing list: sane-***@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
to sane-devel-***@lists.alioth.debi
Jeff
2017-10-01 19:54:13 UTC
Permalink
Post by Jeff Sadowski
So if I install ubuntu on a vm for each language I want to support would
I be able to copy the output for each language?
The messages specific to scanimage (look at the scanimage source, but
things like progress and error messages, e.g.
https://anonscm.debian.org/cgit/sane/sane-backends.git/tree/frontend/scanimage.c,
line 1919) are not translated, because scanimage hasn't tried to.

However, scanimage just passes on the strings for the option titles and
descriptions from the backend, and these are (often) translated.

Your application can do the same - just pass on the translations from
the backends (remember to use the sane-backends domain for gettext).

Obviously messages from your application you will have to translate
yourself.
Post by Jeff Sadowski
Or would it be better to do a google translate for the languages? I
can add tables for translating the common options if need be.
NOOOOOOO! Google translate is excellent for getting the gist of
something written in a language you don't understand, but the
translations are almost always really horrible.

The standard method for translating applications in C, Perl, etc. is to
mark the strings. Tradition dictates an underscore, e.g. _"string to be
translated" but sane-backends uses SANE_I18N (e.g.
https://anonscm.debian.org/cgit/sane/sane-backends.git/tree/backend/fujitsu.c,
line 3097).

PHP uses a similar method:

http://php.net/manual/en/function.gettext.php

So having appropriately marked your strings, gettext will extract them
into a .pot file, which you can give to your translators (I use rosetta
on launchpad), and you get a .po file for each language with the
appropriate translations (or not).

You convert the .po files to .mo files when you build the application
and install them to the appropriate place, and Bob should be your uncle.

It all works for me. The strings specific to gscan2pdf I have had
translated as above, and I fetch the backend strings from the
sane-backend domain.

Regards

Jeff

Continue reading on narkive:
Loading...