Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
test: add assets for linguist tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seanwu1105 committed Mar 3, 2023
1 parent 07a2c12 commit 75eb268
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ disable=raw-checker-failed,
deprecated-pragma,
use-symbolic-message-instead,
missing-module-docstring,
missing-function-docstring
missing-function-docstring,
missing-class-docstring

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
2 changes: 2 additions & 0 deletions python/tests/assets/linguist/widget/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.qm
*.ts
32 changes: 32 additions & 0 deletions python/tests/assets/linguist/widget/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import sys

from PySide6.QtCore import QLibraryInfo, QLocale, QTranslator
from PySide6.QtWidgets import QApplication, QLabel, QMainWindow


class Window(QMainWindow):
def __init__(self):
super().__init__()
label = QLabel(self.tr("Taiwan"))
self.setCentralWidget(label)


if __name__ == "__main__":
app = QApplication()

path = QLibraryInfo.path(QLibraryInfo.LibraryPath.TranslationsPath)
translator = QTranslator(app)
if translator.load(QLocale.system(), "qtbase", "_", path):
app.installTranslator(translator)
translator = QTranslator(app)
path = os.path.dirname(os.path.abspath(__file__))
if translator.load(
QLocale(QLocale.Language.Chinese, QLocale.Country.Taiwan), "example", "_", path
):
print(f"load {translator.filePath()}")
app.installTranslator(translator)

window = Window()
window.show()
sys.exit(app.exec())
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"exclude": ["**/python/**"],
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
Expand Down

0 comments on commit 75eb268

Please sign in to comment.