diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index a55d5807d1d..498b137b316 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -20,22 +20,36 @@ MACRO(ADD_TRANSLATION_FILES _sources ) ENDMACRO(ADD_TRANSLATION_FILES) # make sure the output directory exists -file(MAKE_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/i18n) +FILE(MAKE_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/i18n) SET(TS_FILES qgis_ar.ts qgis_bg.ts qgis_bs.ts qgis_ca.ts qgis_cs.ts qgis_da.ts qgis_de.ts qgis_el.ts qgis_eo.ts qgis_es.ts qgis_et.ts qgis_eu.ts qgis_fi.ts qgis_fr.ts qgis_gl.ts qgis_hi.ts qgis_hu.ts qgis_id.ts qgis_is.ts qgis_it.ts qgis_ja.ts qgis_km.ts qgis_ko.ts qgis_ky.ts qgis_lt.ts qgis_lv.ts qgis_nb.ts qgis_nl.ts qgis_pl.ts qgis_pt_BR.ts qgis_pt_PT.ts qgis_ro.ts qgis_ru.ts qgis_sl.ts qgis_sv.ts qgis_tr.ts qgis_uk.ts qgis_vi.ts qgis_zh-Hans.ts qgis_zh-Hant.ts) ADD_TRANSLATION_FILES (QM_FILES ${TS_FILES}) +IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_BINARY_DIR}/org.qgis.qgis.desktop ${CMAKE_BINARY_DIR}/org.qgis.qgis.appdata.xml + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + COMMAND ${PYTHON_EXECUTABLE} + ARGS ${CMAKE_SOURCE_DIR}/scripts/ts2appinfo.py "${CMAKE_BINARY_DIR}" + COMMENT "Updating appinfo files..." + DEPENDS ${QM_FILES} + ) + + SET(MD_FILES ${CMAKE_BINARY_DIR}/org.qgis.qgis.desktop ${CMAKE_BINARY_DIR}/org.qgis.qgis.appdata.xml) + + INSTALL(FILES ${CMAKE_BINARY_DIR}/org.qgis.qgis.desktop DESTINATION share/applications) + INSTALL(FILES ${CMAKE_BINARY_DIR}/org.qgis.qgis.appdata.xml DESTINATION share/metainfo) +ENDIF (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # creating a custom target is needed to make the files build # "ALL" means that it will be run by default -ADD_CUSTOM_TARGET (translations ALL - DEPENDS ${QM_FILES}) +ADD_CUSTOM_TARGET (translations ALL DEPENDS ${QM_FILES} ${MD_FILES}) # first compile sources, then compile translations IF (WITH_DESKTOP) ADD_DEPENDENCIES (translations ${QGIS_APP_NAME}) ENDIF (WITH_DESKTOP) - INSTALL (FILES ${QM_FILES} DESTINATION ${QGIS_DATA_DIR}/i18n) diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 5ce483d5db7..8efcc02fc81 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,7 +1,3 @@ -#metadata -install(FILES org.qgis.qgis.desktop DESTINATION share/applications) -install(FILES org.qgis.qgis.appdata.xml DESTINATION share/metainfo) - #icons ## application icon install(FILES ${CMAKE_SOURCE_DIR}/images/icons/qgis_icon.svg RENAME qgis.svg DESTINATION share/icons/hicolor/scalable/apps) diff --git a/linux/org.qgis.qgis.appdata.xml b/linux/org.qgis.qgis.appdata.xml deleted file mode 100644 index e2f2038148b..00000000000 --- a/linux/org.qgis.qgis.appdata.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - org.qgis.qgis.desktop - QGIS Desktop - A Free and Open Source Geographic Information System - Um Sistema de Informação Geográfica livre e aberto - Un Sistema de Información Geográfica libre y de Código Abierto - Sistem Informasi Geografis yang Gratis dan Terbuka - - https://qgis.org/en/_static/images/about-screenshot.png - -

QGIS is a user friendly Open Source Geographic Information System (GIS) licensed under the GNU General Public License. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). It runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities.

-

O QGIS é um Sistema de Informação Geográfica (SIG) de Código Aberto licenciado segundo a Licença Pública Geral GNU. O QGIS é um projeto oficial da Open Source Geospatial Foundation (OSGeo). Funciona em Linux, Unix, Mac OSX, Windows e Android e suporta inúmeros formatos de vetores, rasters e bases de dados e funcionalidades.

-

QGIS es un Sistema de Información Geográfica (SIG) de Código Abierto licenciado bajo GNU - General Public License . QGIS es un proyecto oficial de Open Source Geospatial Foundation (OSGeo). Corre sobre Linux, Unix, Mac OSX, Windows y Android y soporta numerosos formatos y funcionalidades de datos vector, datos ráster y bases de datos.

-

QGIS adalah perangkat Sistem Informasi Geografis (SIG) Open Source yang user friendly dengan lisensi di bawah GNU General Public License. QGIS merupakan proyek tidak resmi dari Open Source Geospatial Foundation (OSGeo). QGIS dapat dijalankan pada Linux, Unix, Mac OSX, Windows dan Android, serta mendukung banyak format dan fungsionalitas data vektor, raster, dan basisdata.

- - MIT - GPL-2.0+ - https://issues.qgis.org/projects/qgis/issues/ - https://qgis.org/en/site/getinvolved/donations.html - https://qgis.org/en/site/getinvolved/faq/index.html - https://qgis.org/en/docs/index.html - https://qgis.org - - QGIS - - - - org.qgis.qgis.desktop - - qgis - -
diff --git a/linux/org.qgis.qgis.appdata.xml.in b/linux/org.qgis.qgis.appdata.xml.in new file mode 100644 index 00000000000..f95e9e837da --- /dev/null +++ b/linux/org.qgis.qgis.appdata.xml.in @@ -0,0 +1,27 @@ + + + org.qgis.qgis.desktop + QGIS Desktop + A Free and Open Source Geographic Information System + + https://qgis.org/en/_static/images/about-screenshot.png + +

QGIS is a user friendly Open Source Geographic Information System (GIS) licensed under the GNU General Public License. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). It runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities.

+ + MIT + GPL-2.0+ + https://issues.qgis.org/projects/qgis/issues/ + https://qgis.org/en/site/getinvolved/donations.html + https://qgis.org/en/site/getinvolved/faq/index.html + https://qgis.org/en/docs/index.html + https://qgis.org + + QGIS + + + + org.qgis.qgis.desktop + + qgis + +
diff --git a/linux/org.qgis.qgis.desktop b/linux/org.qgis.qgis.desktop deleted file mode 100644 index ab09667d7ab..00000000000 --- a/linux/org.qgis.qgis.desktop +++ /dev/null @@ -1,56 +0,0 @@ -[Desktop Entry] -Type=Application -Name=QGIS Desktop -GenericName=Geographic Information System -GenericName[ar]=نظام المعلومات الجغرافي -GenericName[az]=Coğrafi informasiya sistemi -GenericName[bg]=Географска информационна система -GenericName[bs]=Geografski informacioni sistem -GenericName[ca]=Sistema d'informació geogràfica -GenericName[cs]=Geografický Informační Systém -GenericName[de]=Geographisches Informationssystem -GenericName[el]=Σύστημα Γεωγραφικών Πληροφοριών -GenericName[es]=Sistema de Información Geográfica -GenericName[et]=Geoinfosüsteem -GenericName[eu]=Geografia-informazioko sistemen -GenericName[fa]=سامانه اطلاعات مکانی -GenericName[fi]=Maantieteellinen Tietojärjestelmä -GenericName[fr]=Système d'Information Géographique -GenericName[gl]=Sistema de información xeográfica -GenericName[he]=מערכת מידע גאוגרפית -GenericName[hi]=भूगोलीय_सूचना_प्रणाली -GenericName[hr]=Geografski informacijski sustav -GenericName[hu]=Földrajzi információs rendszer -GenericName[hy]=Աշխարհագրական տեղեկատվական համակարգ -GenericName[id]=Sistem informasi geografis -GenericName[is]=Landfræðilegt upplýsingakerfi -GenericName[it]=Sistema Informativo Geografico -GenericName[ka]=გეოინფორმაციული სისტემა -GenericName[lt]=Geografinė informacinė sistema -GenericName[lv]=Ģeogrāfiskā informācijas sistēma -GenericName[mk]=Географски информационен систем -GenericName[ml]=ജി.ഐ.എസ്. -GenericName[nl]=Geografisch informatiesysteem -GenericName[nn]=Geografiske informasjonssystem -GenericName[no]=Geografiske informasjonssystemer -GenericName[pl]=System Informacji Geograficznej -GenericName[pt]=Sistema de Informação Geográfica -GenericName[ro]=Sistem Informatic Geografic -GenericName[ru]=Геоинформационная система -GenericName[sh]=Geografski informacijski sistem -GenericName[sk]=Geografický informačný systém -GenericName[sl]=Geografski informacijski sistem -GenericName[sr]=Географски информациони систем -GenericName[sv]=Geografiskt Informationssystem -GenericName[th]=ระบบสารสนเทศภูมิศาสตร์ -GenericName[tr]=Coğrafi bilgi sistemi -GenericName[uk]=Геоінформаційна система -GenericName[uz]=Geografik axborot tizimi -Icon=qgis -TryExec=qgis -Exec=qgis %F -Terminal=false -StartupNotify=false -Categories=Qt;Education;Science;Geography; -MimeType=application/x-qgis-project;application/x-qgis-layer-settings;application/x-qgis-layer-definition;application/x-qgis-composer-template;image/tiff;image/jpeg;image/jp2;application/x-raster-aig;application/x-raster-ecw;application/x-raster-mrsid;application/x-mapinfo-mif;application/x-esri-shape; -Keywords=map;globe;postgis;wms;wfs;ogc;osgeo; diff --git a/linux/org.qgis.qgis.desktop.in b/linux/org.qgis.qgis.desktop.in new file mode 100644 index 00000000000..105107899f2 --- /dev/null +++ b/linux/org.qgis.qgis.desktop.in @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=QGIS Desktop +GenericName=Geographic Information System +Icon=qgis +TryExec=qgis +Exec=qgis %F +Terminal=false +StartupNotify=false +Categories=Qt;Education;Science;Geography; +MimeType=application/x-qgis-project;application/x-qgis-layer-settings;application/x-qgis-layer-definition;application/x-qgis-composer-template;image/tiff;image/jpeg;image/jp2;application/x-raster-aig;application/x-raster-ecw;application/x-raster-mrsid;application/x-mapinfo-mif;application/x-esri-shape; +Keywords=map;globe;postgis;wms;wfs;ogc;osgeo; diff --git a/scripts/appinfo2cpp.py b/scripts/appinfo2cpp.py new file mode 100644 index 00000000000..aae35151044 --- /dev/null +++ b/scripts/appinfo2cpp.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +/*************************************************************************** + appinfo2cpp.py + ------------------- + begin : 2018-09-24 + copyright : (C) 2018 by Jürgen E. Fischer + email : jef at norbit dot de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +""" + +import sys +from xml.etree import ElementTree as et + +strings = {} + +d = et.parse('linux/org.qgis.qgis.appdata.xml.in') + +r = d.getroot() +for elem in ['name', 'summary', 'description']: + for c in r.iter(elem): + if not c.attrib: + l = list(c) + t = c.text if not l else "".join([et.tostring(x).decode("utf-8") for x in l]) + strings[t] = 1 + +f = open("linux/org.qgis.qgis.desktop.in", "r") + +for r in f.readlines(): + r = r.strip() + if r.startswith("Name="): + strings[r[5:]] = 1 + elif r.startswith("GenericName="): + strings[r[12:]] = 1 + +f.close() + +print(""" +/* + This is NOT a proper c++ source code. This file is only designed to be caught + by qmake and included in lupdate. It contains all translateable strings collected + by pylupdate5. +*/ +""") + +for k in strings: + k = k.replace('"', '\\"') + k = k.replace('\n', '\\n') + print("translate( \"appinfo\", \"{}\" )".format(k)) diff --git a/scripts/release.pl b/scripts/release.pl index 5943e64c72c..97378703faf 100755 --- a/scripts/release.pl +++ b/scripts/release.pl @@ -163,7 +163,7 @@ unless( $dopoint ) { print "Updating changelog...\n"; run( "scripts/create_changelog.sh", "create_changelog.sh failed" ); -run( "perl -i -pe 's##\n #' linux/org.qgis.qgis.appdata.xml", "appdata update failed" ); +run( "perl -i -pe 's##\n #' linux/org.qgis.qgis.appdata.xml.in", "appdata update failed" ); unless( $dopoint ) { run( "scripts/update-news.pl $newmajor $newminor '$newreleasename'", "could not update news" ) if $major>2 || ($major==2 && $minor>14); diff --git a/scripts/spell_check/.agignore b/scripts/spell_check/.agignore index 3d8939b00cc..bb2575cadf8 100644 --- a/scripts/spell_check/.agignore +++ b/scripts/spell_check/.agignore @@ -42,7 +42,7 @@ images/themes/default/mIconJoinHasNotUpsertOnEdit.svg images/themes/default/mIconJoinNotEditable.svg images/themes/default/mIconJoinedLayerNotEditable.svg LexerR.py -linux/org.qgis.qgis.appdata.xml +linux/org.qgis.qgis.appdata.xml.in python/plugins/MetaSearch/resources/connections-default.xml python/plugins/processing/algs/grass7/description/i.landsat.toar.txt python/plugins/processing/gui/algnames.txt diff --git a/scripts/ts2appinfo.py b/scripts/ts2appinfo.py new file mode 100644 index 00000000000..5791e743365 --- /dev/null +++ b/scripts/ts2appinfo.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +/*************************************************************************** + ts2appinfo.py + ------------------- + begin : 2018-09-24 + copyright : (C) 2018 by Jürgen E. Fischer + email : jef at norbit dot de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +""" + +import sys +import os +from glob import glob +from xml.etree import ElementTree as et +from PyQt5.QtCore import QCoreApplication, QTranslator + +strings = {} + +d = et.parse('linux/org.qgis.qgis.appdata.xml.in') + +r = d.getroot() +for elem in ['name', 'summary', 'description']: + for c in r.iter(elem): + if not c.attrib: + l = list(c) + t = c.text if not l else "".join([et.tostring(x).decode("utf-8") for x in l]) + strings[t] = {} + else: + r.remove(c) + +f = open("linux/org.qgis.qgis.desktop.in", "r") +lines = f.readlines() + +for line in lines: + line = line.strip() + for prefix in ['Name', 'GenericName']: + if line.startswith(prefix + "="): + strings[line[len(prefix) + 1:]] = {} + +f.close() + +try: + argvb = list(map(os.fsencode, sys.argv)) +except AttributeError: + argvb = sys.argv + +app = QCoreApplication(argvb) + +for qm in glob(sys.argv[1] + "/output/i18n/qgis_*.qm"): + translator = QTranslator() + translator.load(qm) + + lang = qm[len(sys.argv[1] + "/output/i18n/qgis_"):-3] + + for s in strings: + translation = translator.translate("appinfo", s, "") + if translation in [s, '']: + continue + strings[s][lang] = translation + +for elem in ['name', 'summary', 'description']: + for c in r.iter(elem): + if c.attrib: + continue + + l = list(c) + s = c.text if not l else "".join([et.tostring(x).decode("utf-8") for x in l]) + + for lang in strings[s]: + e = et.Element(elem, attrib={"xml:lang": lang}) + e.text = strings[s][lang] + e.tail = c.tail + r.append(e) + +d.write(sys.argv[1] + "/org.qgis.qgis.appdata.xml", encoding="UTF-8", xml_declaration=True) + +f = open(sys.argv[1] + "/org.qgis.qgis.desktop", "w") + +for line in lines: + skip = False + for prefix in ['Name', 'GenericName']: + if line.startswith(prefix + "="): + skip = True + f.write(line) + + t = line.strip()[len(prefix) + 1:] + for lang in strings[t]: + f.write("{}[{}]={}\n".format(prefix, lang, strings[t][lang])) + + elif line.startswith(prefix + "["): + skip = True + continue + + if not skip: + f.write(line) + +f.close() diff --git a/scripts/update_ts.sh b/scripts/update_ts.sh index 7e7c23ce958..bf529563164 100755 --- a/scripts/update_ts.sh +++ b/scripts/update_ts.sh @@ -39,6 +39,7 @@ cleanup() { python/plugins/*/python-i18n.{ts,cpp} \ python/plugins/processing/processing-i18n.{ts,cpp} \ src/plugins/grass/grasslabels-i18n.cpp \ + src/app/appinfo-i18n.cpp \ i18n/backup.tar \ qgis_ts.pro do @@ -165,6 +166,9 @@ perl scripts/qgm2cpp.pl >src/plugins/grass/grasslabels-i18n.cpp echo Updating processing translations perl scripts/processing2cpp.pl python/plugins/processing/processing-i18n.cpp +echo Updating appinfo files +python scripts/appinfo2cpp.py >src/app/appinfo-i18n.cpp + echo Creating qmake project file $QMAKE -project -o qgis_ts.pro -nopwd $PWD/src $PWD/python $PWD/i18n $textcpp