Skip to content

Commit 48150e0

Browse files
Bring languages into the tree (alliedmodders#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]>
1 parent d8fd60b commit 48150e0

File tree

696 files changed

+47789
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

696 files changed

+47789
-22
lines changed

.github/workflows/translations.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Update translation project
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- 'translations/**'
8+
jobs:
9+
update_translations:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/setup-python@v4
13+
name: Setup Python 3.10
14+
with:
15+
python-version: 3.10
16+
17+
- name: Install Python dependencies
18+
working-directory: tools/language_check
19+
run: |
20+
python -m pip install --upgrade -r requirements.txt
21+
22+
- name: Generate token
23+
id: generate_token
24+
uses: tibdex/github-app-token@36464acb844fc53b9b8b2401da68844f6b05ebb0
25+
with:
26+
app_id: ${{ secrets.APP_ID }}
27+
private_key: ${{ secrets.APP_PEM }}
28+
29+
- name: Get project data
30+
working-directory: tools/language_check
31+
env:
32+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
33+
ORGANIZATION: alliedmodders
34+
PROJECT_NUMBER: 1
35+
run: |
36+
python ./compare_translation_phrases.py
37+
38+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Development
1616
- [SourcePawn scripting](https://wiki.alliedmods.net/Category:SourceMod_Scripting): SourcePawn examples and introduction to the language
1717
- [SourceMod plugin API](https://sm.alliedmods.net/new-api): Online SourceMod plugin API reference generated from the include files
1818
- [SourceMod extension development](https://wiki.alliedmods.net/Category:SourceMod_Development): C++ examples and introduction to various extension interfaces
19+
- [Translation project](https://github.com/orgs/alliedmodders/projects/1): Help [translate SourceMod](https://wiki.alliedmods.net/Translations_(SourceMod_Scripting)) into your language
1920

2021
Contact
2122
-------

configs/languages.cfg

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
"Languages"
22
{
3-
"en" "English"
3+
"en" "English" // English
4+
"ar" "Arabic" // Arabic
5+
"pt" "Brazilian" // Brazilian Portuguese
6+
"bg" "Bulgarian" // Bulgarian
7+
"cze" "Czech" // Czech
8+
"da" "Danish" // Danish
9+
"nl" "Dutch" // Dutch
10+
"fi" "Finnish" // Finnish
11+
"fr" "French" // French
12+
"de" "German" // German
13+
"el" "Greek" // Greek
14+
"he" "Hebrew" // Hebrew
15+
"hu" "Hungarian" // Hungarian
16+
"it" "Italian" // Italian
17+
"jp" "Japanese" // Japanese
18+
"ko" "KoreanA" // Korean
19+
"ko" "Korean" // Korean
20+
"las" "LatAm" // Latin American Spanish
21+
"lv" "Latvian" // Latvian
22+
"lt" "Lithuanian" // Lithuanian
23+
"no" "Norwegian" // Norwegian
24+
"pl" "Polish" // Polish
25+
"pt_p" "Portuguese" // Portuguese
26+
"ro" "Romanian" // Romanian
27+
"ru" "Russian" // Russian
28+
"chi" "SChinese" // Chinese (Simplified)
29+
"sk" "Slovak" // Slovak
30+
"es" "Spanish" // Spanish
31+
"sv" "Swedish" // Swedish
32+
"zho" "TChinese" // Chinese (Traditional)
33+
"th" "Thai" // Thai
34+
"tr" "Turkish" // Turkish
35+
"ua" "Ukrainian" // Ukrainian
36+
"vi" "Vietnamese" // Vietnamese
437
}

tools/buildbot/PackageScript

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
22
import os
3+
import re
34

45
builder.SetBuildFolder('package')
56

@@ -126,3 +127,17 @@ helpers.CopyFiles('plugins/basevotes', 'addons/sourcemod/scripting/basevotes')
126127
helpers.CopyFiles('plugins/basebans', 'addons/sourcemod/scripting/basebans')
127128
helpers.CopyFiles('plugins/funcommands', 'addons/sourcemod/scripting/funcommands')
128129
helpers.CopyFiles('plugins/playercommands', 'addons/sourcemod/scripting/playercommands')
130+
131+
with open(os.path.join(builder.sourcePath, 'configs/languages.cfg'), 'r') as f:
132+
language_re = re.compile(r'^\s*"([^"]+)"\s+"[^"]+"')
133+
added_languages = set(["en"])
134+
for line in f.read().splitlines():
135+
match = language_re.match(line)
136+
if match:
137+
lang_code = match.group(1)
138+
if lang_code in added_languages:
139+
continue
140+
output_path = os.path.join('addons/sourcemod/translations', lang_code)
141+
helpers.CreateFolders([output_path])
142+
helpers.CopyFiles(os.path.join('translations', lang_code), output_path)
143+
added_languages.add(lang_code)

tools/buildbot/package.pl

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,6 @@
3636
#Switch to the output folder.
3737
chdir(Build::PathFormat('../../../OUTPUT/package'));
3838

39-
print "Downloading languages.cfg...\n";
40-
# Don't check certificate. It will fail on the slaves and we're resolving to internal addressing anyway
41-
system('wget --no-check-certificate -q -O addons/sourcemod/configs/languages.cfg "https://sm.alliedmods.net/translator/index.php?go=translate&op=export_langs"');
42-
open(my $fh, '<', 'addons/sourcemod/configs/languages.cfg')
43-
or die "Could not open languages.cfg' $!";
44-
45-
while (my $ln = <$fh>) {
46-
if ($ln =~ /"([^"]+)"\s*"[^"]+.*\((\d+)\) /)
47-
{
48-
my $abbr = $1;
49-
my $id = $2;
50-
51-
print "Downloading language pack $abbr.zip...\n";
52-
# Don't check certificate. It will fail on the slaves and we're resolving to internal addressing anyway
53-
system("wget --no-check-certificate -q -O $abbr.zip \"https://sm.alliedmods.net/translator/index.php?go=translate&op=export&lang_id=$id\"");
54-
system("unzip -qo $abbr.zip -d addons/sourcemod/translations/");
55-
unlink("$abbr.zip");
56-
}
57-
}
58-
close($fh);
59-
6039
unless (-e '../GeoLite2-City_20191217.tar')
6140
{
6241
print "Downloading GeoLite2-City.mmdb...\n";

0 commit comments

Comments
 (0)