[sword-devel] LocaleMgr question
Manfred Bergmann
bergmannmd at web.de
Wed Mar 26 11:36:52 MST 2008
Hi Troy.
Thanks for getting back to me.
If Sword is compiled and installed normally into the prefix path (from
configure) then all is fine and the parsekey test works, also using
the system localemgr works.
But for MacSword the compiled Sword library is not in the prefix path
neither are the mods.d and locales.d folders.
Specifying an explicit path when instantiating a new LocaleMgr does
not work.
When debugging it seems that any folder below the specified path are
only searched for "locales.d" folders if there is a prefixpath !=
NULL. But there is none with this kind of LocaleMgr object creation.
When instantiating LocaleMgr without an argument the default
prefixpath and configpath (probably still from configure?) is
retrieved from SWMgr. If then this prefixpath contains a subfolder
"share/sword/locales.d" all works fine.
I think when specifying LocaleMgr with explicit path the
"if(prefixpath)" makes no sense because the way it is now in the
constructor prefixpath will never be anything else then NULL when
iConfigPath is specified.
I tried using loadConfigDir(<path_to_locale>) and it seems to work fine.
Manfred
Am 26.03.2008 um 17:17 schrieb Troy A. Griffitts:
>>> There is a problem with loading the correct locale in MacSword. This
>>> is how it is done:
>>> (I need to point out that MacSword has the "locale.d" folder with
>>> all
>>> available locales in the Application bundle, means it is part of the
>>> application and it is not using the default locales in ~/.sword.)
>>>
>>> 1. getting the default system localemgr
>>> 2. checking the supported languages by the OS and looping over
>>> available locales in locale.d (in the bundle) until one is found.
>>> utf8
>>> is prefered if exists.
>>> 3. setting a found locale with setDefaultLocaleName(<locale name>)
>>>
>>> However this doesn't work.
>>>
>>> If I do a getLocale(<locale name>) NULL is returned.
>
> Have a look in sword/tests for parsekey. Try running it and passing a
> locale string and see if it fails in the same way.
>
>
>
>>> I think that probably is why the default system localemgr is not
>>> looking at the locale.d folder of the bundle and thus can't find the
>>> locale.
>>> How can localemgr be forced to use the locale file in the bundle?
>
> locales.d should be in the same location as the main mods.d. If you
> want to force a different configuration (not recommended as any other
> sword app on the system will not be able to find things in the default
> places), you can call:
>
> LocaleMgr::setSystemLocaleMgr(new LocaleMgr("/path/to/your_locals"));
>
>
>>>
>>> Another question is which string encoding is prefered for <locale
>>> name>?
>
> LocaleMgr::getLocale(...) expects the ascii name which corresponds to
> the Name property in the [Meta] section of the locales.d/
> <local>.conf file.
>
> You must build with ICU to get the utf-8 locales loaded by the engine
> and they will take precedence. But the encoding of the <local name>
> is
> always a simple ascii name like "de".
>
> Hope this helps.
>
> -Troy.
>
>
>
>
>>>
>>>
>>> Regards,
>>> Manfred
>>>
>>>
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>>
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
More information about the sword-devel
mailing list