Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63532

Support Qt translation files

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We are using this Tool already for different linter (thanks for the work @uhafner ). But currently we are working on the translation files and in a lot of PRs the adjustments are missing. So my first idea was to create a parser and transform the translation file into any other parser format this plugin likes. But as the format is really simple any maybe other user could use it to and transformation via CMake script is not such easy (due to limited regex capability), it would be nice if this plugin can this format directly.

      The formal format description is [here|https://doc.qt.io/qt-5/linguist-ts-file-format.html.]

      Example file:

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE TS>
      <TS version="2.1" language="de_DE">
      <context>
          <name>TranslatedObject</name>
          <message>
          <message>
              <source>UndefinedClass</source>
              <translation>Undefiniert</translation>
          </message>
          <message>
              <source>Other</source>
              <translation>Sonstiges</translation>
          </message>
      </context>
      <context>
          <name>TranslatedObjectWithPlurals</name>
          <message numerus="yes">
              <source>%n Warning(s)</source>
              <translation>
                  <numerusform>%n Warnung</numerusform>
                  <numerusform>%n Warnungen</numerusform>
              </translation>
          </message>
          <message numerus="yes">
              <source>%n Error(s)</source>
              <translation>
                  <numerusform>%n Fehler</numerusform>
                  <numerusform>%n Fehler</numerusform>
              </translation>
          </message>
          <message numerus="yes">
              <source>%n Info(s)</source>
              <translation>
                  <numerusform>%n Information</numerusform>
                  <numerusform>%n Informationen</numerusform>
              </translation>
          </message>
      </context>
      <context>
          <name>TranslationHints</name>
          <message>
              <source>Help</source>
              <translation type="unfinished"></translation>
          </message>
          <message>
              <source>Language</source>
              <translation type="unfinished">Sprache</translation>
          </message>
          <message>
              <source>Exit</source>
              <translation type="vanished">Beenden</translation>
          </message>
          <message>
              <source>Update</source>
              <translation type="obsolete">Aktualisieren</translation>
          </message>
          <message numerus="yes">
              <source>%n Debug(s)</source>
              <translation type="unfinished">
                  <numerusform></numerusform>
                  <numerusform></numerusform>
                  <numerusform></numerusform>
              </translation>
          </message>
      </context>
      </TS>
      

      So the plugin should scan for all `translation` tags, which contains a `type` field (the other can be ignored). Severity for all 3 possible types/categories (`unfinished`, `vanished`, `obsolete`) could be always normal, as it is never critical if something is not translated.

      Even there exists a `location` tag (a `message` can contain multiple `location` tags) I would ignore it and reference only the line in the XML file, as the issue is within the XML file and not within the code and the `location` is an optional field.

      Sorry, I have no Java development environment on my PC, otherwise I would write the extension myself :-/.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sunblack sunblack
              Reporter:
              sunblack sunblack
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: