Remove platform-specific translations support

As shown by the fact that no other platform-specific translations were
ever added since the initial version of locale/msw/it.po added way back
in 4d931bcca0 (Translate '&Help' to '&' for italian Windows only,
2005-08-12), this is not especially useful, so just handle this
particular case specially in wxGetStockLabel() and remove support for
platform-specific translations.

This allows to simplify the makefiles and the catalog loading code as
there is no need to deal with the files in subdirectories any more.
This commit is contained in:
Vadim Zeitlin
2021-02-02 17:14:37 +01:00
parent b5282c682f
commit e539cb69bb
9 changed files with 31 additions and 76 deletions

View File

@@ -2155,7 +2155,6 @@ WEBKIT2_EXT_CXXFLAGS = $(WX_CPPFLAGS) -DWXUSINGDLL -DwxUSE_GUI=0 $(PIC_FLAG) \
WEBKIT2_EXT_OBJECTS = \
webkit2_ext_webview_webkit2_extension.o
LOCALE_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
LOCALE_MSW_LINGUAS = it
### Conditionally set variables: ###
@@ -13871,7 +13870,7 @@ COND_wxUSE_REGEX_builtin___LIB_REGEX_p = \
all: $(__wxregex___depname) $(__wxzlib___depname) $(__wxpng___depname) $(__wxjpeg___depname) $(__wxtiff___depname) $(__wxexpat___depname) $(__wxscintilla___depname) $(__monodll___depname) $(__monolib___depname) $(__basedll___depname) $(__baselib___depname) $(__netdll___depname) $(__netlib___depname) $(__coredll___depname) $(__corelib___depname) $(__advdll___depname) $(__advlib___depname) $(__mediadll___depname) $(__medialib___depname) $(__htmldll___depname) $(__htmllib___depname) $(__webviewdll___depname) $(__webviewlib___depname) $(__qadll___depname) $(__qalib___depname) $(__xmldll___depname) $(__xmllib___depname) $(__xrcdll___depname) $(__xrclib___depname) $(__auidll___depname) $(__auilib___depname) $(__ribbondll___depname) $(__ribbonlib___depname) $(__propgriddll___depname) $(__propgridlib___depname) $(__richtextdll___depname) $(__richtextlib___depname) $(__stcdll___depname) $(__stclib___depname) $(__gldll___depname) $(__gllib___depname) $(__sound_sdl___depname) $(__webkit2_ext___depname) $(__wxrc___depname)
install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__install_wxpng___depname) $(__install_wxjpeg___depname) $(__install_wxtiff___depname) $(__install_wxexpat___depname) $(__install_wxscintilla___depname) $(__install_monodll___depname) $(__install_monolib___depname) $(__install_basedll___depname) $(__install_baselib___depname) $(__install_netdll___depname) $(__install_netlib___depname) $(__install_coredll___depname) $(__install_corelib___depname) $(__install_advdll___depname) $(__install_advlib___depname) $(__install_mediadll___depname) $(__install_medialib___depname) $(__install_htmldll___depname) $(__install_htmllib___depname) $(__install_webviewdll___depname) $(__install_webviewlib___depname) $(__install_qadll___depname) $(__install_qalib___depname) $(__install_xmldll___depname) $(__install_xmllib___depname) $(__install_xrcdll___depname) $(__install_xrclib___depname) $(__install_auidll___depname) $(__install_auilib___depname) $(__install_ribbondll___depname) $(__install_ribbonlib___depname) $(__install_propgriddll___depname) $(__install_propgridlib___depname) $(__install_richtextdll___depname) $(__install_richtextlib___depname) $(__install_stcdll___depname) $(__install_stclib___depname) $(__install_gldll___depname) $(__install_gllib___depname) $(__install_sound_sdl___depname) $(__install_webkit2_ext___depname) $(__install_wxrc___depname) install-wxconfig locale_install locale_msw_install
install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__install_wxpng___depname) $(__install_wxjpeg___depname) $(__install_wxtiff___depname) $(__install_wxexpat___depname) $(__install_wxscintilla___depname) $(__install_monodll___depname) $(__install_monolib___depname) $(__install_basedll___depname) $(__install_baselib___depname) $(__install_netdll___depname) $(__install_netlib___depname) $(__install_coredll___depname) $(__install_corelib___depname) $(__install_advdll___depname) $(__install_advlib___depname) $(__install_mediadll___depname) $(__install_medialib___depname) $(__install_htmldll___depname) $(__install_htmllib___depname) $(__install_webviewdll___depname) $(__install_webviewlib___depname) $(__install_qadll___depname) $(__install_qalib___depname) $(__install_xmldll___depname) $(__install_xmllib___depname) $(__install_xrcdll___depname) $(__install_xrclib___depname) $(__install_auidll___depname) $(__install_auilib___depname) $(__install_ribbondll___depname) $(__install_ribbonlib___depname) $(__install_propgriddll___depname) $(__install_propgridlib___depname) $(__install_richtextdll___depname) $(__install_richtextlib___depname) $(__install_stcdll___depname) $(__install_stclib___depname) $(__install_gldll___depname) $(__install_gllib___depname) $(__install_sound_sdl___depname) $(__install_webkit2_ext___depname) $(__install_wxrc___depname) install-wxconfig locale_install
$(INSTALL_DIR) $(DESTDIR)$(datadir)/aclocal
(cd $(srcdir) ; $(INSTALL_DATA) wxwin.m4 $(DESTDIR)$(datadir)/aclocal)
$(INSTALL_DIR) $(DESTDIR)$(datadir)/bakefile/presets
@@ -13907,7 +13906,7 @@ install: $(__install_wxregex___depname) $(__install_wxzlib___depname) $(__instal
@echo " ------------------------------------------------------"
@echo " "
uninstall: $(__uninstall_wxregex___depname) $(__uninstall_wxzlib___depname) $(__uninstall_wxpng___depname) $(__uninstall_wxjpeg___depname) $(__uninstall_wxtiff___depname) $(__uninstall_wxexpat___depname) $(__uninstall_wxscintilla___depname) $(__uninstall_monodll___depname) $(__uninstall_monolib___depname) $(__uninstall_basedll___depname) $(__uninstall_baselib___depname) $(__uninstall_netdll___depname) $(__uninstall_netlib___depname) $(__uninstall_coredll___depname) $(__uninstall_corelib___depname) $(__uninstall_advdll___depname) $(__uninstall_advlib___depname) $(__uninstall_mediadll___depname) $(__uninstall_medialib___depname) $(__uninstall_htmldll___depname) $(__uninstall_htmllib___depname) $(__uninstall_webviewdll___depname) $(__uninstall_webviewlib___depname) $(__uninstall_qadll___depname) $(__uninstall_qalib___depname) $(__uninstall_xmldll___depname) $(__uninstall_xmllib___depname) $(__uninstall_xrcdll___depname) $(__uninstall_xrclib___depname) $(__uninstall_auidll___depname) $(__uninstall_auilib___depname) $(__uninstall_ribbondll___depname) $(__uninstall_ribbonlib___depname) $(__uninstall_propgriddll___depname) $(__uninstall_propgridlib___depname) $(__uninstall_richtextdll___depname) $(__uninstall_richtextlib___depname) $(__uninstall_stcdll___depname) $(__uninstall_stclib___depname) $(__uninstall_gldll___depname) $(__uninstall_gllib___depname) $(__uninstall_sound_sdl___depname) $(__uninstall_webkit2_ext___depname) locale_uninstall locale_msw_uninstall
uninstall: $(__uninstall_wxregex___depname) $(__uninstall_wxzlib___depname) $(__uninstall_wxpng___depname) $(__uninstall_wxjpeg___depname) $(__uninstall_wxtiff___depname) $(__uninstall_wxexpat___depname) $(__uninstall_wxscintilla___depname) $(__uninstall_monodll___depname) $(__uninstall_monolib___depname) $(__uninstall_basedll___depname) $(__uninstall_baselib___depname) $(__uninstall_netdll___depname) $(__uninstall_netlib___depname) $(__uninstall_coredll___depname) $(__uninstall_corelib___depname) $(__uninstall_advdll___depname) $(__uninstall_advlib___depname) $(__uninstall_mediadll___depname) $(__uninstall_medialib___depname) $(__uninstall_htmldll___depname) $(__uninstall_htmllib___depname) $(__uninstall_webviewdll___depname) $(__uninstall_webviewlib___depname) $(__uninstall_qadll___depname) $(__uninstall_qalib___depname) $(__uninstall_xmldll___depname) $(__uninstall_xmllib___depname) $(__uninstall_xrcdll___depname) $(__uninstall_xrclib___depname) $(__uninstall_auidll___depname) $(__uninstall_auilib___depname) $(__uninstall_ribbondll___depname) $(__uninstall_ribbonlib___depname) $(__uninstall_propgriddll___depname) $(__uninstall_propgridlib___depname) $(__uninstall_richtextdll___depname) $(__uninstall_richtextlib___depname) $(__uninstall_stcdll___depname) $(__uninstall_stclib___depname) $(__uninstall_gldll___depname) $(__uninstall_gllib___depname) $(__uninstall_sound_sdl___depname) $(__uninstall_webkit2_ext___depname) locale_uninstall
(cd $(DESTDIR)$(datadir)/aclocal ; rm -f wxwin.m4)
(cd $(DESTDIR)$(datadir)/bakefile/presets ; rm -f wx.bkl wx_unix.bkl wx_win32.bkl wx_xrc.bkl wx_presets.py)
for f in setup.h $(RCDEFS_H); do \
@@ -14790,23 +14789,6 @@ locale_uninstall:
fi ; \
done
locale_msw_install:
$(INSTALL_DIR) $(DESTDIR)$(datadir)/locale
for l in $(LOCALE_MSW_LINGUAS) ; do \
$(INSTALL_DIR) $(DESTDIR)$(datadir)/locale/$$l ; \
$(INSTALL_DIR) $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES ; \
if test -f $(srcdir)/locale/msw/$$l.mo ; then \
$(INSTALL_DATA) $(srcdir)/locale/msw/$$l.mo $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxmsw.mo ; \
fi ; \
done
locale_msw_uninstall:
for l in $(LOCALE_MSW_LINGUAS) ; do \
if test -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxmsw.mo ; then \
rm -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/wxmsw.mo ; \
fi ; \
done
wxregex_regcomp.o: $(srcdir)/src/regex/regcomp.c
$(CCC) -c -o $@ $(WXREGEX_CFLAGS) $(srcdir)/src/regex/regcomp.c

View File

@@ -144,12 +144,6 @@
</linguas>
<install-to>$(LOCALEDIR)</install-to>
</gettext-catalogs>
<gettext-catalogs id="locale_msw">
<srcdir>$(SRCDIR)/locale/msw</srcdir>
<catalog-name>wxmsw</catalog-name>
<linguas>it</linguas>
<install-to>$(LOCALEDIR)</install-to>
</gettext-catalogs>
</if>

View File

@@ -50,18 +50,3 @@ them). Then type `make lang.mo` which will create the binary message catalog.
Under Windows (If you don't have Cygwin or MinGW), you should execute the
commands manually, please have a look at Makefile to see what must be done.
For platform specific translations, .po files such as `locale/msw/it.po` can be
used to provide translations that override the usual ones in `locale/it.po`.
The generated .mo files are then installed under the names such as `wxmsw.mo`
alongside the generic `wxstd.mo`.
A new platform specific translation should be added to a section such as this
in wx.bkl:
<gettext-catalogs id="locale_msw">
<srcdir>$(SRCDIR)/locale/msw</srcdir>
<catalog-name>wxmsw</catalog-name>
<linguas>it</linguas>
<install-to>$(LOCALEDIR)</install-to>
</gettext-catalogs>

View File

@@ -7,8 +7,7 @@
# being called with this dir as the cwd, but if we generate this file
# with configure an explicit path should be specified -- RL.
WX_LINGUAS := $(shell ls *.po */*.po 2> /dev/null | sed 's/wxstd.pot//g' | sed 's/.po//g')
WX_LINGUAS_UPDATE := $(shell ls *.po 2> /dev/null | sed 's/wxstd.pot//g' | sed 's/.po//g')
WX_LINGUAS := $(shell ls *.po 2> /dev/null | sed 's/wxstd.pot//g' | sed 's/.po//g')
# the programs we use (TODO: use configure to detect them)
MSGFMT=msgfmt --verbose
@@ -24,8 +23,7 @@ XGETTEXT_ARGS=-C -k_ -kwxPLURAL:1,2 -kwxGETTEXT_IN_CONTEXT:1c,2 -kwxGETTEXT_IN_C
$(MSGFMT) -c -o $@ $<
# a PO file must be updated from wxstd.pot to include new translations
# (but not manually maintained platform-specific files like msw/it.po)
$(foreach lang,$(WX_LINGUAS_UPDATE),$(lang).po): wxstd.pot
$(foreach lang,$(WX_LINGUAS),$(lang).po): wxstd.pot
%.po:
if [ -f $@ ]; then $(MSGMERGE) $@ wxstd.pot > $@.new && mv $@.new $@; else cp wxstd.pot $@; fi
@@ -35,7 +33,7 @@ wxstd.pot:
(find ../include -name "*.h"; find ../src -name "*.cpp"; find ../src -name "*.mm") | LC_COLLATE=C sort | $(XARGS) $(XGETTEXT) $(XGETTEXT_ARGS) -o wxstd.pot
allpo: force-update
@-for t in $(WX_LINGUAS_UPDATE); do $(MAKE) $$t.po; done
@-for t in $(WX_LINGUAS); do $(MAKE) $$t.po; done
allmo:
@for t in $(WX_LINGUAS); do $(MAKE) $$t.mo; done

View File

@@ -440,6 +440,11 @@ msgstr "&Altezza:"
msgid "&Help"
msgstr "&Aiuto"
# The help menu is called just '?' on Italian versions of Windows
msgctxt "standard Windows menu"
msgid "&Help"
msgstr "&?"
#: ../include/wx/richmsgdlg.h:30
msgid "&Hide details"
msgstr "&Nascondi dettagli"

View File

@@ -1,18 +0,0 @@
# wxMSW specific overrides for it.po
#
msgid ""
msgstr ""
"Project-Id-Version: wxWidgets 3.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-10-29 14:59+0100\n"
"PO-Revision-Date: 2005-08-12 14:23:42+0100\n"
"Last-Translator: Mike Wetherell <mike.wetherell@ntlworld.com>\n"
"Language-Team: wxWidgets translators <wx-translators@googlegroups.com>\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
# The help menu is called just '?' on Italian versions of Windows
msgid "&Help"
msgstr "&?"

View File

@@ -32,6 +32,7 @@
#include "wx/file.h"
#include "wx/log.h"
#include "wx/cmdline.h"
#include "wx/platinfo.h"
#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
@@ -298,10 +299,8 @@ MyFrame::MyFrame(wxLocale& locale)
file_menu->Append(INTERNAT_TEST, _("&Test locale availability...\tCtrl-T"));
file_menu->AppendSeparator();
// since wxID_ABOUT and wxID_EXIT are stock IDs they will automatically get
// translated help strings; nice isn't it?
file_menu->Append(wxID_ABOUT, _("&About"));
file_menu->AppendSeparator();
// since wxID_EXIT is a stock ID it will automatically get a translated help
// string; nice isn't it?
file_menu->Append(wxID_EXIT, _("E&xit"));
wxMenu *test_menu = new wxMenu;
@@ -327,11 +326,20 @@ MyFrame::MyFrame(wxLocale& locale)
macro_menu->Append(INTERNAT_MACRO_8, wxGETTEXT_IN_CONTEXT_PLURAL("context_2", "sing", "plur", 1));
macro_menu->Append(INTERNAT_MACRO_9, wxGETTEXT_IN_CONTEXT_PLURAL("context_2", "sing", "plur", 2));
wxMenu *help_menu = new wxMenu;
help_menu->Append(wxID_ABOUT, _("&About"));
wxMenuBar *menu_bar = new wxMenuBar;
// Using stock label here means that it will be automatically translated.
menu_bar->Append(file_menu, wxGetStockLabel(wxID_FILE));
menu_bar->Append(test_menu, _("&Test"));
menu_bar->Append(macro_menu, _("&Macro"));
// We could have used wxGetStockLabel(wxID_HELP) here too, but show the
// special case of "Help" menu: it has a special, Windows-specific
// translation for some languages. Note that normally we would actually use
// it only under MSW, we're doing it here unconditionally just for
// demonstration purposes.
menu_bar->Append(help_menu, wxGETTEXT_IN_CONTEXT("standard Windows menu", "&Help"));
SetMenuBar(menu_bar);
// this demonstrates RTL support in wxStatusBar:

View File

@@ -120,6 +120,15 @@ wxString wxGetStockLabel(wxWindowID id, long flags)
// for it because it is already bound to Esc implicitly)
if ( id == wxID_CANCEL )
flags &= ~wxSTOCK_WITH_MNEMONIC;
// Another one: "Help" in the context of a menu label has a different
// translation for some languages (Italian), so try this first.
if ( id == wxID_HELP && (flags & wxSTOCK_WITH_MNEMONIC) )
{
stockLabel = wxGETTEXT_IN_CONTEXT("standard Windows menu", "&Help");
if ( !stockLabel.empty() )
return stockLabel;
}
#endif // __WXMSW__

View File

@@ -1522,14 +1522,6 @@ bool wxTranslations::AddStdCatalog()
if ( !AddCatalog(wxS("wxstd")) )
return false;
// there may be a catalog with toolkit specific overrides, it is not
// an error if this does not exist
wxString port(wxPlatformInfo::Get().GetPortIdName());
if ( !port.empty() )
{
AddCatalog(port.BeforeFirst(wxS('/')).MakeLower());
}
return true;
}