← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-translation-issues into lp:ubuntu-docviewer-app

 

Looks good to me, just added one comment. Not sure if it can be worked around?

Diff comments:

> === modified file 'po/com.ubuntu.docviewer.pot'
> --- po/com.ubuntu.docviewer.pot	2015-03-04 12:28:46 +0000
> +++ po/com.ubuntu.docviewer.pot	2015-03-04 17:51:36 +0000
> @@ -8,7 +8,7 @@
>  msgstr ""
>  "Project-Id-Version: \n"
>  "Report-Msgid-Bugs-To: \n"
> -"POT-Creation-Date: 2015-03-04 13:28+0100\n"
> +"POT-Creation-Date: 2015-03-04 18:46+0100\n"
>  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
>  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
>  "Language-Team: LANGUAGE <LL@xxxxxx>\n"
> @@ -16,6 +16,7 @@
>  "MIME-Version: 1.0\n"
>  "Content-Type: text/plain; charset=CHARSET\n"
>  "Content-Transfer-Encoding: 8bit\n"
> +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
>  
>  #: ../src/app/qml/common/DetailsPage.qml:27
>  #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:91
> @@ -52,7 +53,7 @@
>  msgstr ""
>  
>  #: ../src/app/qml/common/ErrorDialog.qml:28
> -#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:31
> +#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:32
>  #: ../src/app/qml/pdfView/PdfViewDefaultHeader.qml:61
>  #: ../src/app/qml/textView/TextViewDefaultHeader.qml:61
>  msgid "Close"
> @@ -76,31 +77,56 @@
>  msgid "No"
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DeleteFileDialog.qml:27
> +#. TRANSLATORS: %1 is the size of a file, expressed in GB
> +#: ../src/app/qml/common/utils.js:22
> +#, qt-format
> +msgid "%1 GB"
> +msgstr ""
> +
> +#. TRANSLATORS: %1 is the size of a file, expressed in MB
> +#: ../src/app/qml/common/utils.js:26
> +#, qt-format
> +msgid "%1 MB"
> +msgstr ""
> +
> +#. TRANSLATORS: %1 is the size of a file, expressed in kB
> +#: ../src/app/qml/common/utils.js:30
> +#, qt-format
> +msgid "%1 kB"
> +msgstr ""
> +
> +#. TRANSLATORS: %1 is the size of a file, expressed in byte
> +#: ../src/app/qml/common/utils.js:33
> +#, qt-format
> +msgid "%1 byte"
> +msgstr ""
> +
> +#: ../src/app/qml/documentPage/DeleteFileDialog.qml:28
>  msgid "Delete file"
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DeleteFileDialog.qml:28
> -#, qt-format
> -msgid "Delete %1 files"
> -msgstr ""
> -
>  #: ../src/app/qml/documentPage/DeleteFileDialog.qml:29
> +#, qt-format
> +msgid "Delete %1 file"
> +msgid_plural "Delete %1 files"
> +msgstr[0] ""
> +msgstr[1] ""
> +
> +#: ../src/app/qml/documentPage/DeleteFileDialog.qml:30
> +#: ../src/app/qml/documentPage/DeleteFileDialog.qml:31
>  msgid "Are you sure you want to permanently delete this file?"
> -msgstr ""
> -
> -#: ../src/app/qml/documentPage/DeleteFileDialog.qml:30
> -msgid "Are you sure you want to permanently delete these files?"
> -msgstr ""
> -
> -#: ../src/app/qml/documentPage/DeleteFileDialog.qml:33
> +msgid_plural "Are you sure you want to permanently delete these files?"
> +msgstr[0] ""
> +msgstr[1] ""
> +
> +#: ../src/app/qml/documentPage/DeleteFileDialog.qml:36
>  #: ../src/app/qml/documentPage/DocumentPagePickModeHeader.qml:27
>  #: ../src/app/qml/pdfView/PdfViewGotoDialog.qml:52
>  msgid "Cancel"
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DeleteFileDialog.qml:38
> -#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:81
> +#: ../src/app/qml/documentPage/DeleteFileDialog.qml:41
> +#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:82
>  msgid "Delete"
>  msgstr ""
>  
> @@ -114,24 +140,30 @@
>  "folder."
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:33
> -msgid "Today, "
> +#. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
> +#. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
> +#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:35
> +#, qt-format
> +msgid "Today, %1"
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:36
> -msgid "Yesterday, "
> +#. TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
> +#. http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
> +#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:40
> +#, qt-format
> +msgid "Yesterday, %1"
>  msgstr ""
>  
>  #. TRANSLATORS: this is a datetime formatting string,
>  #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
> -#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:41
> +#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:45
>  #: ../src/app/qml/documentPage/DocumentListDelegate.qml:35
>  msgid "dddd, hh:mm"
>  msgstr ""
>  
>  #. TRANSLATORS: this is a datetime formatting string,
>  #. see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
> -#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:45
> +#: ../src/app/qml/documentPage/DocumentGridDelegate.qml:49
>  #: ../src/app/qml/documentPage/DocumentListDelegate.qml:39
>  msgid "dd-MM-yyyy hh:mm"
>  msgstr ""
> @@ -157,7 +189,7 @@
>  msgstr ""
>  
>  #: ../src/app/qml/documentPage/DocumentPage.qml:25
> -#: /tmp/tmp.VrJNVy5Wgh/po/com.ubuntu.docviewer.desktop.in.in.h:1
> +#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
>  msgid "Document Viewer"
>  msgstr ""
>  
> @@ -175,11 +207,11 @@
>  msgid "Pick"
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:51
> +#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:52
>  msgid "Select None"
>  msgstr ""
>  
> -#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:53
> +#: ../src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml:54
>  msgid "Select All"
>  msgstr ""
>  
> @@ -221,6 +253,6 @@
>  msgid "Loading..."
>  msgstr ""
>  
> -#: /tmp/tmp.VrJNVy5Wgh/po/com.ubuntu.docviewer.desktop.in.in.h:2
> +#: /home/stefano/Progetti/doc-viewer/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
>  msgid "documents;viewer;pdf;reader;"
>  msgstr ""
> 
> === modified file 'src/app/qml/common/DetailsPage.qml'
> --- src/app/qml/common/DetailsPage.qml	2015-02-13 15:30:01 +0000
> +++ src/app/qml/common/DetailsPage.qml	2015-03-04 17:51:36 +0000
> @@ -35,7 +35,7 @@
>          }
>          ListItem.Subtitled {
>              text: i18n.tr("Size")
> -            subText: Utils.printSize(file.size)
> +            subText: Utils.printSize(i18n, file.size)
>          }
>  
>          ListItem.Subtitled {
> 
> === modified file 'src/app/qml/common/utils.js'
> --- src/app/qml/common/utils.js	2015-03-03 15:41:11 +0000
> +++ src/app/qml/common/utils.js	2015-03-04 17:51:36 +0000
> @@ -16,17 +16,21 @@
>  
>  .pragma library
>  
> -function printSize(size) {
> +function printSize(i18n, size) {
>      if (size >= 1073741824)
> -        return (size / 1073741824).toFixed(2) + qsTr(" GiB");
> +        // TRANSLATORS: %1 is the size of a file, expressed in GB
> +        return i18n.tr("%1 GB").arg((size / 1073741824).toFixed(2));
>  
>      if (size >= 1048576)
> -        return (size / 1048576).toFixed(2) + qsTr(" MiB");
> +        // TRANSLATORS: %1 is the size of a file, expressed in MB
> +        return i18n.tr("%1 MB").arg((size / 1048576).toFixed(2));
>  
>      if (size >= 1024)
> -        return parseInt(size / 1024) + qsTr(" KiB");
> +        // TRANSLATORS: %1 is the size of a file, expressed in kB
> +        return i18n.tr("%1 kB").arg(parseInt(size / 1024));
>  
> -    return size + qsTr(" byte");
> +    // TRANSLATORS: %1 is the size of a file, expressed in byte
> +    return i18n.tr("%1 byte").arg(size);
>  }
>  
>  function getNameOfFile(path) {
> 
> === modified file 'src/app/qml/documentPage/DeleteFileDialog.qml'
> --- src/app/qml/documentPage/DeleteFileDialog.qml	2015-03-03 15:41:11 +0000
> +++ src/app/qml/documentPage/DeleteFileDialog.qml	2015-03-04 17:51:36 +0000
> @@ -23,11 +23,14 @@
>      id: deleteFileDialog
>  
>      property string path
> +    property int __deleteCount: documentPage.view.item.selectedItems.count
>  
>      title: path ? i18n.tr("Delete file") :
> -                  i18n.tr("Delete %1 files").arg(documentPage.view.item.selectedItems.count)
> +                  i18n.tr("Delete %1 file", "Delete %1 files", __deleteCount).arg(__deleteCount)
>      text: path ? i18n.tr("Are you sure you want to permanently delete this file?") :
> -                 i18n.tr("Are you sure you want to permanently delete these files?")
> +                 i18n.tr("Are you sure you want to permanently delete this file?",
> +                            "Are you sure you want to permanently delete these files?",
> +                            __deleteCount)
>  

I think the second case ("Are you sure you want to permanently delete these files?") would need to include the actual number as a %1 variable, and also use plural forms. Depending on the language, if it's got more than 2 plural forms, the translation needs to be different depending on the number of things we're talking about.

>      Button {
>          text: i18n.tr("Cancel")
> 
> === modified file 'src/app/qml/documentPage/DocumentGridDelegate.qml'
> --- src/app/qml/documentPage/DocumentGridDelegate.qml	2015-03-03 15:41:11 +0000
> +++ src/app/qml/documentPage/DocumentGridDelegate.qml	2015-03-04 17:51:36 +0000
> @@ -30,10 +30,14 @@
>          var diff = model.dateDiff
>  
>          if (diff < 1)
> -            return i18n.tr("Today, ") + Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat))
> +            // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
> +            // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
> +            return i18n.tr("Today, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
>  
>          if (diff < 2)
> -            return i18n.tr("Yesterday, ") + Qt.formatDateTime(date, Qt.locale().timeFormat(Locale.ShortFormat))
> +            // TRANSLATORS: %1 refers to a time formatted as Locale.ShortFormat (e.g. hh:mm). It depends on system settings.
> +            // http://qt-project.org/doc/qt-4.8/qlocale.html#FormatType-enum
> +            return i18n.tr("Yesterday, %1").arg(Qt.formatTime(date, Qt.locale().timeFormat(Locale.ShortFormat)))
>  
>          if (diff < 7)
>              // TRANSLATORS: this is a datetime formatting string,
> @@ -156,7 +160,7 @@
>                  }
>  
>                  Label {
> -                    text: Utils.printSize(model.size)
> +                    text: Utils.printSize(i18n, model.size)
>                      color: "white"
>                      fontSize: "small"
>                  }
> 
> === modified file 'src/app/qml/documentPage/DocumentListDelegate.qml'
> --- src/app/qml/documentPage/DocumentListDelegate.qml	2015-03-03 15:41:11 +0000
> +++ src/app/qml/documentPage/DocumentListDelegate.qml	2015-03-04 17:51:36 +0000
> @@ -99,7 +99,7 @@
>                  }
>  
>                  Label {
> -                    text: Utils.printSize(model.size)
> +                    text: Utils.printSize(i18n, model.size)
>                      fontSize: "small"
>                  }
>              }
> 
> === modified file 'src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml'
> --- src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml	2015-03-03 15:41:11 +0000
> +++ src/app/qml/documentPage/DocumentPageSelectionModeHeader.qml	2015-03-04 17:51:36 +0000
> @@ -16,6 +16,7 @@
>  
>  import QtQuick 2.3
>  import Ubuntu.Components 1.1
> +import Ubuntu.Components.Popups 1.0
>  
>  import "../upstreamComponents"
>  
> 


-- 
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/fix-translation-issues/+merge/251788
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-translation-issues into lp:ubuntu-docviewer-app.


References