[vlc-devel] Getting xgettext to process lua html scripts (bring i18n to html intf)

Rémi Denis-Courmont remi at remlab.net
Thu Oct 20 22:53:53 CEST 2011


Le jeudi 20 octobre 2011 17:44:46 Francois Cartegnie, vous avez écrit :
> lua provides gettext functions for i18n and we can use it in html
> interfaces then.
> 
> xgettext does recognize the language by looking at the file extensions,
> and html isn't in its list.
> 
> "<?vlc ?>" would match php short tags: xgettext can parse this language.
> We could force php mode on xgettext's command line.
> 
> Unfortunately, we can't change the po/Makefile.in.in, as it is always
> overwritten with the one provided by gettext's library.
> 
> We have 3 way to solve this:
> 
> - Add extra rules files in po/ to be processed by gettext's Makefile.
> Would mean duplicating part of gettext's Makefile.in.in code, and
> require maintaining it.

I don't see how that can work, unless you're proposing to create a separate 
text domain for Lua scripts. And that would suck, because it would duplicate 
some of the translation efforts.

> - Change lua's html scripts to php extension and write redirects for
> backward compatibility.
> Would break documentation, and require lots of changes for that minor
> feature. No way.

No way indeed.

> - Process html script files as-is.
> That works, except a warning.
> But as it is being processed as C code by default, we can't guarantee
> its behaviour when running into C comments strings. It might miss some
> strings then.

I don't know.

Another alternative is to write a custom script that generate dummy code from 
Lua script, containing just the strings that you want to translate. This might 
also apply for the still troublesome Qt4 translations. This would require 
careful hackery to not break makefile dependencies though.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list