Skip to content

Commit

Permalink
Add installer localisation infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
J5lx committed Oct 1, 2023
1 parent 286a8da commit 38fbde6
Show file tree
Hide file tree
Showing 9 changed files with 624 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/actions/create-package/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ create_package_windows() {
env -C ../util/installer qmake CONFIG-=debug_and_release CONFIG+=release
env -C ../util/installer "PATH=${PATH/\/usr\/bin:/}" nmake
env -C Pencil2D find resources/ -type f | harvest_files resources > resources.wxs
for i in ../util/installer/translations/pencil2d_*.wxl.xlf; do
local basename="$(basename -s .wxl.xlf "$i")"
local locale="${basename#*_}"
local culture="${locale/_/-}"
local lcid="$(pwsh -c "(Get-Culture -Name ${culture}).lcid")"
sed "s/Culture=\"en\"/Culture=\"${culture}\"/;s/Language=\"9\"/Language=\"${lcid}\"/" ../util/installer/pencil2d.wxl > "../util/installer/pencil2d_${locale}.wxl"
tikal.bat -m -fc ../util/installer/okf_xml_wxl -ie utf-8 -oe utf-8 -sd ../util/installer -od ../util/installer "${i}"
done
local versiondefines="-d Edition=Nightly -d NightlyBuildNumber=$1 -d NightlyBuildTimestamp=$(date +%F)"
if [ "$IS_RELEASE" = "true" ]; then
versiondefines="-d Edition=Release -d Version=$2"
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/install-dependencies/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ setup_macos() {
}

setup_windows() {
curl -fsSLO https://okapiframework.org/binaries/main/1.45.0/okapi-apps_win32-x86_64_1.45.0.zip
mkdir okapi
"${WINDIR}\\System32\\tar" xfC okapi-apps_win32-x86_64_1.45.0.zip okapi
dotnet tool install -g wix
wix extension add -g WixToolset.Util.wixext WixToolset.Bal.wixext
nuget install -x -OutputDirectory util/installer WixToolset.BalUtil
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/setup-environment/setup-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ setup_windows() {
local platform="${INPUT_ARCH%%_*}"
local vcvars="C:\\Program^ Files^ ^(x86^)\\Microsoft^ Visual^ Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars${platform#win}.bat"
($(which cmd) //c set; $(which cmd) //c "${vcvars} 2>&1>nul && set") | sort -st= -k1,1 | uniq -u >> "${GITHUB_ENV}"
echo "${JAVA_HOME_17_X64}\\bin" >> "${GITHUB_PATH}"
realpath okapi/ >> "${GITHUB_PATH}"
}

"setup_$(echo "${RUNNER_OS}" | tr '[A-Z]' '[a-z]')"
23 changes: 23 additions & 0 deletions util/installer/cog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions util/installer/okf_xml_wxl.fprm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
xmlns:okp="okapi-framework:xmlfilter-options"
xmlns:wxl="http://wixtoolset.org/schemas/v4/wxl"
version="2.0">
<its:translateRule selector="/wxl:WixLocalization" translate="no"/>
<its:translateRule selector="//wxl:String[not(@Overridable) or @Overridable='yes']/@Value" translate="yes"/>
<its:idValueRule selector="//wxl:String[not(@Overridable) or @Overridable='yes']/@Value" idValue="../@Id"/>
<its:preserveSpaceRule selector="//wxl:String[not(@Overridable) or @Overridable='yes']/@Value" space="preserve"/>
<okp:options lineBreakAsCode="yes"/>
<!-- Transifex doesn't seem to support placeholders, so disable them for now -->
<okp:codeFinder useCodeFinder="no">#v1
count.i=1
rule0=\[[A-Z]\w*\]
</okp:codeFinder>
</its:rules>
3 changes: 3 additions & 0 deletions util/installer/pencil2d.bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
ThemeFile="pencil2d.thm"
LocalizationFile="pencil2d.wxl" />
<Payload SourceFile="pencil2d.dll" bal:BAFunctions="yes" />
<!-- Translations -->
<Payload SourceFile="pencil2d_de.wxl" Name="7/thm.wxl" />
<!-- Assets -->
<Payload SourceFile="pencil2d.png" />
<Payload SourceFile="[email protected]" />
<Payload SourceFile="cog.png" />
Expand Down
4 changes: 2 additions & 2 deletions util/installer/pencil2d.wxl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" Language="1033" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<WixLocalization Culture="en" Language="9" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<!-- Standard BA -->
<String Id="ConfirmCancelMessage" Value="Are you sure you want to cancel?" />
<String Id="FilesInUseTitle" Value="Files In Use" />
Expand All @@ -23,7 +23,7 @@
<String Id="Caption" Value="[WixBundleName] Setup" />
<String Id="CheckingForUpdatesLabel" Value="Checking for updates" />
<String Id="UpdateButton" Value="&amp;Update to version [WixStdBAUpdateAvailable]" />
<String Id="HelpText" Value="/install | /repair | /uninstall | /layout [directory] &#x2013; install, repair, uninstall or create a complete local copy of the bundle in directory. &#xA;&#xA;/passive | /quiet &#x2013; suppress interactive prompts or both UI and prompts.&#xA;/norestart &#x2013; suppress any attempts to restart. By default UI will prompt before restart.&#xA;/log [logfile] &#x2013; log to a custom file. By default a log file is created in %TEMP%.&#xA;&#xA;InstallFolder=[directory] | DesktopShortcut=[0|1] &#x2013; Overwrite installation options." />
<String Id="HelpText" Value="/install | /repair | /uninstall | /layout [directory] &#x2013; install, repair, uninstall or create a complete local copy of the bundle in directory.&#xA;&#xA;/passive | /quiet &#x2013; suppress interactive prompts or both UI and prompts.&#xA;/norestart &#x2013; suppress any attempts to restart. By default UI will prompt before restart.&#xA;/log [logfile] &#x2013; log to a custom file. By default a log file is created in %TEMP%.&#xA;&#xA;InstallFolder=[directory] | DesktopShortcut=[0|1] &#x2013; Overwrite installation options." />
<String Id="InstallVersion" Value="Version [WixBundleVersion]" />
<String Id="InstallVersionNightly" Value="Build [NightlyBuildNumber] ([NightlyBuildTimestamp])" />
<String Id="InstallAcceptCheckbox" Value="I &amp;accept the terms and conditions of the GNU General Public License, version 2" />
Expand Down
Loading

0 comments on commit 38fbde6

Please sign in to comment.