Skip to content

Commit 6d4d74f

Browse files
committed
Added translations to pyinstaller
1 parent 13c3295 commit 6d4d74f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

build/OpenFFBoard.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ delete = ["opengl32sw.dll","d3dcompiler_47.dll","libGLESv2.dll","Qt6Quick.dll","
99

1010
a = Analysis([os.path.join(folder,'main.py')],
1111
binaries=[],
12-
datas=[(os.path.join(folder,'res'), 'res'),(os.path.join(folder,"libusb-1.0.dll"),"."),(os.path.join(folder,"libusb-1.0_32b.dll"),".")],
12+
datas=[(os.path.join(folder,'translations'), 'translations'),(os.path.join(folder,'res'), 'res'),(os.path.join(folder,"libusb-1.0.dll"),"."),(os.path.join(folder,"libusb-1.0_32b.dll"),".")],
1313
hiddenimports=[],
1414
hookspath=[],
1515
runtime_hooks=[],

helper.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
RESPATH = "res"
99

10-
def res_path(file):
10+
def res_path(file,respath=RESPATH):
1111
if getattr(sys, 'frozen',False) and hasattr(sys, '_MEIPASS'):
12-
return path.join(sys._MEIPASS,RESPATH,file)
13-
return path.join(RESPATH,file)
12+
return path.join(sys._MEIPASS,respath,file)
13+
return path.join(respath,file)
1414

1515
# Parses a classchooser reply into a list of classes and a dict to translate the class ID to (list index,name)
1616
def classlistToIds(dat):

main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def change_language(self,enabled):
216216
def make_lang_selector(self):
217217

218218
languages = [("",DEFAULTLANG)]
219-
languages.extend([(f,os.path.splitext(os.path.basename(f))[0]) for f in glob.glob("translations/*.qm")])
219+
languages.extend([(f,os.path.splitext(os.path.basename(f))[0]) for f in glob.glob(helper.res_path("*.qm","translations"))])
220220

221221
for langfile,langid in languages:
222222
action = QAction(langid)

0 commit comments

Comments
 (0)