Merge pull request #774 from vkbo/issue773_qtranslate_filepath

Issue #773: Fix QTranslate() filePath issue
This commit is contained in:
Veronica Berglyd Olsen
2021-05-06 12:52:58 +02:00
committed by GitHub
5 changed files with 22 additions and 10 deletions
+5 -3
View File
@@ -18,13 +18,13 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
architecture: x64 architecture: x64
- name: Install Packages - name: Install Packages (apt)
run: | run: |
sudo apt update sudo apt update
sudo apt install libenchant-dev qt5-default sudo apt install libenchant-dev qt5-default qttools5-dev-tools
- name: Checkout Source - name: Checkout Source
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Dependencies - name: Install Dependencies (pip)
run: | run: |
pip install --upgrade pip pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
@@ -32,6 +32,8 @@ jobs:
pip install pytest-cov pip install pytest-cov
pip install pytest-qt pip install pytest-qt
pip install codecov pip install codecov
- name: Run Build Commands
run: python setup.py qtlrelease sample
- name: Run Tests - name: Run Tests
run: | run: |
export QT_QPA_PLATFORM=offscreen export QT_QPA_PLATFORM=offscreen
+4 -3
View File
@@ -106,8 +106,8 @@ Building the Translation Files
If you installed novelWriter from a package, the translation files should be pre-built and If you installed novelWriter from a package, the translation files should be pre-built and
included. If you're running novelWriter from the source code, you will need to generate the files included. If you're running novelWriter from the source code, you will need to generate the files
yourself. The files you need will be written to the ``i18n`` folder, and will have the ``.qm`` file yourself. The files you need will be written to the ``nw/assets/i18n`` folder, and will have the
extension. ``.qm`` file extension.
You can build the ``.qm`` files with: You can build the ``.qm`` files with:
@@ -115,7 +115,8 @@ You can build the ``.qm`` files with:
python3 setup.py qtlrelease python3 setup.py qtlrelease
This requires that the Python package ``pylupdate5`` to be installed. This requires that the Qt Linguist tool is installed on your system. On Ubuntu and Debian, the
needed package is called `qttools5-dev-tools`.
.. note:: .. note::
If you want to improve novelWriter with translation files for another language, or update an If you want to improve novelWriter with translation files for another language, or update an
+8 -1
View File
@@ -36,9 +36,16 @@ test it.
Please do not submit the `.qm` files to the repository. Only the `.ts` files in the `i18n` folder Please do not submit the `.qm` files to the repository. Only the `.ts` files in the `i18n` folder
are needed. are needed.
**Note:** This requires that you have the tools Qt 5 Linguist and the PyQt5 tool `pylupdate5` **Note**
These commands require that you have the tools Qt 5 Linguist and the PyQt5 tool `pylupdate5`
installed on your system. installed on your system.
For Ubuntu/Debian, run:
```bash
sudo apt install qttools5-dev-tools pyqt5-dev-tools
```
### Missing QtBase Translations ### Missing QtBase Translations
The default Qt dialogs also have translations, for instance for standard buttons for "Yes", "No", The default Qt dialogs also have translations, for instance for standard buttons for "Yes", "No",
+1 -1
View File
@@ -391,7 +391,7 @@ class Config:
lngFile = "%s_%s" % (lngBase, lngCode.replace("-", "_")) lngFile = "%s_%s" % (lngBase, lngCode.replace("-", "_"))
if lngFile not in self.qtTrans: if lngFile not in self.qtTrans:
if qTrans.load(lngFile, lngPath): if qTrans.load(lngFile, lngPath):
logger.debug("Loaded: %s" % qTrans.filePath()) logger.debug("Loaded: %s" % os.path.join(lngPath, lngFile))
nwApp.installTranslator(qTrans) nwApp.installTranslator(qTrans)
self.qtTrans[lngFile] = qTrans self.qtTrans[lngFile] = qTrans
+4 -2
View File
@@ -225,8 +225,9 @@ def buildQtI18n():
try: try:
subprocess.call(["lrelease", "-verbose", "novelWriter.pro"]) subprocess.call(["lrelease", "-verbose", "novelWriter.pro"])
except Exception as e: except Exception as e:
print("QtI18n Release Error:") print("Qt5 Linguist tools seem to be missing")
print(str(e)) print(str(e))
sys.exit(1)
print("") print("")
print("Moving QM Files to Assets") print("Moving QM Files to Assets")
@@ -262,8 +263,9 @@ def buildQtI18nTS():
try: try:
subprocess.call(["pylupdate5", "-verbose", "-noobsolete", "novelWriter.pro"]) subprocess.call(["pylupdate5", "-verbose", "-noobsolete", "novelWriter.pro"])
except Exception as e: except Exception as e:
print("QtI18n Release Error:") print("PyQt5 Linguist tools seem to be missing")
print(str(e)) print(str(e))
sys.exit(1)
print("") print("")