On Fri, 29 Oct 2021 18:12:13 +0200 Eric Jensen wrote:
EJ> In order to use it they first must know about it. Ulrich's post was
EJ> the first time i ever heard of that class. Although afterwards i
EJ> faintly remembered a discussion about it here from a few months ago.
I think there were several threads about this while I was working on it.
I don't know what would be the way to let people know about new additions
to wx. Most of them are too small to merit a blog post, but some of them
are too large to be explained by just a single line in the change log. How
could we let people know about both kinds of changes? Other projects have
regular "This Week in Whatever" blog posts and while we're not big/active
enough for this, it could be nice to have "This Month in wx" summaries. The
problem is that somebody would have to do it...
I'm glad that someone (else) is at least looking at wxUILocale, although
it would be even better if you (or that other developer) could try to
actually use it.
On Fri, 29 Oct 2021 00:15:01 -0700 (PDT) you wrote:
u> According to the Microsoft document MS-LCID
u> <https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f>
u> numeric LCIDs are deprecated and the string IDs should be preferred. I
u> guess the new class wxUILocale in the upcoming wxWidgets 3.1.6 serves
u> exactly this purpose.
Let's say that it's supposed to provide API that works in this kind of
situations too.
u> However, the code for identifying the default
u> language still uses the numeric IDs.
Is the goal really to identify the default language? Usually you "just"
want things to work correctly, i.e. use the conventions appropriate for the
current locale. And wxUILocale should work correctly even for the locales
not supported by wxWidgets, such as "de-IT".
u> This leads to some questions:
u>
u> 1. Is it planned to adjust this code accordingly?
This depends on what exactly the problem is, i.e. how critical is it, how
difficult fixing it is and how long will the rest of high resolution
bitmaps support take me to finish...
u> 2. Shouldn't the list of languages in wxWidgets
u> (misc/languages/langtabl.txt) be updated? It currently contains 236
u> entries, while appendix A in the MS-LCID document contains over 800 entries.
No, I don't think we want to maintain this table. I mean, I won't stand in
the way of anybody who wants to do it, but I don't think it's a good idea
for us to maintain this list, which will invariably get out of data again
soon anyhow.
u> 3. Wouldn't it be better to generate the list of languages during
u> runtime? At least on Windows it is possible to enumerate all
u> locales/languages.
Yes, getting this information from the system is a more promising
approach, IMO. But, again, this depends on what exactly do we need to do.
AFAIK wxUILocale works for what it currently does and while I'm fully
cognizant of the fact that it could do much more, I'm not sure what exactly
is missing in it from your (or that developer's) point of view?
So could you please explain what is the actual goal here?
--
You received this message because you are subscribed to the Google Groups "wx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-dev/1684164552.20211029215642%40j-dev.de.
wxLocale is not formally deprecated because it still works as well (or as
badly) as always in wxMSW and wxGTK but shouldn't be used in the new code
because it simply can't be made to work in wxOSX. So wxLocale is legacy,
new code should only use wxUILocale.
u> So, how should an application load translation
u> message catalogs in the future?
Using wxTranslations, please see the updated internat sample. Combining
both the locale functions and translations loading in wxLocale looked like
a good idea at the time, but turned out to be too limiting and it seems
cleaner now to have different classes for the different tasks.
u> I have not yet tested wxUILocale, but I have no doubt that it will load the
u> correct settings even for locales not in the language/locale list of
u> wxWidgets.
Yes, this is indeed supposed to work, please let me know if you see any
problems with the internat sample in any of the less usual locales.
u> Quite often it is useful for an I18N application to deduce the language,
u> the country, and sometimes the currency from the default system locale, so
u> that the application can start with default settings that meet the
u> expectations of the user(s).
This should be supported by GetInfo(), I think, but currently we don't
provide as much information as we could.
u> Maintaining the list manually is certainly not an option. However, the
u> process could be automated at least to a certain degree by extracting the
u> data from official data sources like ISO 639, ISO 3166, and the Unicode
u> CLDR project (CLDR = Common Locale Data Repository).
I wasn't ready to do the work necessary for this, but, again, if anybody
else is willing to do it, I certainly wouldn't object.
Please note that
there still will be a problem with the old wx versions: even if we update
the different files in master regularly, programs using old versions of wx
still won't recognize any new languages/locales. And as I regularly see
programs using ~10 year old wx, this is not just a theoretical problem, it
does, and probably will, happen in practice.
So relying on the OS still looks like a better idea.
u> At least for Windows I could provide code to determine the list of locales.
u> The question is where this code should be located - in wxLocale (where the
u> list is currently generated from data in languageinfo.cpp), or in
u> wxUILocale, or elsewhere?
Definitely in wxUILocale.
u> I don't know whether Linux and macOS provide methods to retrieve a list of
u> known locales.
Under Mac there is [NSLocale availableLocaleIdentifiers] which is already
used in src/osx/core/uilocale.mm, so it would be simple to refactor the
code to make its results publicly available.
Under Linux there doesn't seem to be any standard way of getting this
information, but it should be possible as "locale -a" manages to get them
somehow, so looking at its sources (in glibc) should provide the answer.
FWIW under Debian there is /usr/share/i18n/SUPPORTED which contains what we
need, but I don't know how portable is it.
u> I hope my above remarks clarify this a bit.
To be honest, yes and no. I.e. I understand that some pieces of
information are not provided by the current API, but this should be easy to
address (and could be done after 3.2.0 because it wouldn't require breaking
the ABI, so is not the highest priority for me right now). But I'm still
not sure if there is something more fundamentally missing in wxUILocale,
which would need to be fixed before 3.2.0. Please try using wxUILocale and
let us know if we have to change anything.
u> In respect to translations the class wxLocale offers several convenience methods.
u> [...]
u> Developers may feel tempted to continue to use those methods.
The convenience methods are just wrappers for wxTranslations methods, so
it's just as simple -- and more direct -- to use wxTranslations directly.
The automatic loading of wx default catalog is considered by many people to
be a misfeature as it forces you to deal with the locale and translations
at the same time (and hence the need for various hacks such as
wxLOCALE_DONT_LOAD_DEFAULT), so this is something that wxUILocale
intentionally doesn't do.
My rationale for not marking them as deprecated is that wxLocale continues
to work for the programs targeting Windows and Unix/Linux systems only, and
it seems disproportionate to force people who don't even target Mac to
change their programs just because Apple is incapable of writing code for
parsing SVG working in any C locale.
u> 1. In OnInit to detect the system default language
u> (wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT))
This one should be indeed replaced with wxUILocale::GetInfo(wxLOCALE_NAME)
or something like this.
u> 2. In OnTestLocaleAvail to detect the availability of a locale
u> (wxLocale::FindLanguageInfo and wxLocale::IsAvailable)
These methods are much less useful IMO, but we could also refactor them to
move their implementation in wxUILocale, I guess.
u> IMHO it would be useful to be able to detect language, region, and currency
u> of the system default locale. The question is, which class should contain
u> such methods?
wxUILocale, definitely. The fact that wxLocale remains available doesn't
mean that we should continue improving it.
u> However, AFAIK Linux and macOS provide only lists of
u> installed/supported, while Windows can be asked for a more or less complete
u> list (although locales are not standardized as languages (ISO639) or
u> countries (ISO 3166)).
But why would you care about a locale which is not supported by the system
anyhow (in the context of a GUI desktop application, at least)?
u> I will test wxUILocale and will report back, if I find issues.
u> [...] Maybe this should simply be put into a footnote,
u> with a note that this approach is not recommended for new applications.
I did add a note about wxUILocale to the beginning of wxLocale
documentation, do you think it's insufficient or if, perhaps, this should
be mentioned somewhere else?
u> Adding some items to the wxLocaleInfo enumeration to retrieve additional
u> useful information should be easy enough and wouldn't affect the ABI - as
u> you already stated.
u>
u> I will start to modify the implementation and will then make a PR. You can
u> then decide how to proceed.
Thanks! FWIW we can still add new functions (and, in fact, wxUILocale was
written in an ABI-compatibility-friendly way, i.e. new functions can be
added to it without breaking the ABI compatibility) if you think it would
be more natural. I suspect it might because the name of the locale/language
is special as it can be available either in the language itself or in
English and so perhaps we should have a separate function or a pair of
functions for retrieving it, as GetInfo() doesn't have such "axis" (we
could overload the category parameter for this, but it probably would be a
bad idea).
u> In Windows a user has sometimes to take action to make certain locales
u> available by installing language/locale support.
Is this still the case with Windows 10 and more recent versions? I thought
all locales were always available now, making worrying about this
unnecessary.
u> Having access to a more or less complete list of languages and countries
u> can be useful to present a list of available translations, even if the
u> corrresponding locale is not supported on the system. From the message
u> catalogs you can usually deduce only the abbreviation (like "en_US",
u> "de_DE" etc), but displaying "English (USA)", "German (Germany)" etc would
u> be preferrable.
This information is returned by Win32 API and maybe nl_langinfo(), but I'm
not sure about Mac.
u> - wxLOCALE_ENGLISHLANGUAGENAME - Name of the language in English
u> - wxLOCALE_NATIVELANGUAGENAME - Name of the language in the native
u> locale language
u> - [...]
We don't _need_ them, but IMO having both ENGLISH and NATIVE constants is
not very nice.
I think either of the alternatives I mentioned would be
better:
1. Use 2 different categories, wxLOCALE_CAT_NATIVE_NAME and
wxLOCALE_CAT_ENGLISH_NAME, for wxLOCALE_{LANGUAGE,COUNTRY,DISPLAY}_NAME
wxLocaleInfo constants with GetInfo(). This is simple, and while it
might be somewhat of a hack, I think it would still be better than
doubling all name constants as Win32 API does.
2. Use a different function taking values of different enum, e.g.
wxString GetName(wxLocaleName what, wxLocaleForm how) const;
with
enum wxLocaleName { wxLOCALE_NAME_LANGUAGE, wxLOCALE_NAME_COUNTRY, ... };
enum wxLocaleForm { wxLOCALE_FORM_NATIVE, wxLOCALE_FORM_ENGLISH };
(this would require renaming/doing something with the existing GetName()
to avoid confusion).
I don't really have time/mental energy to think about this in depth now,
so I don't know what to recommend but, again, either solution seems better
than just copying Win32 API to me.
One thing that we should also keep in mind is that we might (will?) want
to add access to the names of weekday and month names via wxUILocale too
and it could be nice to have an API that could be generalized to do it. Or
maybe not, because it probably isn't very useful to return the English
names of those, as they could be just hardcoded.
u> I have no idea how to do it in macOS. Maybe nl_langinfo can be used there,
[...]
u> Or there are system functions available that can be used for this
u> purpose.
The docs at https://developer.apple.com/documentation/foundation/nslocale?language=objc
list countryCode and languageCode and then localizedStringForCountryCode:
and localizedStringForLanguageCode:
u> For wxUILocale testing the internat sample in its current form is not so
u> well suited, because the UI locale can't be chosen freely on starting the
u> sample - only English or the default user locale is used. I intend to
u> adjust the sample code a bit.
No, sorry, you can't do this -- this is just not something that can be
done under macOS and so it's intentionally not supported by wxUILocale.
I.e. the UI locale is really fixed there and can't be changed on program
startup, which is why your only choice is to use this locale in your
program or not do it.
In principle, you can still propose using some other language for the
translations, but I don't know how much sense does it make to use German
labels in English locale or vice versa.
u> 1. The header file language.h defines the enumeration wxLanguage, which
u> is generated from the file misc/languages/langtabl.txt. Since this
u> enumeration needs to be available at compile time, generating the list of
u> known languages/locales at runtime is basically not feasible. Since the
u> wxLanguage type is used in wxLocale, wxUILocale, and wxTranslations and
u> most likely in many user applications, it will be necessary to support the
u> wxLanguage enumeration.
Note that the new code is supposed to use wxLocaleIdent rather than
wxLanguage enum.
u> Nevertheless, IMHO langtabl.txt should be updated from time to time.
I don't have any objections to doing it, of course.
Note that msgIdLanguage is the language of the IDs, i.e. keys, not
translations
and in 99% of the cases it will be English.
IOW this doesn't prevent you from having translations to a language unknown to wx (I think;
I have to admit I didn't test this).
u> However, under Windows and Linux changing the locale is possible. So, why
u> not allowing it on those platforms in the internat sample?
My rationale is that we want to explain to people who want to implement
choosing the application language that they need to relaunch their program
after changing the language for this to work under macOS.
So, if anything, it would be nice to show how to do this in the internat sample -- this
would be much more useful than showing how to do something which doesn't
work on one of the Tier-1 platforms.
Also notice that even though we can change the locale in wxMSW and wxGTK,
I'm not sure how well does it work in the latter, it's not impossible that
there could be some problems there too.
And we don't support re-translating the UI on the fly in wx API in any case.
So re-executing the application to switch to a different language could be a good idea
even if you don't care about macOS.
u> Hm, for example in src/common/appcmn.cpp the layout direction is determined
u> implicitly via wxLanguage.
Yes, this is bad, we should provide a way to get this information from
wxUILocale directly, thanks for noticing this. It's probably worth opening
a ticket to remind us to do it -- unless you could just do it as part of
your changes, if it's not too difficult.
u> Since wxTranslations::LoadCatalog uses
u> string ids anyway, a method AddCatalog which allows to use a string based
u> language identifier would be easy to implement.
Again, I definitely don't mind doing it, but IMO it's just not a problem
in practice:
even though there are some people who use other languages (to
be fair, I've seen all of German, French and Italian myself), they're still
all relatively common languages covered by wxLanguage constants and the
chances of someone using some unsupported language for the message IDs
seems very, very low.
u> [...] change the UI locale of macOS itself [...]
Sorry for being imprecise. You can actually specify the locale of the
program under Mac by using special (i.e. handled by the system itself)
command-line options. But you can't change the locale of the process once
it's running.
u> There is no direct support in wxWidgets for re-translating the UI on the
u> fly, but it is doable (and it's a nice feature from the user's perspective.
Everything is doable, of course, but I don't think it is that simple.
u> So, here is a summary, what I intend to do/implement (the order of the
u> below list does not imply priorities):
u> [...]
u> If I missed any important item, just let me know.
No, this looks very complete to me, thanks in advance!
u> [...] Under macOS
u> I used also the command "locale -a" resulting in a list with 203 entries -
The list returned by [NSLocale availableLocaleIdentifiers] is much larger,
because POSIX APIs are just a redheaded stepchild under macOS.
u> 1. The identifiers wxLANGUAGE_* [...]
I'm afraid we'd have to remain compatible with the existing constants,
just because I'm not sure it's safe to change their meaning and there
doesn't seem to be any good reason to take the risk of doing it if it can
be avoided (and I hope it can, if only by maintaining a small list of
exceptions).
We'd definitely like to avoid breaking the existing programs expecting
Afrikaans translations to be found under "af_ZA".
u> This would require to extend wxLanguageInfo, so that for example the
u> canonical name "af" could be associated with "af_ZA". Opinions?
I don't really see much value in separating the default region like this,
but we could do this.
u> BTW, I have the impression that the algorithm for locating the translation
u> subdirectories fails when the canonical name contains a script name.
u> wxUILocale returns a canonical name which uses the minus sign as a
u> separator. The separator is replaced by an underscore, but the current
u> logic for the subdirectory names uses the at sign (@) to append the script
u> name.
I may have broken this with my recent changes then...
Ideally I think we
should look under the directory with the script name (separated by "@") and
then under the directory without script name at all.
If you can fix this as part of your changes, it would be great, otherwise
could you please open a bug about it so that I don't forget to do it later?
I'm afraid we'd have to remain compatible with the existing constants,
just because I'm not sure it's safe to change their meaning and there
doesn't seem to be any good reason to take the risk of doing it if it can
be avoided (and I hope it can, if only by maintaining a small list of
exceptions).
[...] I'm still
not sure if there is something more fundamentally missing in wxUILocale,
which would need to be fixed before 3.2.0. Please try using wxUILocale and
let us know if we have to change anything.
u> While working on updating the language database I came across one issue
u> that I think should be addressed before 3.2.0.
u>
u> The language database as well as the class wxLocale use canonical locale
u> names in the form "<language>_<country>@modifier". wxUILocaleImpl provides
u> a method CreateForLanguage (used by method UseLanguage), which interprets
u> this form of canonical locale names. However, there is no way back. That
u> is, wxUILocale has just a platform-dependent internal name. This makes it
u> really difficult to use the language database as a fallback.
Do you mean inside wxUILocale code or in the application?
u> IMHO wxUILocale should provide a platform independent form to identify
u> the locale, for example by constructing a wxLocaleIdent that can be
u> queried.
I have no objections to doing it, I only didn't do this myself because I
try to not add things to the API prematurely, i.e. before I have a use case
for them, and I didn't have one in my own program.
u> As an alternative a tag using the subset of BCP 47 as understood by
u> wxLocaleIdent could be added to each language entry in the language
u> database.
I'm not sure if we can retrieve the _same_ wxLocaleIdent for the same
locale under all platforms using the native API. I hope that this is the
case, but if not, then we would perhaps need to do the above for
portability.
u> However, I have a question about where to place the code. Up to now the
u> implementation is located in source file *intl.cpp*. Should the new
u> implementation be moved to *uilocale.cpp*?
I don't think it matters that much, but, in principle, wxUILocale methods
should be in uilocale.cpp. But if they contain mostly the same code that
was in wxLocale methods before, it might be better to leave them in
intl.cpp to be able to use "git blame" etc more efficiently.
u> Regarding macOS I would need a bit of guidance, how to call the relevant
u> system functions, because I don't have a mac system for testing
We have a Mac used for the CI builds which can also be used for other wx
development tasks, please ask Stefan if you'd like to get an account on it.
u> I'm not familiar with the Objective-C syntax.
I'm not going to try to explain it because I'm pretty bad with Objective-C
myself, but it's relatively simple (compared to some other languages, at
least) and personally I often find it helpful to look at the existing code
to find out how to do something.
u> The variant wxLOCALE_FORM_LOCALIZE would allow to retrieve translations
u> for a locale name based on the currently active locale. However, only
u> Windows and macOS support that; Linux/Unix do not support this
u> feature.Therefore it is maybe better to remove this variant and leave it to
u> the application to handle translations.
In principle, it's ok to have this in the API and just return empty string
under Linux for it. OTOH I'm not really sure when is it going to be useful,
so omitting would be fine with me too.
u> 4. Add method to wxUILocale to retrieve the layout direction of a locale
u>
u> *Open. *Windows and macOS support to retrieve this information from the
u> locale; however, Linux/Unix does not. Currently, this information is
u> retrieved from the internal language database*. *Should the locale be
u> used, if possible, with the language database as a fallback? Or should the
u> language database always be used as before?
Are there any languages/locales for which the two approaches yield
different results?
Thanks again for the update but I'd also like to say that you shouldn't
hesitate to create even partial/in-progress PRs with your changes,
especially if you think that the parts that are already done won't change
[much] any more, as it could be simpler to review the changes in parts than
the entire final PR, which risks to be huge, at once at the end.
u> > u> 4. Add method to wxUILocale to retrieve the layout direction of a locale
u> > u>
u> > u> *Open. *Windows and macOS support to retrieve this information from the
u> > u> locale; however, Linux/Unix does not. Currently, this information is
u> > u> retrieved from the internal language database*. *Should the locale be
u> > u> used, if possible, with the language database as a fallback? Or should
u> > u> the language database always be used as before?
u> >
u> > Are there any languages/locales for which the two approaches yield
u> > different results?
u>
u> Hopefully not.
In this case I don't have any real preference, so you should just do
whichever is more convenient/simpler.
u> For Windows the locale can be queried if the Windows version is Windows
u> 7 or higher. That is, for versions below Windos 7 a lookup via the
u> language database would be necessary. AFAICR currently the LCID is used
u> to lookup the entry in the language database (a method that should be
u> avoided in the future).
It's really unfortunate that we still keep support for XP in 3.2 (and more
time passes, less useful it becomes), things will definitely become simpler
once it's released and we drop support for it...
u> For Linux/Unix the language database is used to retrieve the layout
u> direction.
FWIW GTK gets the default text direction from translations, see
gtk_get_locale_direction(). But I don't think this has any advantages
compared to using the language database.
u> The update of the language database could be prepared as a separate PR as
u> the updated version could be used almost without changing any code (except
u> adding methods to access the additional data fields in the language
u> database.
Please make the first PR with the database update, it should hopefully be
merged quickly and then you could make the other PR after rebasing your
branch on the latest master (which will have already integrated the
database-related changes).
u> I meant within wxUILocale. For example,
u> where supported we can retrieve the layout direction of a locale from the
u> OS (Windows, macOS), but for Linux/Unix we need to use the language
u> database. However, to be able to do that, we need to find the matching
u> entry in the language database. Actually, only the canonical name is suited
u> to identify an entry, but calling wxUILocale::GetName doesn't help because
u> it delivers a platform specific name.
Well, by a happy coincidence, under generic Unix system this would be
exactly the canonical name, so GetName() still could be used. But I agree
that it isn't pretty.
u> Additionally, I think we need a way to restore a specific locale. For
u> example, an application may want to save a locale identifier, so that the
u> same locale can be restored in the next session.
I can't really imagine a realistic use case for exactly this situation
("Would you like to sort strings using the rules for the language your
system used the last time you ran this program?" would be an extremely
weird question to ask), but I guess we could want to save the locale being
used in some file, that could later be used on another machine, and in this
case it would indeed be useful to have a way to get a portable locale
identifier.
Would it be simpler to have only a static GetCurrentIdent() function,
which would return wxLocaleIdent corresponding to the current locale,
instead of non-static GetIdent() that would have to work for any locale?
BTW, I don't know if we want Get[Current]Ident() or Get[Current]Tag()
neither, do you?
u> However, under Linux/Unix
u> one can have additional components (charset and modifier). If I'm not
u> mistaken wxLocaleIdent has no method to handle a platform-dependent tag
u> like "en_GB.utf8@euro" which could be the tag returned by GetName.
It does have some support for this, it calls it "the modifier".
u> Under Windows there are also special cases like "hu-HU_technl"(where
u> "_technl" designates a special sort order) or "en-US-x-fabricam"(where
u> "-x-fabricam" designates a user-defined locale).
Such locales can't be represented with wxLocaleIdent currently and so are
impossible to construct with the current API. But we could still return
these strings if we had (only) static GetCurrentTag() function.
u> Nevertheless, I think a wxUILocale instance should be able to always
u> provide at least language, script, and region information (script and
u> region only if appropriate).
So it looks like you'd like to have a (non-static) GetIdent()?
Personally I think having GetCurrentTag() might be the best solution:
- It should be the simplest one to implement (as any other one would
require implementing this anyhow).
- It will allow to construct wxLocaleIdent from the returned string if
necessary, but is capable of representing even the locales not currently
supported by wxLocaleIdent, such as those above.
- It should be sufficient for the scenarios described above, as they only
need the identifier for the current locale, and you should already have
either the tag or the identifier for any locale objects you create (as
otherwise how would you create them).
u> Given a certain wxUILocale instance there is currently no easy way to
u> identify an entry in the language database that corresponds to the
u> wxUILocale instance. IMHO lookup would be easier if tag conversion (tag in
u> language database to/from BCP 47 tag) could be avoided.
If we had GetCurrentTag(), we could use wxLocaleIdent::FromTag() to
construct wxLocaleIdent from it and then use GetLanguage(), GetRegion() and
GetModifier() to construct its canonical name (maybe we should add a new
function for this to include/wx/private/uilocale.h).
u> 4. Add method to wxUILocale to retrieve the layout direction of a locale
[...]
u> IMHO we should query the locale where possible. This is more efficient than
u> looking up the matching entry in the language database
To be honest, I'm not sure if it's really more efficient, but I also don't
think efficiency really matters here.
u> Is it known how many wxWidgets users still run XP and really need the
u> latest wx version?
No, but I feel like we're not going to learn about it any time soon and
people currently using 3.1.x could be surprised to not have support for it
any longer in 3.2.0. Of course, still supporting it in 3.2 made much more
sense when I thought it would be released in 2016 and not 2022, but...
u> ... non-static GetIdent() and/or GetTag() ...
u> static methods GetCurrentIdent() and/or GetCurrentTag() ...
If we have non-static functions, we don't need the static ones. My idea
was to have _only_ the static ones if it could simplify your life. If it
doesn't, please forget about them.
I think that there are functions for obtaining the tag/identifier of the
current locale under all platforms, but I'm not sure about the rest.
u> Ok. I'll prepare a PR with the language database update and some small
u> adjustments of the related code.
u> For macOS GetName() returns an identifier which is almost in the form we
u> need, but it could also be something like "zh-Hant_HK
u> _POSIX@collation=pinyin;currency=CNY".
Out of curiosity, how is it possible for this to happen, i.e. how do you
need to configure the system to get the extra part?
u> And it has to be decided whether the translation loader should look only in
u> the directory with the Unix script code (for example "SR@latin") or also in
u> the directory with the BCP47 script code (for example "SR@Latn").
FWIW on my (Debian) system I have some message catalogs under both
/usr/share/locale/sr@Latn and sr@latin, but the latter contains many more
of them and the former just a few. So I think that we could look in just
the latter directory, as it is clearly much more popular.
Does this help?
VZ schrieb am Samstag, 20. November 2021 um 23:37:56 UTC+1:FWIW on my (Debian) system I have some message catalogs under both
/usr/share/locale/sr@Latn and sr@latin, but the latter contains many more
of them and the former just a few. So I think that we could look in just
the latter directory, as it is clearly much more popular.
Most likely it depends on the application which installs the message catalogs. @latin seems to be the classic Unix way, while @Latn is based on ISO 15924, where "latin" is listed as an alias for "Latn". And since you have both variants on your Debian system, maybe it would be better to look in both directories, thus leaving it to the application developer to decide where to place the message catalogs. I have not yet inspected the translations related code, what effort would be required to achieve that.
u> [...] I get the impression we
u> would be better off, if we use the Unix convention for the updated language
u> database, too.
Just to confirm again: I'd be perfectly fine with this too.
u> [script codes]
If you'd like to do it, you can do it, of course, but I honestly don't
think it's something we really need.
There must be not that many
translations of wx applications into Serbian in the first place, and those
that do exist must be using "@latin" right now, as you say. So the main
(only?) reason to support both "@latin" and "@Latn" I see is the
intellectual satisfaction of having done the most correct thing possible.
Which is a perfectly fine motivation, of course, but, again, not something
that's going to change much in practice.
So please feel free to do whatever you prefer (including nothing)!
u> I made a first PR with the update of the language database.
Thanks again, I've finally had a look at it -- sorry for the delay, but
I'm very busy right now as I have to finish something urgently and so don't
really have any time for anything else. I'll get back to this as soon as I
can, but it might take a few more days until I do...
u> Unfortunately, not all checks go through. Interestingly, some tests fail
u> for macOS builds only. Failure seems to be linked to setting a French
u> locale.
To me it rather looks like they fail to load the message catalog.