History log of /haiku/src/kits/locale/Catalog.cpp
Revision Date Author Comments
# 41853a8b 25-Aug-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

locale kit: allow creating a catalog without entry_ref

The catalogs are loaded from separate files, so there is no need to have
an app entry_ref to load them, just a MIME type is enough.

The implementation is a bit simplified: only the default catalog format
is allowed (unlike when loading from entry_ref, where extra catalog
formats can be added in add-ons).

Unrelated cleanup: remove unused code to load catalogs from attributes
of an application. We considered this when designing the locale kit, but
using resources or separate files works better.

Use this in Cortex, where some strings are in a static library, so they
don't have an associated executable or library or add-on to identify
them. The code in Cortex is not complete localization, several parts
should use StringForRate, BStringFormat, etc.

Change-Id: I09be22b1f50891250c4497c51e1db8dcee279140
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3172
Reviewed-by: Kacper Kasper <kacperkasper@gmail.com>


# 93b5e561 20-Nov-2012 Oliver Tappe <zooey@hirschkaefer.de>

Adjust Locale Kit to no longer use syslog


# 541ff51a 15-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup BCatalogAddOn.

* rename BCatalogAddOn to BCatalogData, since it doesn't represent an
add-on, but rather the catalog data provided by an add-on
* move BCatalogData out of Catalog.{h,cpp} into its own header and
implementation file
* drop BCatalogData::MarkForTranslation() methods, they're not needed
* drop BCatalog::GetNoAutoCollectString() methods, they're not being
used anywhere
* cleanup the B_TRANSLATE_... macros somewhat
* add versions of the B_TRANSLATE_MARK_... macros that are meant to be
used in void context (when the string isn't being used by the program,
just meant to be picked up by collectcatkeys).
* adjust several apps to use B_TRANSLATE_MARK_..._VOID where needed
* adjust users of BCatalogAddOn accordingly


# 16e50923 14-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Extract EditableCatalog from Catalog.{h,cpp}.

* move EditableCatalog to its own header and implementation file
* move problematic BCatalog::CatalogAddOn() to EditableCatalog
* adjust Locale tools accordingly


# cc52f0df 14-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Make BCatalog threadsafe.

* use a locker to protect the CatalogAddOn-chain against parallel
access
* rename BCatalog::SetCatalog() to SetTo() and make it a proper
initializing function
* adjust implementation of BLocaleRoster accordingly


# 250eca32 14-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Start cleanup of Catalog.{h,cpp}

* unify pointer style (to type* )
* always use boolean expressions in if
* introduce some spacing for better readability
* make a couple inline methods non-inline


# 1a5c1f9e 01-Nov-2011 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Use const references instead of pointers for the read from/write to
attribute/resource method in locale kit catalogs
* Only load the embedded catalog if nothing else was found, so it can easily
be overridden
* Change the resource type to 'CADA' (CAtalog DAta) for embedded catalogs, and
use a hash of the language code as the resource ID. This allows multiple
languages to be stored in the same file and does not interfere with the user
storing his own BMessages as resources.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43057 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 54fad654 31-Oct-2011 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

Rework the handling of catalog loading in locale kit :
Instead of computing the mime signature and giving this to the catalog system,
give an entry_ref instead. The default catalog add-on can thus look at the
right place when searching local catalogs (embedded as resources, or stored
as files next to the executable.
* This allows different versions of the same app to each have their own
catalog set,
* And also make the embedded/local catalog searching work for add-ons and
libs, instead it only worked for apps because of a getAppInfo call.

Fix cpufrequency to make use of it properly (that wouldhave worked without the
change, but nowit's mandatory, since loading a catlog by mimesignature is not
possible anymore).

Should fix #8037.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43021 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 25dc253d 22-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Merged weak-symbols branch.
* Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp
* Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 34a79bff 04-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* renamed BPrivate::mutable_locale_roster to BPrivate::gMutableLocaleRoster,
to follow coding guidelines

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a09c2bb3 03-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* ReadOnlyBootPrompt finally saves the locale settings again, so at first bot the system will be in the right language.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37863 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5dbb457c 03-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Allow ReadOnlyBootPrompt to change languages at runtime again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37862 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38ac8def 01-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

Largish cleanup sweep concerning the Locale Kit (sorry it got so big):
* refactored private/mutable stuff out of LocaleRoster into MutableLocaleRoster
* moved management of Locale/Time settings file and broadcasting of any changes
out of preflets and into MutableLocaleRoster
* added proper sorting to the listviews of the Locale preflet
* the Time preflet no longer overlaps long timezone names into the actual time
* several fixes with respect to leaking ICU objects, esp. in BCountry
* the locale roster no longer passes out references to its own BCountry object,
but uses copies, instead - this makes locking superfluous, as the clients'
BCountry objects can no longer be changed by the setting a new default
country in the locale roster
* removed pretty useless POSIX-style symbol fetching from BCountry - if we
need that at all, it should live in the dedicated formatter classes
* adjusted readonlybootprompt, dstcheck and Deskbar to the changed Locale API
* refactored existing Time-formatter into TimeUnitFormat and DurationFormat
(the latter of which is now used by AboutSystem)
* added stubs for Date, DateTime and Time formatters
* lots of coding style fixes throughout the Locale Kit and the Locale and Time
preflets
This will probably break most external apps making use of the Locale Kit - it
does break WebPositive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37831 a95241bf-73f2-0310-859d-f6bbb57e9c96


# be8fa2fb 02-Jul-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Update all applications in tree to use the new localizing system
* Remove the old one from the locale librairy, with some cleanup
Known regressions :
* readonlybootprompt will no longer update the locale settings : the
method used messed with internal undocumented things
* external localized apps (webpositive for example) will not run
anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37336 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76a4353b 01-Jul-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

Add a new way of using the locale kit with static accessors instead of global variables. This has the following consequences :
* Applications don't have to declare BCatalog fCatalog themselves, it's now done automatically
* Libs and add-ons can be localized just the same way (except static libraries)
For now this new system is yet disabled as I'm looking for some peer review before going on. To enable it you have to define B_TRANSLATE_USE_NEW_MACROS in each file doing catalog access. This will not stay, I'll update the
other apps to use it.
The linking in jamfiles must be not only with liblocale.so, but also liblocalestub.a. Not sure how to handle this for user-side applications. Libraries are also required to provide a MIME signature to use any catalog.
The locale preflet is updated to the new system (as a test). Othe rapps will follow if everyone is ok with this approach.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37323 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 005a5d0b 21-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

Stumbled across some problems while using the Locale Kit and added TODOs
accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35214 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76065080 20-Sep-2009 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

-Delete some old unused files
-Some style fixes (mostly whitespace)
-Switch to the short language list and make it build again. seems to have trouble with BStringByteSink and utf8, or is it just my build env having encoding problems ?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33209 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb581e32 18-Sep-2009 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

Fixed licence headers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33185 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75f15221 18-Sep-2009 Oliver Tappe <zooey@hirschkaefer.de>

* reintegrated gsoc-locale-kit branch into trunk - there's more
work to do, but it's about time to give this code more exposure.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33176 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c3ac87e8 01-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* Copied imported OpenTracker Locale Kit files from the vendor branch
into their new homes (at least for now, might need some adjustment).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30540 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93b5e5614cab5777788dff6f6ecd7cbe00892fe0 20-Nov-2012 Oliver Tappe <zooey@hirschkaefer.de>

Adjust Locale Kit to no longer use syslog


# 541ff51a6ef4c47f8ab105ba6ff895cdbba83aca 15-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup BCatalogAddOn.

* rename BCatalogAddOn to BCatalogData, since it doesn't represent an
add-on, but rather the catalog data provided by an add-on
* move BCatalogData out of Catalog.{h,cpp} into its own header and
implementation file
* drop BCatalogData::MarkForTranslation() methods, they're not needed
* drop BCatalog::GetNoAutoCollectString() methods, they're not being
used anywhere
* cleanup the B_TRANSLATE_... macros somewhat
* add versions of the B_TRANSLATE_MARK_... macros that are meant to be
used in void context (when the string isn't being used by the program,
just meant to be picked up by collectcatkeys).
* adjust several apps to use B_TRANSLATE_MARK_..._VOID where needed
* adjust users of BCatalogAddOn accordingly


# 16e5092306efca466d27519953cdbb803f3d5f5e 14-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Extract EditableCatalog from Catalog.{h,cpp}.

* move EditableCatalog to its own header and implementation file
* move problematic BCatalog::CatalogAddOn() to EditableCatalog
* adjust Locale tools accordingly


# cc52f0df3a040ee5056f9bf781d7d30a676767e5 14-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Make BCatalog threadsafe.

* use a locker to protect the CatalogAddOn-chain against parallel
access
* rename BCatalog::SetCatalog() to SetTo() and make it a proper
initializing function
* adjust implementation of BLocaleRoster accordingly


# 250eca3254c11a3f2762768287b83f39ff992855 14-Apr-2012 Oliver Tappe <zooey@hirschkaefer.de>

Start cleanup of Catalog.{h,cpp}

* unify pointer style (to type* )
* always use boolean expressions in if
* introduce some spacing for better readability
* make a couple inline methods non-inline


# 1a5c1f9ed57fae37829befc007cd51c32205c1cd 01-Nov-2011 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Use const references instead of pointers for the read from/write to
attribute/resource method in locale kit catalogs
* Only load the embedded catalog if nothing else was found, so it can easily
be overridden
* Change the resource type to 'CADA' (CAtalog DAta) for embedded catalogs, and
use a hash of the language code as the resource ID. This allows multiple
languages to be stored in the same file and does not interfere with the user
storing his own BMessages as resources.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43057 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 54fad654ce9986a2b0ce4849608e738907509292 31-Oct-2011 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

Rework the handling of catalog loading in locale kit :
Instead of computing the mime signature and giving this to the catalog system,
give an entry_ref instead. The default catalog add-on can thus look at the
right place when searching local catalogs (embedded as resources, or stored
as files next to the executable.
* This allows different versions of the same app to each have their own
catalog set,
* And also make the embedded/local catalog searching work for add-ons and
libs, instead it only worked for apps because of a getAppInfo call.

Fix cpufrequency to make use of it properly (that wouldhave worked without the
change, but nowit's mandatory, since loading a catlog by mimesignature is not
possible anymore).

Should fix #8037.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43021 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 25dc253d6ab28ce204fa4de2d3e7a27d167fc817 22-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Merged weak-symbols branch.
* Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp
* Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 34a79bff8ad710b8e8024b0006a77ec8a9f45b16 04-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* renamed BPrivate::mutable_locale_roster to BPrivate::gMutableLocaleRoster,
to follow coding guidelines

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37908 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a09c2bb328990ebffc3ddf6a8a8d8d6a766b1b03 03-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* ReadOnlyBootPrompt finally saves the locale settings again, so at first bot the system will be in the right language.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37863 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5dbb457c095b56fa85c269b40ecaa43a31a1f735 03-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Allow ReadOnlyBootPrompt to change languages at runtime again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37862 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38ac8def5a72de58d6ae4e82d8c4a6be1021e67e 01-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

Largish cleanup sweep concerning the Locale Kit (sorry it got so big):
* refactored private/mutable stuff out of LocaleRoster into MutableLocaleRoster
* moved management of Locale/Time settings file and broadcasting of any changes
out of preflets and into MutableLocaleRoster
* added proper sorting to the listviews of the Locale preflet
* the Time preflet no longer overlaps long timezone names into the actual time
* several fixes with respect to leaking ICU objects, esp. in BCountry
* the locale roster no longer passes out references to its own BCountry object,
but uses copies, instead - this makes locking superfluous, as the clients'
BCountry objects can no longer be changed by the setting a new default
country in the locale roster
* removed pretty useless POSIX-style symbol fetching from BCountry - if we
need that at all, it should live in the dedicated formatter classes
* adjusted readonlybootprompt, dstcheck and Deskbar to the changed Locale API
* refactored existing Time-formatter into TimeUnitFormat and DurationFormat
(the latter of which is now used by AboutSystem)
* added stubs for Date, DateTime and Time formatters
* lots of coding style fixes throughout the Locale Kit and the Locale and Time
preflets
This will probably break most external apps making use of the Locale Kit - it
does break WebPositive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37831 a95241bf-73f2-0310-859d-f6bbb57e9c96


# be8fa2fb3088ab1921612b60f352dd9334b40b3d 02-Jul-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Update all applications in tree to use the new localizing system
* Remove the old one from the locale librairy, with some cleanup
Known regressions :
* readonlybootprompt will no longer update the locale settings : the
method used messed with internal undocumented things
* external localized apps (webpositive for example) will not run
anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37336 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76a4353b79418ab1d9050821a5578bef0d40df0c 01-Jul-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

Add a new way of using the locale kit with static accessors instead of global variables. This has the following consequences :
* Applications don't have to declare BCatalog fCatalog themselves, it's now done automatically
* Libs and add-ons can be localized just the same way (except static libraries)
For now this new system is yet disabled as I'm looking for some peer review before going on. To enable it you have to define B_TRANSLATE_USE_NEW_MACROS in each file doing catalog access. This will not stay, I'll update the
other apps to use it.
The linking in jamfiles must be not only with liblocale.so, but also liblocalestub.a. Not sure how to handle this for user-side applications. Libraries are also required to provide a MIME signature to use any catalog.
The locale preflet is updated to the new system (as a test). Othe rapps will follow if everyone is ok with this approach.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37323 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 005a5d0bfeda8b1f5b4de97f0368ef6f3ad89193 21-Jan-2010 Stephan Aßmus <superstippi@gmx.de>

Stumbled across some problems while using the Locale Kit and added TODOs
accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35214 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 76065080e65ea7903e2f89413e7c5c43e23238e0 20-Sep-2009 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

-Delete some old unused files
-Some style fixes (mostly whitespace)
-Switch to the short language list and make it build again. seems to have trouble with BStringByteSink and utf8, or is it just my build env having encoding problems ?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33209 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb581e32d1632651d11826b1c1797e8fb0f3acdb 18-Sep-2009 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

Fixed licence headers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33185 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 75f152215517c2af1a93938f46d3156503329a5e 18-Sep-2009 Oliver Tappe <zooey@hirschkaefer.de>

* reintegrated gsoc-locale-kit branch into trunk - there's more
work to do, but it's about time to give this code more exposure.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33176 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c3ac87e8fc6f81023c44faed6cf00c8a916f4e31 01-May-2009 Oliver Tappe <zooey@hirschkaefer.de>

* Copied imported OpenTracker Locale Kit files from the vendor branch
into their new homes (at least for now, might need some adjustment).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30540 a95241bf-73f2-0310-859d-f6bbb57e9c96