Add version suffix to gettext message catalog files
Change "make install" to install catalog files with version suffix and modify the sources to look for suffixed catalog first, while still falling back to just the base name if the variant with the version is not found, because the message catalogs are copied manually in practice under MSW/macOS systems and so won't have the version suffix there. This allows to make message catalogs installed by different wxWidgets versions to coexist on the same system, see https://groups.google.com/g/wx-users/c/L9gC8UgrO6Y Closes https://github.com/wxWidgets/wxWidgets/pull/2219 Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
This commit is contained in:
parent
62a760c225
commit
ded4da5ce5
@ -14778,14 +14778,14 @@ locale_install:
|
||||
$(INSTALL_DIR) $(DESTDIR)$(datadir)/locale/$$l ; \
|
||||
$(INSTALL_DIR) $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES ; \
|
||||
if test -f $(srcdir)/locale/$$l.mo ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/locale/$$l.mo $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxstd.mo ; \
|
||||
$(INSTALL_DATA) $(srcdir)/locale/$$l.mo $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxstd-$(WX_RELEASE).mo ; \
|
||||
fi ; \
|
||||
done
|
||||
|
||||
locale_uninstall:
|
||||
for l in $(LOCALE_LINGUAS) ; do \
|
||||
if test -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxstd.mo ; then \
|
||||
rm -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxstd.mo ; \
|
||||
if test -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxstd-$(WX_RELEASE).mo ; then \
|
||||
rm -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxstd-$(WX_RELEASE).mo ; \
|
||||
fi ; \
|
||||
done
|
||||
|
||||
|
@ -137,7 +137,7 @@
|
||||
<using module="gettext"/>
|
||||
<gettext-catalogs id="locale">
|
||||
<srcdir>$(SRCDIR)/locale</srcdir>
|
||||
<catalog-name>wxstd</catalog-name>
|
||||
<catalog-name>wxstd-$(WX_RELEASE)</catalog-name>
|
||||
<linguas>
|
||||
ca cs da de el es fi fr hu id it ja nl pl ru sl sv tr uk
|
||||
zh zh_CN zh_TW
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "wx/fontmap.h"
|
||||
#include "wx/scopedptr.h"
|
||||
#include "wx/stdpaths.h"
|
||||
#include "wx/version.h"
|
||||
#include "wx/private/threadinfo.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
@ -1519,10 +1520,17 @@ wxArrayString wxTranslations::GetAvailableTranslations(const wxString& domain) c
|
||||
|
||||
bool wxTranslations::AddStdCatalog()
|
||||
{
|
||||
if ( !AddCatalog(wxS("wxstd")) )
|
||||
return false;
|
||||
// Try loading the message catalog for this version first, but fall back to
|
||||
// the name without the version if it's not found, as message catalogs
|
||||
// typically won't have the version in their names under non-Unix platforms
|
||||
// (i.e. where they're not installed by our own "make install").
|
||||
if ( AddCatalog("wxstd-" wxSTRINGIZE(wxMAJOR_VERSION) "." wxSTRINGIZE(wxMINOR_VERSION)) )
|
||||
return true;
|
||||
|
||||
return true;
|
||||
if ( AddCatalog(wxS("wxstd")) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !wxUSE_UNICODE
|
||||
|
Loading…
Reference in New Issue
Block a user