瀏覽代碼

Create russian translation

Kandrashin Denis 13 年之前
父節點
當前提交
73465739a4
共有 7 個文件被更改,包括 315 次插入11 次删除
  1. 4 0
      source/fb2app.cpp
  2. 2 0
      source/fb2edit.pro
  3. 1 0
      source/fb2edit.qrc
  4. 5 9
      source/fb2main.cpp
  5. 2 2
      source/fb2read.cpp
  6. 二進制
      source/ts/ru.qm
  7. 301 0
      source/ts/ru.ts

+ 4 - 0
source/fb2app.cpp

@@ -38,6 +38,10 @@ int main(int argc, char *argv[])
     app.setApplicationName("fb2edit");
     app.setOrganizationName("LinTest");
 
+    QTranslator translator;
+    translator.load(QLocale::system().name(), ":ts");
+    app.installTranslator(&translator);
+
     Fb2MainWindow * mainWin = new Fb2MainWindow;
     mainWin->show();
 

+ 2 - 0
source/fb2edit.pro

@@ -17,6 +17,8 @@ RESOURCES = \
 
 TARGET = fb2edit
 
+TRANSLATIONS = ts/ru.ts
+
 VERSION = 0.01.1
 
 QT += xml

+ 1 - 0
source/fb2edit.qrc

@@ -43,5 +43,6 @@
         <file>res/24/zoom-original.png</file>
         <file>res/24/zoom-out.png</file>
         <file>res/style.css</file>
+        <file>ts/ru.qm</file>
     </qresource>
 </RCC>

+ 5 - 9
source/fb2main.cpp

@@ -169,7 +169,7 @@ bool Fb2MainWindow::fileSave()
 
 bool Fb2MainWindow::fileSaveAs()
 {
-    QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), curFile);
+    QString fileName = QFileDialog::getSaveFileName(this, tr("Save As..."), curFile);
     if (fileName.isEmpty()) return false;
     return saveFile(fileName);
 }
@@ -297,7 +297,7 @@ void Fb2MainWindow::createActions()
     tool->addAction(act);
     clipboardDataChanged();
 
-    menu = menuBar()->addMenu(tr("Format"));
+    menu = menuBar()->addMenu(tr("Fo&rmat"));
     tool = addToolBar(tr("Format"));
 
     actionTextBold = act = new QAction(icon("format-text-bold"), tr("Bold"), this);
@@ -539,8 +539,7 @@ bool Fb2MainWindow::maybeSave()
     if (textEdit && textEdit->isModified()) {
         QMessageBox::StandardButton ret;
         ret = QMessageBox::warning(this, tr("SDI"),
-                     tr("The document has been modified.\n"
-                        "Do you want to save your changes?"),
+                     tr("The document has been modified. Do you want to save your changes?"),
                      QMessageBox::Save | QMessageBox::Discard
 		     | QMessageBox::Cancel);
         if (ret == QMessageBox::Save)
@@ -557,10 +556,7 @@ bool Fb2MainWindow::saveFile(const QString &fileName)
 
     QFile file(fileName);
     if (!file.open(QFile::WriteOnly | QFile::Text)) {
-        QMessageBox::warning(this, tr("SDI"),
-                             tr("Cannot write file %1:\n%2.")
-                             .arg(fileName)
-                             .arg(file.errorString()));
+        QMessageBox::warning(this, tr("SDI"), tr("Cannot write file %1: %2.").arg(fileName).arg(file.errorString()));
         return false;
     }
 
@@ -581,7 +577,7 @@ void Fb2MainWindow::setCurrentFile(const QString &filename)
     QString title;
     isUntitled = filename.isEmpty();
     if (isUntitled) {
-        curFile = tr("book%1.fb2").arg(sequenceNumber++);
+        curFile = QString("book%1.fb2").arg(sequenceNumber++);
         title = curFile;
     } else {
         QFileInfo info = filename;

+ 2 - 2
source/fb2read.cpp

@@ -41,7 +41,7 @@ bool Fb2ReadThread::parse()
 {
     QFile file(m_filename);
     if (!file.open(QFile::ReadOnly | QFile::Text)) {
-        qCritical() << QObject::tr("Cannot read file %1:\n%2.").arg(m_filename).arg(file.errorString());
+        qCritical() << QObject::tr("Cannot read file %1: %2.").arg(m_filename).arg(file.errorString());
         return false;
     }
     Fb2Handler handler(*this);
@@ -424,7 +424,7 @@ bool Fb2Handler::endElement(const QString & namespaceURI, const QString & localN
 
 bool Fb2Handler::fatalError(const QXmlParseException &exception)
 {
-    qCritical() << QObject::tr("Parse error at line %1, column %2:\n%3")
+    qCritical() << QObject::tr("Parse error at line %1, column %2: %3")
        .arg(exception.lineNumber())
        .arg(exception.columnNumber())
        .arg(exception.message());

二進制
source/ts/ru.qm


+ 301 - 0
source/ts/ru.ts

@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+    <name>Fb2MainWindow</name>
+    <message>
+        <location filename="../fb2main.cpp" line="65"/>
+        <source>Message log</source>
+        <translation>Информационные сообщения</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="172"/>
+        <source>Save As...</source>
+        <translation>Сохранить как...</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="179"/>
+        <source>About fb2edit</source>
+        <translation>О программе...</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="180"/>
+        <source>The &lt;b&gt;fb2edit&lt;/b&gt; is application for editing FB2-files.</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="209"/>
+        <source>&amp;File</source>
+        <translation>&amp;Файл</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="210"/>
+        <source>File</source>
+        <translation>Файл</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="212"/>
+        <source>&amp;New</source>
+        <translation>&amp;Новый</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="215"/>
+        <source>Create a new file</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="220"/>
+        <source>&amp;Open...</source>
+        <translation>&amp;Открыть...</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="222"/>
+        <source>Open an existing file</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="227"/>
+        <source>&amp;Save</source>
+        <translation>&amp;Сохранить</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="229"/>
+        <source>Save the document to disk</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="234"/>
+        <source>Save &amp;As...</source>
+        <translation>Сохрать &amp;как...</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="236"/>
+        <source>Save the document under a new name</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="242"/>
+        <source>&amp;Close</source>
+        <translation>&amp;Закрыть</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="244"/>
+        <source>Close this window</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="248"/>
+        <source>E&amp;xit</source>
+        <translation>&amp;Выход</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="250"/>
+        <source>Exit the application</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="254"/>
+        <source>&amp;Edit</source>
+        <translation>&amp;Правка</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="255"/>
+        <source>Edit</source>
+        <translation>Правка</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="259"/>
+        <source>&amp;Undo</source>
+        <translation>&amp;Отменить</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="266"/>
+        <source>&amp;Redo</source>
+        <translation>&amp;Повторить</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="276"/>
+        <source>Cu&amp;t</source>
+        <translation>Вы&amp;резать</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="279"/>
+        <source>Cut the current selection&apos;s contents to the clipboard</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="284"/>
+        <source>&amp;Copy</source>
+        <translation>&amp;Копировать</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="287"/>
+        <source>Copy the current selection&apos;s contents to the clipboard</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="292"/>
+        <source>&amp;Paste</source>
+        <translation>&amp;Вставить</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="295"/>
+        <source>Paste the clipboard&apos;s contents into the current selection</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="300"/>
+        <source>Fo&amp;rmat</source>
+        <translation>Фо&amp;рмат</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="301"/>
+        <source>Format</source>
+        <translation>Формат</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="303"/>
+        <source>Bold</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="309"/>
+        <source>Italic</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="315"/>
+        <source>Strikethrough</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="320"/>
+        <source>Superscript</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="325"/>
+        <source>Subscript</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="330"/>
+        <source>&amp;View</source>
+        <translation>&amp;Вид</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="332"/>
+        <source>&amp;Text</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="336"/>
+        <source>&amp;XML</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="349"/>
+        <source>Zoom</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="351"/>
+        <source>Zoom in</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="356"/>
+        <source>Zoom out</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="361"/>
+        <source>Zoom original</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="367"/>
+        <source>Web inspector</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="373"/>
+        <source>&amp;Help</source>
+        <translation>&amp;?</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="375"/>
+        <source>&amp;About</source>
+        <translation>&amp;О программа...</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="376"/>
+        <source>Show the application&apos;s About box</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="380"/>
+        <source>About &amp;Qt</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="381"/>
+        <source>Show the Qt library&apos;s About box</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="393"/>
+        <source>Contents</source>
+        <translation>Содержание</translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="518"/>
+        <source>Ready</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="541"/>
+        <location filename="../fb2main.cpp" line="559"/>
+        <source>SDI</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="542"/>
+        <source>The document has been modified. Do you want to save your changes?</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="559"/>
+        <source>Cannot write file %1: %2.</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2main.cpp" line="569"/>
+        <source>File saved</source>
+        <translation></translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <location filename="../fb2read.cpp" line="44"/>
+        <source>Cannot read file %1: %2.</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2read.cpp" line="152"/>
+        <source>Conglict XML tags: &lt;%1&gt; - &lt;/%2&gt;</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2read.cpp" line="398"/>
+        <source>The file is not an FB2 file.</source>
+        <translation></translation>
+    </message>
+    <message>
+        <location filename="../fb2read.cpp" line="427"/>
+        <source>Parse error at line %1, column %2: %3</source>
+        <translation></translation>
+    </message>
+</context>
+</TS>