Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5270bf7

Browse files
authored
Merge pull requestalexmojaki#266 from alexmojaki/translation-preview
More translation infrastructure
2 parents4410875 +3e1a2ac commit5270bf7

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

‎build.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ poetry run python -m translations.generate_po_file
1111
poetry run python -m core.generate_static_files
1212

1313
cd frontend
14-
CI=false npm run build
14+
REACT_APP_LANGUAGE=$FUTURECODER_LANGUAGECI=false npm run build
1515
cd ..
1616

1717
cp -r frontend/build/* dist/course/

‎core/generate_static_files.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def tarfile_filter(tar_info):
7575
xinname
7676
forxin [
7777
"__pycache__",
78-
"friendly/locales",
78+
"friendly_traceback/locales",
7979
"birdseye/static",
8080
"pygments/lexers",
8181
]
@@ -125,6 +125,15 @@ def main():
125125

126126
withtarfile.open(frontend_src/"python_core.tar.load_by_url","w")astar:
127127
tar.add(this_dir,arcname=this_dir.stem,recursive=True,filter=tarfile_filter)
128+
ift.current_languagenotin (None,"en"):
129+
forarcnamein [
130+
f"translations/locales/{t.current_language}",
131+
f"translations/codes.json",
132+
]:
133+
tar.add(this_dir.parent/arcname,arcname=arcname,recursive=True,filter=tarfile_filter)
134+
arcname=f"friendly_traceback/locales/{t.current_language}/LC_MESSAGES/friendly_tb_{t.current_language}.mo"
135+
tar.add(Path(site_packages)/arcname,arcname=arcname)
136+
128137
forrootinroots:
129138
tar.add(
130139
Path(site_packages)/root,

‎frontend/src/Worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function loadPyodideAndPackages() {
4040

4141
console.time("load_package_buffer(buffer)")
4242
constload_package_buffer=pyodide.globals.get("load_package_buffer")
43-
constresult=load_package_buffer(buffer);
43+
constresult=load_package_buffer(buffer,process.env.REACT_APP_LANGUAGE);
4444
({check_entry, install_imports}=toObject(result));
4545
console.timeEnd("load_package_buffer(buffer)")
4646
}

‎frontend/src/load.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
tarfile.TarFile.chown=lambda*_,**__:None
88

99

10-
defload_package_buffer(buffer):
10+
defload_package_buffer(buffer,lang):
1111
fd=io.BytesIO(buffer.to_py())
1212
withtarfile.TarFile(fileobj=fd)aszf:
1313
zf.extractall(package_path)
@@ -17,7 +17,8 @@ def load_package_buffer(buffer):
1717
fromcore.textimportload_chapters
1818
fromcoreimporttranslationast
1919

20-
# t.set_language("es")
20+
iflangandlang!="en":
21+
t.set_language(lang)
2122

2223
list(load_chapters())
2324

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp