MCPcopy Create free account
hub / github.com/TeXworks/texworks / switchInterfaceLocale

Method switchInterfaceLocale

modules/QtPDF/PDFViewer.cpp:143–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void PDFViewer::switchInterfaceLocale(const QLocale & newLocale)
144{
145 // TODO: Allow for a custom directory for .qm files (i.e., one in the
146 // filesystem, instead of the embedded resources)
147 if (_translatorLanguage == newLocale.name())
148 return;
149
150 // Remove the old translator (if any)
151 if (_translator) {
152 QCoreApplication::removeTranslator(_translator);
153 _translator->deleteLater();
154 _translator = nullptr;
155 }
156
157 _translatorLanguage = newLocale.name();
158
159 _translator = new QTranslator();
160 if (_translator->load(QString::fromUtf8("QtPDF_%1").arg(newLocale.name()), QString::fromUtf8(":/resfiles/translations")))
161 QCoreApplication::installTranslator(_translator);
162 else {
163 _translator->deleteLater();
164 _translator = nullptr;
165 }
166}
167
168
169PageCounter::PageCounter(QWidget *parent, Qt::WindowFlags f) : super(parent, f)

Callers

nothing calls this directly

Calls 2

nameMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected