Visual Studio builds: Add optional rules to generate translations
Add a target in the install-msvc.mak file that enables one to generate the translations (.mo) files using msgfmt from the .po catalog files. Add an entry in config-msvc.mak[.in] so that one can use it to configure a custom location for the msgfmt.exe program, since it is harder to install with Visual Studio, so that one can use a prebuilt copy from Cygwin or MSYS2, for instance.
This commit is contained in:
parent
52d01d63db
commit
4af19d4350
@ -71,3 +71,14 @@ NMake command line. The gtk3-demo project files will also be updated with the
|
|||||||
appropriate dependent libraries linked in-please check that the project settings
|
appropriate dependent libraries linked in-please check that the project settings
|
||||||
contain the correct .lib file names for your system, as they assume the most
|
contain the correct .lib file names for your system, as they assume the most
|
||||||
common names are used there.
|
common names are used there.
|
||||||
|
|
||||||
|
=========================
|
||||||
|
Building the translations
|
||||||
|
=========================
|
||||||
|
Building translations is supported via Meson builds or via the Visual Studio projects,
|
||||||
|
both of which require a working msgfmt.exe (from gettext-tools, a part of gettext) in the
|
||||||
|
PATH, or for the Visual Studio projects, passed into the arguments in "InstallBuildsBase"
|
||||||
|
in gtk3-build-defines.[props|vsprops] with MSGFMT=xxx. For the Visual Studio projects, for
|
||||||
|
this to work one needs to also supply a "INSTALL_TRANSLATIONS=1" (without the quotes)
|
||||||
|
argument to the same "InstallBuildsBase" in the afore-mentioned property sheet. Using
|
||||||
|
msgfmt.exe from Cygwin or MSYS2 is supported as well.
|
||||||
|
@ -42,6 +42,10 @@ GDBUS_CODEGEN = $(PREFIX)\bin\gdbus-codegen
|
|||||||
GLIB_COMPILE_SCHEMAS = $(PREFIX)\bin\glib-compile-schemas.exe
|
GLIB_COMPILE_SCHEMAS = $(PREFIX)\bin\glib-compile-schemas.exe
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!ifndef MSGFMT
|
||||||
|
MSGFMT = msgfmt
|
||||||
|
!endif
|
||||||
|
|
||||||
!if "$(PLAT)" == "x64"
|
!if "$(PLAT)" == "x64"
|
||||||
AT_PLAT=x86_64
|
AT_PLAT=x86_64
|
||||||
!elseif "$(PLAT)" == "arm64"
|
!elseif "$(PLAT)" == "arm64"
|
||||||
|
@ -51,7 +51,13 @@ GTK_TYPE_BULITINS_H = .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-$(GTK_API_VERSION)\gtk
|
|||||||
GTK_VERSION_H = .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-$(GTK_API_VERSION)\gtk\gtkversion.h
|
GTK_VERSION_H = .\vs$(VSVER)\$(CFG)\$(PLAT)\obj\gtk-$(GTK_API_VERSION)\gtk\gtkversion.h
|
||||||
GTK_GENERATED_PUBLIC_H = $(GTK_TYPE_BULITINS_H) $(GTK_VERSION_H)
|
GTK_GENERATED_PUBLIC_H = $(GTK_TYPE_BULITINS_H) $(GTK_VERSION_H)
|
||||||
|
|
||||||
all: install-bin install-headers install-data
|
!ifdef INSTALL_TRANSLATIONS
|
||||||
|
DATA_TARGETS = install-data install-translations
|
||||||
|
!else
|
||||||
|
DATA_TARGETS = install-data
|
||||||
|
!endif
|
||||||
|
|
||||||
|
all: install-bin install-headers $(DATA_TARGETS)
|
||||||
|
|
||||||
# Copy the built files
|
# Copy the built files
|
||||||
install-bin:
|
install-bin:
|
||||||
@ -131,3 +137,9 @@ install-data:
|
|||||||
@for %x in (its loc) do @copy ..\gtk\gtkbuilder.%x $(PREFIX)\share\gettext\its
|
@for %x in (its loc) do @copy ..\gtk\gtkbuilder.%x $(PREFIX)\share\gettext\its
|
||||||
@for %x in (rng) do @copy ..\gtk\gtkbuilder.%x $(PREFIX)\share\gtk-3.0
|
@for %x in (rng) do @copy ..\gtk\gtkbuilder.%x $(PREFIX)\share\gtk-3.0
|
||||||
@for %l in (de es fr zh) do @for %f in ($(BASE_BUILT_BIN_DIR)\%l.gresource) do @copy %f $(PREFIX)\share\gtk-3.0\emoji
|
@for %l in (de es fr zh) do @for %f in ($(BASE_BUILT_BIN_DIR)\%l.gresource) do @copy %f $(PREFIX)\share\gtk-3.0\emoji
|
||||||
|
|
||||||
|
# Generate and install the translations
|
||||||
|
install-translations:
|
||||||
|
@for %d in (po po-properties) do @for %l in (..\%d\*.po) do @if not exist $(PREFIX)\share\locale\%~nl\LC_MESSAGES\ md $(PREFIX)\share\locale\%~nl\LC_MESSAGES
|
||||||
|
@for %l in (..\po\*.po) do @$(MSGFMT) -c -v -o $(PREFIX)\share\locale\%~nl\LC_MESSAGES\gtk30.mo %l
|
||||||
|
@for %l in (..\po-properties\*.po) do @$(MSGFMT) -c -v -o $(PREFIX)\share\locale\%~nl\LC_MESSAGES\gtk30-properties.mo %l
|
||||||
|
Loading…
Reference in New Issue
Block a user