Bring languages into the tree (#1625)
* translations: bring languages into tree * Update translation phrases changed since 2021 * Update packaging script to include all translations * Update languages.cfg * Add Latin American Spanish translations This is a copy of spanish for now. * Ignore "en" when looking for translation folders English is the default and doesn't use a subfolder. * Only add each translation folder once Korean "ko" is in there twice. * Compare language coverage to english All phrases are compared to the english baseline files and any differences are reported. The differences are pushed to a Github Project as well for an easier overview. Thank you to @nosoop for sharing the Python SMC parser! * Add link to README --------- Co-authored-by: Peace-Maker <[email protected]>
This commit is contained in:
co-authored by
Peace-Maker
parent
d8fd60b562
commit
48150e0c7a
@@ -1,5 +1,6 @@
|
||||
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
|
||||
import os
|
||||
import re
|
||||
|
||||
builder.SetBuildFolder('package')
|
||||
|
||||
@@ -126,3 +127,17 @@ helpers.CopyFiles('plugins/basevotes', 'addons/sourcemod/scripting/basevotes')
|
||||
helpers.CopyFiles('plugins/basebans', 'addons/sourcemod/scripting/basebans')
|
||||
helpers.CopyFiles('plugins/funcommands', 'addons/sourcemod/scripting/funcommands')
|
||||
helpers.CopyFiles('plugins/playercommands', 'addons/sourcemod/scripting/playercommands')
|
||||
|
||||
with open(os.path.join(builder.sourcePath, 'configs/languages.cfg'), 'r') as f:
|
||||
language_re = re.compile(r'^\s*"([^"]+)"\s+"[^"]+"')
|
||||
added_languages = set(["en"])
|
||||
for line in f.read().splitlines():
|
||||
match = language_re.match(line)
|
||||
if match:
|
||||
lang_code = match.group(1)
|
||||
if lang_code in added_languages:
|
||||
continue
|
||||
output_path = os.path.join('addons/sourcemod/translations', lang_code)
|
||||
helpers.CreateFolders([output_path])
|
||||
helpers.CopyFiles(os.path.join('translations', lang_code), output_path)
|
||||
added_languages.add(lang_code)
|
||||
|
||||
@@ -36,27 +36,6 @@ require 'helpers.pm';
|
||||
#Switch to the output folder.
|
||||
chdir(Build::PathFormat('../../../OUTPUT/package'));
|
||||
|
||||
print "Downloading languages.cfg...\n";
|
||||
# Don't check certificate. It will fail on the slaves and we're resolving to internal addressing anyway
|
||||
system('wget --no-check-certificate -q -O addons/sourcemod/configs/languages.cfg "https://sm.alliedmods.net/translator/index.php?go=translate&op=export_langs"');
|
||||
open(my $fh, '<', 'addons/sourcemod/configs/languages.cfg')
|
||||
or die "Could not open languages.cfg' $!";
|
||||
|
||||
while (my $ln = <$fh>) {
|
||||
if ($ln =~ /"([^"]+)"\s*"[^"]+.*\((\d+)\) /)
|
||||
{
|
||||
my $abbr = $1;
|
||||
my $id = $2;
|
||||
|
||||
print "Downloading language pack $abbr.zip...\n";
|
||||
# Don't check certificate. It will fail on the slaves and we're resolving to internal addressing anyway
|
||||
system("wget --no-check-certificate -q -O $abbr.zip \"https://sm.alliedmods.net/translator/index.php?go=translate&op=export&lang_id=$id\"");
|
||||
system("unzip -qo $abbr.zip -d addons/sourcemod/translations/");
|
||||
unlink("$abbr.zip");
|
||||
}
|
||||
}
|
||||
close($fh);
|
||||
|
||||
unless (-e '../GeoLite2-City_20191217.tar')
|
||||
{
|
||||
print "Downloading GeoLite2-City.mmdb...\n";
|
||||
|
||||
Reference in New Issue
Block a user