Commit 6211feda authored by Pino Toscano's avatar Pino Toscano

i18n fixes

- translate visibile strings in Python plugins
- avoid string puzzles
- avoid extra exclamation marks, since it is not a game
- style fixes
parent 5e2f24a6
......@@ -11,6 +11,7 @@ https://creativecommons.org/publicdomain/zero/1.0/legalcode
'''
from PyQt5.QtWidgets import (QWidget, QSpinBox, QHBoxLayout,
QVBoxLayout, QFormLayout)
import krita
class CanvasSizeTool(QWidget):
......@@ -40,9 +41,9 @@ class CanvasSizeTool(QWidget):
self.offsetLayout.addWidget(self.xOffsetSpinBox)
self.offsetLayout.addWidget(self.yOffsetSpinBox)
self.layout.addRow('Width', self.widthSpinBox)
self.layout.addRow('Height', self.heightSpinBox)
self.layout.addRow('Offset', self.offsetLayout)
self.layout.addRow(i18n("Width:"), self.widthSpinBox)
self.layout.addRow(i18n("Height:"), self.heightSpinBox)
self.layout.addRow(i18n("Offset:"), self.offsetLayout)
def adjust(self, documents):
for document in documents:
......
......@@ -12,6 +12,7 @@ https://creativecommons.org/publicdomain/zero/1.0/legalcode
from PyQt5.QtWidgets import (QWidget, QSpinBox, QHBoxLayout,
QVBoxLayout, QFormLayout)
import math
import krita
class RotateTool(QWidget):
......@@ -30,9 +31,9 @@ class RotateTool(QWidget):
def initialize(self):
self.degreesSpinBox.setRange(-180, 180)
self.degreesSpinBox.setToolTip("Negative degrees will rotate the image to the left")
self.degreesSpinBox.setToolTip(i18n("Negative degrees will rotate the image to the left"))
self.layout.addRow('Degrees', self.degreesSpinBox)
self.layout.addRow(i18n("Degrees:"), self.degreesSpinBox)
def adjust(self, documents):
for document in documents:
......
......@@ -11,6 +11,7 @@ https://creativecommons.org/publicdomain/zero/1.0/legalcode
'''
from PyQt5.QtWidgets import (QWidget, QSpinBox, QHBoxLayout,
QVBoxLayout, QFormLayout, QComboBox)
import krita
class ScaleTool(QWidget):
......@@ -46,10 +47,10 @@ class ScaleTool(QWidget):
self.resolutionLayout.addWidget(self.xResSpinBox)
self.resolutionLayout.addWidget(self.yResSpinBox)
self.layout.addRow('Width', self.widthSpinBox)
self.layout.addRow('Height', self.heightSpinBox)
self.layout.addRow('Resolution', self.resolutionLayout)
self.layout.addRow('Filter', self.strategyComboBox)
self.layout.addRow(i18n("Width:"), self.widthSpinBox)
self.layout.addRow(i18n("Height:"), self.heightSpinBox)
self.layout.addRow(i18n("Resolution:"), self.resolutionLayout)
self.layout.addRow(i18n("Filter:"), self.strategyComboBox)
def adjust(self, documents):
for document in documents:
......
......@@ -48,7 +48,7 @@ class HelloExtension(Extension):
"""
This is where most of the setup takes place!
"""
action = window.createAction("hello_python", "hello")
action = window.createAction("hello_python", i18n("Hello"))
action.triggered.connect(hello)
......
......@@ -22,7 +22,7 @@ class LastDocumentsDocker(krita.DockWidget):
self.baseWidget = QWidget()
self.layout = QVBoxLayout()
self.listView = QListView()
self.loadButton = QPushButton("Refresh")
self.loadButton = QPushButton(i18n("Refresh"))
self.listModel = lastdocumentslistmodel.LastDocumentsListModel()
self.listView.setModel(self.listModel)
......@@ -35,7 +35,7 @@ class LastDocumentsDocker(krita.DockWidget):
self.setWidget(self.baseWidget)
self.loadButton.clicked.connect(self.refreshRecentDocuments)
self.setWindowTitle("Last Documents Docker")
self.setWindowTitle(i18n("Last Documents Docker"))
def canvasChanged(self, canvas):
pass
......
......@@ -38,7 +38,7 @@ class Palette_Docker(DockWidget):
layout = QVBoxLayout()
buttonLayout = QHBoxLayout()
widget.setLayout(layout)
self.setWindowTitle("Python Palette Docker")
self.setWindowTitle(i18n("Python Palette Docker"))
# Make a combobox and add palettes
self.cmb_palettes = QComboBox()
......@@ -63,19 +63,19 @@ class Palette_Docker(DockWidget):
self.colorList = list()
buttonLayout.addWidget(self.colorComboBox)
self.bnSetColor = QToolButton()
self.bnSetColor.setText("Set")
self.bnSetColor.setText(i18n("Set"))
self.bnSetColor.clicked.connect(self.slot_get_color_from_combobox)
buttonLayout.addWidget(self.bnSetColor)
self.addEntry = QAction(self)
self.addEntry.setIconText("+")
self.addEntry.setIconText(i18n("+"))
self.addEntry.triggered.connect(self.slot_add_entry)
self.addGroup = QAction(self)
self.addGroup.triggered.connect(self.slot_add_group)
self.addGroup.setText("Add Group")
self.addGroup.setText(i18n("Add Group"))
self.addGroup.setIconText(str("\U0001F4C2"))
self.removeEntry = QAction(self)
self.removeEntry.setText("Remove Entry")
self.removeEntry.setText(i18n("Remove Entry"))
self.removeEntry.setIconText("-")
self.removeEntry.triggered.connect(self.slot_remove_entry)
addEntryButton = QToolButton()
......@@ -91,19 +91,19 @@ class Palette_Docker(DockWidget):
# QActions
self.extra = QToolButton()
self.editPaletteData = QAction(self)
self.editPaletteData.setText("Edit Palette Settings")
self.editPaletteData.setText(i18n("Edit Palette Settings"))
self.editPaletteData.triggered.connect(self.slot_edit_palette_data)
self.extra.setDefaultAction(self.editPaletteData)
buttonLayout.addWidget(self.extra)
self.actionMenu = QMenu()
self.exportToGimp = QAction(self)
self.exportToGimp.setText("Export as GIMP palette file.")
self.exportToGimp.setText(i18n("Export as GIMP Palette File"))
self.exportToGimp.triggered.connect(self.slot_export_to_gimp_palette)
self.exportToInkscape = QAction(self)
self.exportToInkscape.setText("Export as Inkscape SVG with swatches.")
self.exportToInkscape.setText(i18n("Export as Inkscape SVG with Swatches"))
self.exportToInkscape.triggered.connect(self.slot_export_to_inkscape_svg)
self.sortColors = QAction(self)
self.sortColors.setText("Sort colors")
self.sortColors.setText(i18n("Sort Colors"))
self.sortColors.triggered.connect(self.slot_sort_colors)
self.actionMenu.addAction(self.editPaletteData)
self.actionMenu.addAction(self.exportToGimp)
......@@ -208,12 +208,12 @@ class Palette_Docker(DockWidget):
def slot_edit_palette_data(self):
dialog = QDialog(self)
tabWidget = QTabWidget()
dialog.setWindowTitle("Edit Palette Data")
dialog.setWindowTitle(i18n("Edit Palette Data"))
dialog.setLayout(QVBoxLayout())
dialog.layout().addWidget(tabWidget)
paletteWidget = QWidget()
paletteWidget.setLayout(QVBoxLayout())
tabWidget.addTab(paletteWidget, "Palette Data")
tabWidget.addTab(paletteWidget, i18n("Palette Data"))
paletteName = QLineEdit()
paletteName.setText(self.cmb_palettes.currentText())
paletteWidget.layout().addWidget(paletteName)
......
......@@ -34,8 +34,8 @@ class gimpPaletteExporter:
self.currentPalette = Palette(allPalettes[self.paletteName])
self.export()
done = QMessageBox()
done.setWindowTitle("Export successful")
done.setText(self.paletteName + " has been exported to " + self.fileName + "!")
done.setWindowTitle(i18n("Export Successful"))
done.setText(str(i18n("{input} has been exported to {output}.")).format(input=self.paletteName, output=self.fileName))
done.exec_()
pass
......
......@@ -35,8 +35,8 @@ class inkscapeSVGExporter:
self.currentPalette = Palette(allPalettes[self.paletteName])
self.export()
done = QMessageBox()
done.setWindowTitle("Export successful")
done.setText(self.paletteName + " has been exported to " + self.fileName + "!")
done.setWindowTitle(i18n("Export Successful"))
done.setText(str(i18n("{input} has been exported to {output}.")).format(input=self.paletteName, output=self.fileName))
done.exec_()
pass
......
......@@ -33,7 +33,7 @@ class QuickSettingsDocker(DockWidget):
widget = QWidget()
layout = QVBoxLayout()
widget.setLayout(layout)
self.setWindowTitle("Quick Settings Docker")
self.setWindowTitle(i18n("Quick Settings Docker"))
tabWidget = QTabWidget()
self.brushSizeTableView = QListView()
......@@ -57,9 +57,9 @@ class QuickSettingsDocker(DockWidget):
self.brushFlowTableView.setUniformItemSizes(True)
self.brushFlowTableView.setSelectionMode(QListView.SingleSelection)
tabWidget.addTab(self.brushSizeTableView, "Size")
tabWidget.addTab(self.brushOpacityTableView, "Opacity")
tabWidget.addTab(self.brushFlowTableView, "Flow")
tabWidget.addTab(self.brushSizeTableView, i18n("Size"))
tabWidget.addTab(self.brushOpacityTableView, i18n("Opacity"))
tabWidget.addTab(self.brushFlowTableView, i18n("Flow"))
layout.addWidget(tabWidget)
self.setWidget(widget) # Add the widget to the docker.
......
......@@ -23,7 +23,7 @@ class ScriptDocker(krita.DockWidget):
self.baseWidget = QWidget()
self.layout = QVBoxLayout()
self.scriptsLayout = QFormLayout()
self.addButton = QPushButton("Add Script")
self.addButton = QPushButton(i18n("Add Script"))
self.actions = []
self.layout.addLayout(self.scriptsLayout)
......@@ -31,7 +31,7 @@ class ScriptDocker(krita.DockWidget):
self.baseWidget.setLayout(self.layout)
self.setWidget(self.baseWidget)
self.setWindowTitle("Script Docker")
self.setWindowTitle(i18n("Script Docker"))
self.addButton.clicked.connect(self.addNewRow)
def canvasChanged(self, canvas):
......@@ -40,14 +40,14 @@ class ScriptDocker(krita.DockWidget):
def addNewRow(self):
directorySelectorLayout = QHBoxLayout()
directoryTextField = QLineEdit()
directoryDialogButton = QPushButton("...")
directoryDialogButton = QPushButton(i18n("..."))
directoryDialogButton.clicked.connect(self.test)
directorySelectorLayout.addWidget(directoryTextField)
directorySelectorLayout.addWidget(directoryDialogButton)
self.scriptsLayout.addRow("Script {0}".format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout)
self.scriptsLayout.addRow(str(i18n("Script {0}")).format(self.scriptsLayout.rowCount() + 1), directorySelectorLayout)
def test(self):
obj = self.sender()
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction, QMessageBox
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import Qt
import krita
class CloseAction(QAction):
......@@ -28,7 +29,7 @@ class CloseAction(QAction):
self.triggered.connect(self.close)
self.setText('Close')
self.setText(i18n("Close"))
self.setObjectName('close')
self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
......@@ -39,7 +40,7 @@ class CloseAction(QAction):
def close(self):
msgBox = QMessageBox(self.scripter.uicontroller.mainWidget)
msgBox.setInformativeText("Do you want to save the current document?")
msgBox.setInformativeText(i18n("Do you want to save the current document?"))
msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
msgBox.setDefaultButton(QMessageBox.Save)
......
......@@ -19,6 +19,7 @@ from PyQt5.QtWidgets import QAction
from PyQt5.QtGui import QIcon, QPixmap, QKeySequence
from scripter import resources_rc
from PyQt5.QtCore import Qt
import krita
class DebugAction(QAction):
......@@ -29,8 +30,8 @@ class DebugAction(QAction):
self.triggered.connect(self.debug)
self.setText('Debug')
self.setToolTip('Debug Ctrl+D')
self.setText(i18n("Debug"))
self.setToolTip(i18n("Debug Ctrl+D"))
self.setIcon(QIcon(':/icons/debug.svg'))
self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_D))
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction, QMessageBox
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import Qt
import krita
class NewAction(QAction):
......@@ -28,7 +29,7 @@ class NewAction(QAction):
self.triggered.connect(self.new)
self.setText('New')
self.setText(i18n("New"))
self.setObjectName('new')
self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_N))
......@@ -39,8 +40,8 @@ class NewAction(QAction):
def new(self):
msgBox = QMessageBox(self.scripter.uicontroller.mainWidget)
msgBox.setText("The document has been modified.")
msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setText(i18n("The document has been modified."))
msgBox.setInformativeText(i18n("Do you want to save your changes?"))
msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
msgBox.setDefaultButton(QMessageBox.Save)
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import Qt
import krita
import os
......@@ -30,7 +31,7 @@ class OpenAction(QAction):
self.triggered.connect(self.open)
self.setText('Open')
self.setText(i18n("Open"))
self.setObjectName('open')
self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_O))
......@@ -40,7 +41,7 @@ class OpenAction(QAction):
def open(self):
dialog = QFileDialog(self.scripter.uicontroller.mainWidget)
dialog.setNameFilter('Python files (*.py)')
dialog.setNameFilter(i18n("Python Files (*.py)"))
if dialog.exec_():
try:
......@@ -53,5 +54,5 @@ class OpenAction(QAction):
self.scripter.uicontroller.setStatusBar(document.filePath)
except Exception:
QMessageBox.information(self.scripter.uicontroller.mainWidget,
'Invalid File',
'Open files with .py extension')
i18n("Invalid File"),
i18n("Open files with .py extension"))
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction, QMessageBox
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import Qt
import krita
class ReloadAction(QAction):
......@@ -29,7 +30,7 @@ class ReloadAction(QAction):
self.triggered.connect(self.reloadFile)
self.setText('Reload File')
self.setText(i18n("Reload File"))
self.setObjectName('reloadfile')
self.setShortcut(QKeySequence(Qt.ALT + Qt.Key_R))
......@@ -43,8 +44,8 @@ class ReloadAction(QAction):
document = self.scripter.documentcontroller._activeDocument
if document is None:
QMessageBox.critical(self.scripter.uicontroller.mainWidget,
'No existing document',
'Please specify a document by opening it before reloading')
i18n("No existing document"),
i18n("Please specify a document by opening it before reloading"))
return
else:
curr_doc_fpath = document.filePath
......
......@@ -22,6 +22,7 @@ import sys
import traceback
import inspect
from . import docwrapper
import krita
if sys.version_info[0] > 2:
import importlib
......@@ -46,7 +47,7 @@ class RunAction(QAction):
self.triggered.connect(self.run)
self.setText('Run')
self.setText(i18n("Run"))
self.setToolTip('Run Ctrl+R')
self.setIcon(QIcon(':/icons/run.svg'))
self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_R))
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction, QFileDialog
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import Qt
import krita
class SaveAction(QAction):
......@@ -29,7 +30,7 @@ class SaveAction(QAction):
self.triggered.connect(self.save)
self.setText('Save')
self.setText(i18n("Save"))
self.setObjectName('save')
self.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S))
......@@ -43,8 +44,8 @@ class SaveAction(QAction):
if not self.scripter.documentcontroller.activeDocument:
fileName = QFileDialog.getSaveFileName(self.scripter.uicontroller.mainWidget,
'Save Python File', '',
'Python File (*.py)')[0]
i18n("Save Python File"), '',
i18n("Python File (*.py)"))[0]
if not fileName:
return
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction, QFileDialog
from PyQt5.QtGui import QKeySequence
from PyQt5.QtCore import Qt
import krita
class SaveAsAction(QAction):
......@@ -29,7 +30,7 @@ class SaveAsAction(QAction):
self.triggered.connect(self.save)
self.setText('Save As')
self.setText(i18n("Save As"))
self.setObjectName('saveas')
self.setShortcut(QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_S))
......@@ -41,8 +42,8 @@ class SaveAsAction(QAction):
text = self.editor.toPlainText()
fileName = QFileDialog.getSaveFileName(self.scripter.uicontroller.mainWidget,
'Save Python File', '',
'Python File (*.py)')[0]
i18n("Save Python File"), '',
i18n("Python File (*.py)"))[0]
if not fileName:
return
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction
from PyQt5.QtCore import Qt
from . import settingsdialog
import krita
class SettingsAction(QAction):
......@@ -32,7 +33,7 @@ class SettingsAction(QAction):
self.settingsDialog.setWindowModality(Qt.WindowModal)
self.settingsDialog.setFixedSize(400, 250)
self.setText('Settings')
self.setText(i18n("Settings"))
@property
def parent(self):
......
......@@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
from PyQt5.QtWidgets import QDialog, QFormLayout
from . import syntaxstylescombobox, fontscombobox
import krita
class SettingsDialog(QDialog):
......@@ -25,10 +26,10 @@ class SettingsDialog(QDialog):
super(SettingsDialog, self).__init__(parent)
self.scripter = scripter
self.setWindowTitle('Settings')
self.setWindowTitle(i18n("Settings"))
self.mainLayout = QFormLayout(self)
self.mainLayout.addRow('Syntax Highlither', syntaxstylescombobox.SyntaxStylesComboBox(self.scripter.uicontroller.highlight, self.scripter.uicontroller.editor))
self.mainLayout.addRow('Fonts', fontscombobox.FontsComboBox(self.scripter.uicontroller.editor))
self.mainLayout.addRow(i18n("Syntax highlighter:"), syntaxstylescombobox.SyntaxStylesComboBox(self.scripter.uicontroller.highlight, self.scripter.uicontroller.editor))
self.mainLayout.addRow(i18n("Fonts:"), fontscombobox.FontsComboBox(self.scripter.uicontroller.editor))
def readSettings(self, settings):
for index in range(self.mainLayout.rowCount()):
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction
from PyQt5.QtGui import QIcon
from scripter import resources_rc
import krita
class StepAction(QAction):
......@@ -29,7 +30,7 @@ class StepAction(QAction):
self.triggered.connect(self.step)
self.setText('Step Over')
self.setText(i18n("Step Over"))
# path to the icon
self.setIcon(QIcon(':/icons/step.svg'))
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction
from PyQt5.QtGui import QIcon
from scripter import resources_rc
import krita
class StopAction(QAction):
......@@ -29,7 +30,7 @@ class StopAction(QAction):
self.triggered.connect(self.stop)
self.setText('Stop')
self.setText(i18n("Stop"))
# path to the icon
self.setIcon(QIcon(':/icons/stop.svg'))
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from PyQt5.QtWidgets import QAction
from PyQt5.QtGui import QIcon
from scripter import resources_rc
import krita
class ClearAction(QAction):
......@@ -29,7 +30,7 @@ class ClearAction(QAction):
self.triggered.connect(self.clear)
self.setText('Clear')
self.setText(i18n("Clear"))
# path to the icon
# self.setIcon(QIcon(':/icons/clear.svg'))
......
......@@ -24,6 +24,7 @@ from .ui_scripter.syntax import syntax, syntaxstyles
from .ui_scripter.editor import pythoneditor
from . import scripterdialog
import importlib
import krita
KEY_GEOMETRY = "geometry"
DEFAULT_GEOMETRY = QRect(600, 200, 400, 500)
......@@ -93,7 +94,7 @@ class UIController(object):
vbox.addWidget(self.splitter)
vbox.addWidget(self.statusBar)
self.mainWidget.setWindowTitle("Scripter")
self.mainWidget.setWindowTitle(i18n("Scripter"))
self.mainWidget.setSizeGripEnabled(True)
self.mainWidget.show()
self.mainWidget.activateWindow()
......@@ -170,7 +171,7 @@ class UIController(object):
return widget
def showException(self, exception):
QMessageBox.critical(self.editor, "Error running script", str(exception))
QMessageBox.critical(self.editor, i18n("Error Running Script"), str(exception))
def setDocumentEditor(self, document):
self.editor.clear()
......
......@@ -25,7 +25,7 @@ class SelectionsBagDocker(DockWidget):
widget = QWidget(self)
uic.loadUi(os.path.dirname(os.path.realpath(__file__)) + '/selectionsbagdocker.ui', widget)
self.setWidget(widget)
self.setWindowTitle("Selections bag")
self.setWindowTitle(i18n("Selections Bag"))
def canvasChanged(self, canvas):
print("Canvas", canvas)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment