[pyicu-dev] load custom resource package
whit sheldon
whit.sheldon at gmail.com
Sun Jul 5 08:29:18 PDT 2009
I am new to this list and while a -dev list seemed like it might not be the
place for this question, I could not find a more appropriate list. If this
is not appropriate here, please point me in the right direction. Thanks in
advance for any help.
I am trying to open a custom resource package with PyICU. I have built
PyICU against ICU 4.0 with no errors. I have been able to successfully use
some of the example code to access default ICU locale information and
convert dates and times, etc. I am now trying to access localized strings
from a custom ICU package ( *.dat file) that I built using icu tools. I
know the dat file is correct because I can access it just fine using ICU
directly from C++ code.
In C++ I would use the package something like below:
typedef std::basic_string<UChar> UString;
u_setDataDirectory("path_to_data_directory");
UResourceBundle * m_languageResources = ures_open( "name_of_package",
"es_MX", &err );
UString resString = ures_getStringByKey( m_languageResources,
"key_to_localixed_string", &len, &err);
I can see that not all of the ResourceBundle functions have been provided in
the wrappers, but it appears that I should be able to load the
ResourceBundle. The wrapper code (see excerpt below from locale.cpp)
appears to support the loading of a custom resource bundle that specifies a
package but as yet I haven't figured out how get a valid ResourceBundle.
excerpt from t_resourcebundle_init: (I think this what I need where *u is
the package name(?))
if (!parseArgs(args, "SP", TYPE_CLASSID(Locale),
&u, &_u, &locale))
{
INT_STATUS_CALL(bundle = new ResourceBundle(*u, *locale, status));
self->object = bundle;
self->flags = T_OWNED;
break;
}
If any one could provide some pointers I would appreciate it. I am
currently trying to figure out how to add to the current code to include a
wrapper for ures_open(). Any help there would also be apreciated. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/pyicu-dev/attachments/20090705/2c22c4de/attachment.htm
More information about the pyicu-dev
mailing list