Hi, 2011/6/15 Bjoern Michaelsen <bjoern.michael...@gmail.com>: >> I would like to work on "gettextizaton" of LibreOffice. Michael said >> you had an initial patch. Can you share it with me? > > No, I have no patch, I just collected some starting points and design > considerations. You find those here: > > http://wiki.documentfoundation.org/Development/gettext-design
I have an initial patch (attached) which works on Linux. There is still a lot to implement, e.g. context handling, which also requires re-design of the way we extract strings from the source etc. I just wanted to let you know about my progress. Questions and comments are welcome. Also, can you let me know where the .xcd files are processed? IMHO not all SDF translations pass the ResMgr in the library tl, only the strings from .res files. Thanks, Andras
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index f397532..a513e79 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -32,6 +32,8 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> +#include <libintl.h> +#include <locale.h> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <tools/resmgr.hxx> @@ -1705,6 +1707,13 @@ ResMgr* ResMgr::CreateResMgr( const sal_Char* pPrefixName, OUString aPrefix( pPrefixName, strlen( pPrefixName ), osl_getThreadTextEncoding() ); + setlocale(LC_ALL, ""); + rtl::OUString aL10nPath(RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program/resource")); + rtl::Bootstrap::expandMacros(aL10nPath); + char *p = bindtextdomain( pPrefixName, rtl::OUStringToOString(aL10nPath, RTL_TEXTENCODING_UTF8).getStr()+7); + OSL_TRACE( "bindtextdomain(): %s -> %s\n", pPrefixName, p ); + textdomain( pPrefixName ); + if( ! aLocale.Language.getLength() ) aLocale = ResMgrContainer::get().getDefLocale(); @@ -1783,9 +1792,15 @@ UniString ResMgr::ReadStringWithoutHook() UniString ResMgr::ReadString() { + UniString aEmptyStr; UniString aRet = ReadStringWithoutHook(); if ( pImplResHookProc ) pImplResHookProc( aRet ); + if ( aRet != aEmptyStr ) + { + char *p = gettext(rtl::OUStringToOString(aRet, RTL_TEXTENCODING_UTF8).getStr()); + aRet = OUString(p, strlen(p), RTL_TEXTENCODING_UTF8); + } return aRet; }
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice