| 141 | } |
| 142 | |
| 143 | void 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 | |
| 169 | PageCounter::PageCounter(QWidget *parent, Qt::WindowFlags f) : super(parent, f) |