History log of /haiku/headers/private/locale/MutableLocaleRoster.h
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>


# 52cdfde0 25-Nov-2012 Oliver Tappe <zooey@hirschkaefer.de>

Fix relying on order of static object destruction in Locale Kit.

* use only a single static object (MutableLocaleRoster) instead of
two, which avoids any problems if the order of static object
destruction would destroy RosterData before MutableLocaleRoster
* rename BPrivate::RosterData to BPrivate::LocaleRosterData and move
it into a header and implementation file of its own
This should hopefully fix problems encountered with a clang-compiled
Locale Kit.


# 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


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

Fix #8452 (app's crashing for non-existent system catalog)

* make the system catalog a BCatalog instead of a BCatalogAddOn*,
such that using a non-existing system catalog won't crash but
simply return the untranslated string instead
* rename MutableLocaleRoster::GetSystemCatalog() to LoadSystemCatalog()
and adjust it to use BCatalog::SetTo() in order to replace the
data used by the given catalog
* adjust all users of gSystemCatalog accordingly


# 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


# ed7ee7a4 11-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Localization support for filesystem entries in Tracker and Deskbar (leaf menu). (It appears to work, but is likely incomplete and quite possibly incorrect.) Fix issue with RosterData::Refresh() resulting in a B_LOCALE_CHANGED broadcast, and Deskbar looping. Add a global boolean gLocalizedNamePreferred to avoid calling BLocaleRoster::Default()->IsFilesystemTranslationPreferred() too often from Model instances. Following Tracker code style in libtracker, so as to not mix in too much clean-up.

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


# 07cffb47 11-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Introducing a Locale option to display localized filesystem entries (primarily apps and folders) in Deskbar, Tracker, etc. Making use of this in Deskbar's list of apps. The option currently defaults to off, to avoid exposing everyone to unfinished work.

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


# 1d8dff01 16-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* improve locale roster to no longer rely on static object
initialization order
This was meant to fix #7227, but just seems to have bypassed it - the crash is now somewhere else ... needs more investigation

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40529 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


# 6fd2f4a0 23-Oct-2010 Oliver Tappe <zooey@hirschkaefer.de>

One more monster commit (sorry ...) concerning the Locale Kit:
* extracted new class BFormattingConventions from BCountry, which
manages the formatting conventions from a given locale and
allows to get/set the four different date/time formats supported
by ICU-locales as well as number and monetary formats
* overhauled the Locale preflet:
+ drop editing features for all formats, since I don't think
they do not make much sense to have in a prefs GUI - being
able to select from the existing locales should be good
enough. Please note that you can still change the formats
programmatically in an application.
+ renamed the 'Countries' tab to 'Formatting'
+ the locale formatting conventions list in the 'Formatting'
tab is now hierarchical for easier access (less scrolling)
+ fixed functionality of 'Revert' and 'Defaults' buttons
+ added support for using the month/day-names of your preferred
language during date formatting
* adjusted BLocale to ask BFormattingConventions for the current
formats when formatting dates and times and to offer 4
different format styles (full, long, medium and short).
* adjust all classes formatting dates/times to pick the
appropriate format style
* BLocaleRoster no longer directly archives/unarchives the
individual formatting conventions but delegates that to
BFormattingConventions


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


# d1d8fda6 19-Oct-2010 Oliver Tappe <zooey@hirschkaefer.de>

Next step of Locale Kit refactoring:
* BLocale now keeps language and country completely separate and
mixes the formatting conventions into the current language's locale
when formatting dates and times (needs to be done for number- and
currency-formatting, too, since the digits may not be in the
preferred language)
* optimized fetching of the flag icons such that they are all loaded
in one go (by the locale roster) - this alone speeds up the Locale
preflet considerably
* worked on fixing the language confusion in the Locale preflet
* fixed a couple of bugs in the Locale preflet that would lead to
illegal characters being displayed in the date-subpart menus


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


# b7f60965 30-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* removed all BLocale-related getters from BLocaleRoster - they're available
in BLocale (which is accessible via be_locale)
* adjusted all users accordingly


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


# a9faf943 29-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* reintroduced be_locale as global information point for the current locale
values
* added locking to BLocale (needed since the data of the global object may
change any time)
* BLocale no longer passes out pointers to internal objects, it fill objects
passed in by the client instead (just like be_locale_roster does)
* dropped default language as member from RosterData, it is no part of the
default locale
* fleshed out implementation of TimeUnitFormat and DurationFormat, both
of which can now be given a BLocale in order to set the strings being used
during formatting


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


# 58fa4d57 05-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* The locale roster keeps its own Language instead of using the locale one, so that changing the locale doesn't reset the
language.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37918 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


# 5c3a3034 04-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Move the locale-related stuff away from BCountry to BLocale.
* Remove the be_locale global object and go through the be_locale_roster instead
* Rework the storage of data for the be_locale_roster, since BLocale already holds a BCountry and a BLanguage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37907 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


# 52cdfde04b346aa33eaebd4063321b80683973aa 25-Nov-2012 Oliver Tappe <zooey@hirschkaefer.de>

Fix relying on order of static object destruction in Locale Kit.

* use only a single static object (MutableLocaleRoster) instead of
two, which avoids any problems if the order of static object
destruction would destroy RosterData before MutableLocaleRoster
* rename BPrivate::RosterData to BPrivate::LocaleRosterData and move
it into a header and implementation file of its own
This should hopefully fix problems encountered with a clang-compiled
Locale Kit.


# 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


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

Fix #8452 (app's crashing for non-existent system catalog)

* make the system catalog a BCatalog instead of a BCatalogAddOn*,
such that using a non-existing system catalog won't crash but
simply return the untranslated string instead
* rename MutableLocaleRoster::GetSystemCatalog() to LoadSystemCatalog()
and adjust it to use BCatalog::SetTo() in order to replace the
data used by the given catalog
* adjust all users of gSystemCatalog accordingly


# 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


# ed7ee7a43256baac60e2345f42fc28897cf5585e 11-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Localization support for filesystem entries in Tracker and Deskbar (leaf menu). (It appears to work, but is likely incomplete and quite possibly incorrect.) Fix issue with RosterData::Refresh() resulting in a B_LOCALE_CHANGED broadcast, and Deskbar looping. Add a global boolean gLocalizedNamePreferred to avoid calling BLocaleRoster::Default()->IsFilesystemTranslationPreferred() too often from Model instances. Following Tracker code style in libtracker, so as to not mix in too much clean-up.

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


# 07cffb4786d1ad91631b60045e9f85c611380d27 11-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Introducing a Locale option to display localized filesystem entries (primarily apps and folders) in Deskbar, Tracker, etc. Making use of this in Deskbar's list of apps. The option currently defaults to off, to avoid exposing everyone to unfinished work.

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


# 1d8dff01970e56c3cbd7f8c46e369e3d42dee18a 16-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* improve locale roster to no longer rely on static object
initialization order
This was meant to fix #7227, but just seems to have bypassed it - the crash is now somewhere else ... needs more investigation

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40529 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


# 6fd2f4a0d14b45a316defe994e9790de062ff3ff 23-Oct-2010 Oliver Tappe <zooey@hirschkaefer.de>

One more monster commit (sorry ...) concerning the Locale Kit:
* extracted new class BFormattingConventions from BCountry, which
manages the formatting conventions from a given locale and
allows to get/set the four different date/time formats supported
by ICU-locales as well as number and monetary formats
* overhauled the Locale preflet:
+ drop editing features for all formats, since I don't think
they do not make much sense to have in a prefs GUI - being
able to select from the existing locales should be good
enough. Please note that you can still change the formats
programmatically in an application.
+ renamed the 'Countries' tab to 'Formatting'
+ the locale formatting conventions list in the 'Formatting'
tab is now hierarchical for easier access (less scrolling)
+ fixed functionality of 'Revert' and 'Defaults' buttons
+ added support for using the month/day-names of your preferred
language during date formatting
* adjusted BLocale to ask BFormattingConventions for the current
formats when formatting dates and times and to offer 4
different format styles (full, long, medium and short).
* adjust all classes formatting dates/times to pick the
appropriate format style
* BLocaleRoster no longer directly archives/unarchives the
individual formatting conventions but delegates that to
BFormattingConventions


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


# d1d8fda63745350804d76b4ed160732086fa9655 19-Oct-2010 Oliver Tappe <zooey@hirschkaefer.de>

Next step of Locale Kit refactoring:
* BLocale now keeps language and country completely separate and
mixes the formatting conventions into the current language's locale
when formatting dates and times (needs to be done for number- and
currency-formatting, too, since the digits may not be in the
preferred language)
* optimized fetching of the flag icons such that they are all loaded
in one go (by the locale roster) - this alone speeds up the Locale
preflet considerably
* worked on fixing the language confusion in the Locale preflet
* fixed a couple of bugs in the Locale preflet that would lead to
illegal characters being displayed in the date-subpart menus


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


# b7f609650b9864f5f93ee235c1a095970f9df525 30-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* removed all BLocale-related getters from BLocaleRoster - they're available
in BLocale (which is accessible via be_locale)
* adjusted all users accordingly


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


# a9faf943925a9041088130c4b9bb247e16d73322 29-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* reintroduced be_locale as global information point for the current locale
values
* added locking to BLocale (needed since the data of the global object may
change any time)
* BLocale no longer passes out pointers to internal objects, it fill objects
passed in by the client instead (just like be_locale_roster does)
* dropped default language as member from RosterData, it is no part of the
default locale
* fleshed out implementation of TimeUnitFormat and DurationFormat, both
of which can now be given a BLocale in order to set the strings being used
during formatting


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


# 58fa4d5717e933428be5e117c2a2f5f71a58ceed 05-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* The locale roster keeps its own Language instead of using the locale one, so that changing the locale doesn't reset the
language.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37918 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


# 5c3a30348613821de032e50f1633e47dc732651f 04-Aug-2010 Adrien Destugues <pulkomandy@pulkomandy.ath.cx>

* Move the locale-related stuff away from BCountry to BLocale.
* Remove the be_locale global object and go through the be_locale_roster instead
* Rework the storage of data for the be_locale_roster, since BLocale already holds a BCountry and a BLanguage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37907 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