0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 13:43:04 -05:00

Merge branch 'experimental_locales' into 'main'

Branding with Localization

Closes #27

See merge request librewolf-community/browser/source!26
This commit is contained in:
stanzabird 2022-05-03 20:53:46 +00:00
commit cf0a022db9
4 changed files with 55 additions and 0 deletions

View file

@ -116,6 +116,7 @@ build : $(lw_source_dir)
package : package :
(cd $(lw_source_dir) && ./mach package) (cd $(lw_source_dir) && ./mach package)
(cd $(lw_source_dir) && cat browser/locales/shipped-locales | xargs ./mach package-multi-locale --locales)
cp -v $(lw_source_dir)/obj-*/dist/librewolf-$(version)-$(release).en-US.*.tar.bz2 . cp -v $(lw_source_dir)/obj-*/dist/librewolf-$(version)-$(release).en-US.*.tar.bz2 .
run : run :

View file

@ -16,6 +16,8 @@ ac_add_options --with-branding=browser/branding/librewolf
ac_add_options --with-unsigned-addon-scopes=app,system ac_add_options --with-unsigned-addon-scopes=app,system
ac_add_options --with-l10n-base=$PWD/browser/locales/l10n
export MOZ_REQUIRE_SIGNING= export MOZ_REQUIRE_SIGNING=
mk_add_options MOZ_CRASHREPORTER=0 mk_add_options MOZ_CRASHREPORTER=0

49
scripts/generate-locales.sh Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/bash
if [ ! -f browser/locales/shipped-locales ]; then
echo "ERROR: Run this script from the root of the LibreWolf source code"
exit 1
fi
rm -rf browser/locales/l10n
mkdir browser/locales/l10n
N=8
for i in $(seq $N); do echo; done
total=$(wc -l < browser/locales/shipped-locales)
echo_status() {
printf "\033[$((($N - $n) + 1))A$@ %40s\r\033[$((($N - $n) + 1))B"
}
generate_locale() {
if echo " en-US ca ja " | grep -q " $1 "; then
echo_status "Skipping locale \"$1\""
sleep 1
echo_status
return
fi
echo_status "Downloading locale \"$1\""
wget -q -O browser/locales/l10n/$1.zip https://hg.mozilla.org/l10n-central/$1/archive/tip.zip
echo_status "Extracting locale \"$1\""
unzip -qo browser/locales/l10n/$1.zip -d browser/locales/l10n/
mv browser/locales/l10n/$1-*/ browser/locales/l10n/$1/
rm -f browser/locales/l10n/$1.zip
echo_status "Generating locale \"$1\""
mv browser/locales/l10n/$1/browser/branding/official browser/locales/l10n/$1/browser/branding/librewolf
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla Firefox/LibreWolf/g' {} \;
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla/LibreWolf/g' {} \;
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Firefox/LibreWolf/g' {} \;
echo_status "Done"
sleep 0.3
echo_status
}
while read in; do
((n=n%N)); ((n++==0)) && wait
generate_locale $in &
done < browser/locales/shipped-locales
wait
printf "\033[$(($N))A\rGenerated $total locales %-40s\n"

View file

@ -126,6 +126,9 @@ def librewolf_patches():
for file in ["browser/config/version.txt", "browser/config/version_display.txt"]: for file in ["browser/config/version.txt", "browser/config/version_display.txt"]:
with open(file, "w") as f: with open(file, "w") as f:
f.write("{}-{}".format(version,release)) f.write("{}-{}".format(version,release))
# generate locales
exec("bash ../scripts/generate-locales.sh")
leave_srcdir() leave_srcdir()