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

LIB-47: I18n of error messages #27

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

LIB-47: I18n of error messages #27

wants to merge 14 commits into from

Conversation

JonnyJD
Copy link
Contributor

@JonnyJD JonnyJD commented Jun 24, 2013

http://tickets.musicbrainz.org/browse/LIB-47

This is work in progress. A bit of testing code was included so a string is printed on discid_new() invocation. That string is translated using gettext. (needs more work).

Building itself works fine on Linux with cmake and autotools.
Autotools already includes near full gettext support. implementing --disable-nls and a fallback when libintl.h is not found is still missing. .pot/.po are updated with "make update-po" in po/ or with make dist.

CMake builds don't have any support for .mo generation/installation, but the binary is able to use these (when installed through other means). Shouldn't be too difficult to create targets manually though.

Not testing on other platforms was done yet.

The discid example needs a setlocale (to inherit the locale from the
environment) and our code needs to call libintl.h and
dgettext(PACKAGE, String) basically.
This doesn't add much to the source repository, but a whole lot to the
distribution.
libdiscid.pot is created automatically with make
de.po was created with msginit -i po/libdiscid.pot (with german locale
set)
mo compilation and installation works fine in Cmake,
except that I have to give the languages manually.

Implementing ENABLE_NLS also wasn't so bad.
Didn't test much though.
We can't actually disable NLS with a parameter yet,
but we check for libintl.h and enable NLS if found.

Finding gettext and libintl are different things.
libintl is for the actual translation messages support,
gettext is to create the .mo, which is included in the distribution
anyways.
This should also check for libintl that isn't included in libc on other platforms, but this is tested on MinGW/Windows XP.

automake possibly does work fine, but takes ages..
They are re-created with autopoint,
not sure what went wrong that I had to add them to the repository
before.
0.18.2 is current, but like half of the systems I tested still had the
older version.
On FreeBSD libintl is external so it has to be linked seperately.
lib and include are in /usr/local/lib in my installation.
I don't remember why and when then ended up there and if I built that
myself.
We now have support for disabling NLS.
This is important, since otherwise the libintl and iconv dlls need to be available!

Also NLS possibly stands for Native Language Support.
It doesn't say so in the overly long ABOUT-NLS..
@ghost ghost assigned JonnyJD Jun 24, 2013
@JonnyJD
Copy link
Contributor Author

JonnyJD commented Jun 25, 2013

In general this compiles on every platform now. I only had a real problem on Solaris. Autotools works, but cmake doesn't compile for me without disabling NLS manually cmake -DDISABLE_NLS=1 .. Probably because there are different versions of libc and libintl installed on the machine.

NLS can be disabled in autotools and Cmake. Libdiscid compiles just like before then.
GNU/Linux has built-in libintl support so it works without additional libraries. An external Libintl and a matching iconv (possibly also external) are needed on other platforms (as dependencies). However, NLS is optional.
The problem on Windows and Mac OS X is, that libintl and iconv binaries should be included in the binary distributions. Possibly with sources and license (LGPL for both, so this should be fine). We also might want to provide a build with and without NLS?

I am also not sure how it works with the locale directory. The directory is set at compile time, so this can't work with binary distributions (unless they are installed in the same location?). Possibly this can be fixed for/with Picard?

Still only autotools includes a target to update the pot/po files.

@JonnyJD
Copy link
Contributor Author

JonnyJD commented Jun 29, 2013

Currently "gettext" is not installed on the build server so "autopoint" is not found there.

@JonnyJD
Copy link
Contributor Author

JonnyJD commented Jun 30, 2013

autopoint installed on jenkins

jenkins: retest this please.

EDIT:
Looks like the previous didn't work somehow. Trying again in the next comment.

@JonnyJD
Copy link
Contributor Author

JonnyJD commented Jun 30, 2013

retest this please

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

Successfully merging this pull request may close these issues.

1 participant