├── src ├── tests │ ├── data │ │ ├── dir-invalid │ │ │ └── invalid.po │ │ ├── tmjobs │ │ │ └── test.tmx │ │ ├── glossary │ │ │ └── terms.tbx │ │ ├── dir-halftranslated │ │ │ └── halftranslated.po │ │ └── xliff-extractor │ │ │ └── testxliffmerge_en.xlf │ ├── CMakeLists.txt │ ├── filemetadatatest.cpp │ ├── glossarytest.cpp │ ├── gettextheadertest.cpp │ └── tmjobstest.cpp ├── common │ ├── unixhelpers.cpp │ ├── machelpers.mm │ ├── domroutines.h │ ├── stemming.h │ ├── winhelpers.cpp │ ├── headerviewmenu.h │ ├── domroutines.cpp │ ├── htmlhelpers.cpp │ ├── termlabel.h │ ├── languagelistmodel.h │ ├── fastsizehintitemdelegate.h │ ├── headerviewmenu.cpp │ ├── flowlayout.h │ ├── termlabel.cpp │ └── diff.h ├── project │ ├── projectbase.kcfgc │ ├── projectlocal.kcfgc │ ├── kde-i18n-lists.h │ ├── org.kde.lokalize.ProjectOverview.xml │ ├── projectlocal.kcfg │ ├── projectmanagerui.rc │ ├── org.kde.lokalize.Project.xml │ ├── prefs_project_local.ui │ └── updatestatsjob.h ├── scriptsui.rc ├── prefs │ ├── prefs_lokalize.kcfgc │ ├── prefs.h │ ├── prefs_general.ui │ ├── prefs_languagetool.ui │ └── prefs_pology.ui ├── version.h.cmake ├── tm │ ├── translationmemoryrui.rc │ ├── org.kde.lokalize.TranslationMemory.xml │ ├── rule.h │ ├── qaview.h │ ├── tmscanapi.h │ ├── tmmanager.h │ ├── tmentry.h │ ├── qamodel.h │ ├── managedatabases.ui │ └── dbfilesmodel.h ├── lokalize.qrc ├── filesearch │ ├── filesearchtabui.rc │ └── org.kde.lokalize.FileSearch.xml ├── languagetool │ ├── languagetoolparser.h │ ├── languagetoolgrammarerror.h │ ├── languagetoolmanager.h │ ├── languagetoolparser.cpp │ ├── languagetoolmanager.cpp │ ├── languagetoolgrammarerror.cpp │ └── languagetoolresultjob.h ├── metadata │ ├── xliffextractor.h │ ├── poextractor.h │ ├── filemetadata.h │ └── filemetadata.cpp ├── catalog │ ├── catalogcapabilities.h │ ├── gettext │ │ ├── exportplugin.cpp │ │ ├── importplugin_private.h │ │ └── gettextexport.h │ ├── state.h │ ├── alttrans.h │ ├── note.h │ ├── gettextheader.h │ ├── gettextheaderparser.h │ ├── phase.h │ ├── catalog_private.h │ ├── phase.cpp │ └── pos.h ├── tools │ ├── widgettextcaptureconfig.h │ └── widgettextcaptureconfig.cpp ├── resizewatcher.h ├── completionstorage.h ├── org.kde.lokalize.MainWindow.xml ├── noteeditor.h ├── glossary │ └── glossaryview.h ├── lokalizetabpagebase.cpp ├── syntaxhighlighter.h ├── lokalizemainwindowui.rc ├── phaseswindow.h ├── cataloglistview │ └── cataloglistview.h ├── binunitsview.h ├── kaider_findextension.ui ├── msgctxtview.h ├── mergemode │ └── mergeview.h ├── resizewatcher.cpp ├── completionstorage.cpp ├── alttransview.h └── statusbar.h ├── logo.png ├── doc ├── sync.png ├── tmview.png ├── glossary.png ├── original-diff.png ├── configure_toolbar.png ├── project_overview.png ├── configure_shortcuts.png ├── default_editor_lokalize.png └── CMakeLists.txt ├── icons ├── 16-actions-diff.png ├── 32-actions-diff.png ├── osx │ ├── Lokalize.icns │ ├── LokalizePo.icns │ ├── LokalizePot.icns │ ├── LokalizeXliff.icns │ └── Info.plist ├── 16-actions-nextpo.png ├── 16-actions-prevpo.png ├── 22-actions-nextpo.png ├── 22-actions-prevpo.png ├── 32-actions-nextpo.png ├── 32-actions-prevpo.png ├── lo32-action-diff.png ├── 16-actions-approved.png ├── 16-actions-nexterror.png ├── 16-actions-nextfuzzy.png ├── 16-actions-preverror.png ├── 16-actions-prevfuzzy.png ├── 22-actions-approved.png ├── 22-actions-nexterror.png ├── 22-actions-nextfuzzy.png ├── 22-actions-preverror.png ├── 22-actions-prevfuzzy.png ├── 32-actions-approved.png ├── 32-actions-nexterror.png ├── 32-actions-nextfuzzy.png ├── 32-actions-preverror.png ├── 32-actions-prevfuzzy.png ├── 48-actions-approved.png ├── lo16-action-nextpo.png ├── lo16-action-prevpo.png ├── lo32-action-nextpo.png ├── lo32-action-prevpo.png ├── sc-actions-approved.svgz ├── 16-actions-insert_arg.png ├── 16-actions-insert_tag.png ├── 16-actions-transsearch.png ├── 22-actions-insert_arg.png ├── 22-actions-insert_tag.png ├── 22-actions-transsearch.png ├── 32-actions-insert_arg.png ├── 32-actions-insert_tag.png ├── 32-actions-transsearch.png ├── lo16-action-insert_arg.png ├── lo16-action-insert_tag.png ├── lo16-action-nexterror.png ├── lo16-action-nextfuzzy.png ├── lo16-action-preverror.png ├── lo16-action-prevfuzzy.png ├── lo32-action-insert_arg.png ├── lo32-action-insert_tag.png ├── lo32-action-nexterror.png ├── lo32-action-nextfuzzy.png ├── lo32-action-preverror.png ├── lo32-action-prevfuzzy.png ├── sr │ ├── 16-actions-approved.png │ ├── 22-actions-approved.png │ ├── 32-actions-approved.png │ ├── 48-actions-approved.png │ ├── sc-actions-approved.svgz │ └── CMakeLists.txt ├── 16-actions-catalogmanager.png ├── 16-actions-msgid2msgstr.png ├── 16-actions-nexttemplate.png ├── 16-actions-prevtemplate.png ├── 16-actions-search2msgstr.png ├── 22-actions-catalogmanager.png ├── 22-actions-msgid2msgstr.png ├── 22-actions-nexttemplate.png ├── 22-actions-prevtemplate.png ├── 22-actions-search2msgstr.png ├── 32-actions-catalogmanager.png ├── 32-actions-msgid2msgstr.png ├── 32-actions-nexttemplate.png ├── 32-actions-prevtemplate.png ├── 32-actions-search2msgstr.png ├── global │ ├── 128-apps-lokalize.png │ ├── 32-apps-lokalize.png │ ├── 64-apps-lokalize.png │ ├── sc-apps-lokalize.svgz │ └── CMakeLists.txt ├── lo16-action-msgid2msgstr.png ├── lo16-action-nexttemplate.png ├── lo16-action-prevtemplate.png ├── lo16-action-search2msgstr.png ├── lo16-action-transsearch.png ├── lo32-action-msgid2msgstr.png ├── lo32-action-nexttemplate.png ├── lo32-action-prevtemplate.png ├── lo32-action-search2msgstr.png ├── lo32-action-transsearch.png ├── 16-actions-nextfuzzyuntrans.png ├── 16-actions-nextuntranslated.png ├── 16-actions-prevfuzzyuntrans.png ├── 16-actions-prevuntranslated.png ├── 22-actions-nextfuzzyuntrans.png ├── 22-actions-nextuntranslated.png ├── 22-actions-prevfuzzyuntrans.png ├── 22-actions-prevuntranslated.png ├── 32-actions-nextfuzzyuntrans.png ├── 32-actions-nextuntranslated.png ├── 32-actions-prevfuzzyuntrans.png ├── 32-actions-prevuntranslated.png ├── lo32-action-catalogmanager.png ├── lo16-action-nextfuzzyuntrans.png ├── lo16-action-nextuntranslated.png ├── lo16-action-prevfuzzyuntrans.png ├── lo16-action-prevuntranslated.png ├── lo32-action-nextfuzzyuntrans.png ├── lo32-action-nextuntranslated.png ├── lo32-action-prevfuzzyuntrans.png ├── lo32-action-prevuntranslated.png ├── sr@latin │ ├── 16-actions-approved.png │ ├── 22-actions-approved.png │ ├── 32-actions-approved.png │ ├── 48-actions-approved.png │ ├── sc-actions-approved.svgz │ └── CMakeLists.txt ├── sr@ijekavian │ ├── 16-actions-approved.png │ ├── 22-actions-approved.png │ ├── 32-actions-approved.png │ ├── 48-actions-approved.png │ ├── sc-actions-approved.svgz │ └── CMakeLists.txt └── sr@ijekavianlatin │ ├── 16-actions-approved.png │ ├── 22-actions-approved.png │ ├── 32-actions-approved.png │ ├── 48-actions-approved.png │ ├── sc-actions-approved.svgz │ └── CMakeLists.txt ├── po ├── it │ └── docs │ │ └── lokalize │ │ ├── sync.png │ │ ├── tmview.png │ │ ├── glossary.png │ │ ├── original-diff.png │ │ ├── project_overview.png │ │ ├── configure_toolbar.png │ │ ├── configure_shortcuts.png │ │ └── default_editor_lokalize.png ├── sr │ └── docs │ │ └── lokalize │ │ ├── sync.png │ │ ├── tmview.png │ │ ├── glossary.png │ │ ├── original-diff.png │ │ └── l10n-track └── uk │ └── docs │ └── lokalize │ ├── sync.png │ ├── tmview.png │ ├── glossary.png │ ├── original-diff.png │ ├── project_overview.png │ ├── configure_toolbar.png │ ├── configure_shortcuts.png │ └── default_editor_lokalize.png ├── config-lokalize.h.cmake ├── .git-blame-ignore-revs ├── .gitignore ├── .craft.ini ├── Messages.sh ├── autotests ├── testresources.qrc ├── CMakeLists.txt ├── faketemplate.pot ├── fakeexample.po ├── difftest.cpp ├── fakeexample_spdxcopyright.po └── test_gettextheaderparser.h ├── LICENSES ├── LicenseRef-Qt-Commercial-exception-1.0.txt ├── LicenseRef-KDE-Accepted-GPL.txt └── BSD-3-Clause.txt ├── Mainpage.dox ├── .gitlab-ci.yml ├── .vscode └── tasks.json ├── .kde-ci.yml ├── scripts └── find-gui-text.sh ├── README.md ├── cmake └── FindHUNSPELL.cmake ├── DESIGN ├── .flatpak-manifest.json ├── tests └── testxliffmerge_en.xlf └── CMakeLists.txt /src/tests/data/dir-invalid/invalid.po: -------------------------------------------------------------------------------- 1 | abc 2 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/logo.png -------------------------------------------------------------------------------- /doc/sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/sync.png -------------------------------------------------------------------------------- /doc/tmview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/tmview.png -------------------------------------------------------------------------------- /doc/glossary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/glossary.png -------------------------------------------------------------------------------- /doc/original-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/original-diff.png -------------------------------------------------------------------------------- /doc/configure_toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/configure_toolbar.png -------------------------------------------------------------------------------- /doc/project_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/project_overview.png -------------------------------------------------------------------------------- /icons/16-actions-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-diff.png -------------------------------------------------------------------------------- /icons/32-actions-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-diff.png -------------------------------------------------------------------------------- /icons/osx/Lokalize.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/osx/Lokalize.icns -------------------------------------------------------------------------------- /icons/osx/LokalizePo.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/osx/LokalizePo.icns -------------------------------------------------------------------------------- /doc/configure_shortcuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/configure_shortcuts.png -------------------------------------------------------------------------------- /icons/16-actions-nextpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-nextpo.png -------------------------------------------------------------------------------- /icons/16-actions-prevpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-prevpo.png -------------------------------------------------------------------------------- /icons/22-actions-nextpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-nextpo.png -------------------------------------------------------------------------------- /icons/22-actions-prevpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-prevpo.png -------------------------------------------------------------------------------- /icons/32-actions-nextpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-nextpo.png -------------------------------------------------------------------------------- /icons/32-actions-prevpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-prevpo.png -------------------------------------------------------------------------------- /icons/lo32-action-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-diff.png -------------------------------------------------------------------------------- /icons/osx/LokalizePot.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/osx/LokalizePot.icns -------------------------------------------------------------------------------- /icons/16-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-approved.png -------------------------------------------------------------------------------- /icons/16-actions-nexterror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-nexterror.png -------------------------------------------------------------------------------- /icons/16-actions-nextfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-nextfuzzy.png -------------------------------------------------------------------------------- /icons/16-actions-preverror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-preverror.png -------------------------------------------------------------------------------- /icons/16-actions-prevfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-prevfuzzy.png -------------------------------------------------------------------------------- /icons/22-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-approved.png -------------------------------------------------------------------------------- /icons/22-actions-nexterror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-nexterror.png -------------------------------------------------------------------------------- /icons/22-actions-nextfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-nextfuzzy.png -------------------------------------------------------------------------------- /icons/22-actions-preverror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-preverror.png -------------------------------------------------------------------------------- /icons/22-actions-prevfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-prevfuzzy.png -------------------------------------------------------------------------------- /icons/32-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-approved.png -------------------------------------------------------------------------------- /icons/32-actions-nexterror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-nexterror.png -------------------------------------------------------------------------------- /icons/32-actions-nextfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-nextfuzzy.png -------------------------------------------------------------------------------- /icons/32-actions-preverror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-preverror.png -------------------------------------------------------------------------------- /icons/32-actions-prevfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-prevfuzzy.png -------------------------------------------------------------------------------- /icons/48-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/48-actions-approved.png -------------------------------------------------------------------------------- /icons/lo16-action-nextpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-nextpo.png -------------------------------------------------------------------------------- /icons/lo16-action-prevpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-prevpo.png -------------------------------------------------------------------------------- /icons/lo32-action-nextpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-nextpo.png -------------------------------------------------------------------------------- /icons/lo32-action-prevpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-prevpo.png -------------------------------------------------------------------------------- /icons/osx/LokalizeXliff.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/osx/LokalizeXliff.icns -------------------------------------------------------------------------------- /icons/sc-actions-approved.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sc-actions-approved.svgz -------------------------------------------------------------------------------- /po/it/docs/lokalize/sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/sync.png -------------------------------------------------------------------------------- /po/it/docs/lokalize/tmview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/tmview.png -------------------------------------------------------------------------------- /po/sr/docs/lokalize/sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/sr/docs/lokalize/sync.png -------------------------------------------------------------------------------- /po/sr/docs/lokalize/tmview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/sr/docs/lokalize/tmview.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/sync.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/tmview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/tmview.png -------------------------------------------------------------------------------- /config-lokalize.h.cmake: -------------------------------------------------------------------------------- 1 | /* Defines whether we are building with dbus enabled */ 2 | #cmakedefine01 HAVE_DBUS 3 | -------------------------------------------------------------------------------- /doc/default_editor_lokalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/doc/default_editor_lokalize.png -------------------------------------------------------------------------------- /icons/16-actions-insert_arg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-insert_arg.png -------------------------------------------------------------------------------- /icons/16-actions-insert_tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-insert_tag.png -------------------------------------------------------------------------------- /icons/16-actions-transsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-transsearch.png -------------------------------------------------------------------------------- /icons/22-actions-insert_arg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-insert_arg.png -------------------------------------------------------------------------------- /icons/22-actions-insert_tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-insert_tag.png -------------------------------------------------------------------------------- /icons/22-actions-transsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-transsearch.png -------------------------------------------------------------------------------- /icons/32-actions-insert_arg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-insert_arg.png -------------------------------------------------------------------------------- /icons/32-actions-insert_tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-insert_tag.png -------------------------------------------------------------------------------- /icons/32-actions-transsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-transsearch.png -------------------------------------------------------------------------------- /icons/lo16-action-insert_arg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-insert_arg.png -------------------------------------------------------------------------------- /icons/lo16-action-insert_tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-insert_tag.png -------------------------------------------------------------------------------- /icons/lo16-action-nexterror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-nexterror.png -------------------------------------------------------------------------------- /icons/lo16-action-nextfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-nextfuzzy.png -------------------------------------------------------------------------------- /icons/lo16-action-preverror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-preverror.png -------------------------------------------------------------------------------- /icons/lo16-action-prevfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-prevfuzzy.png -------------------------------------------------------------------------------- /icons/lo32-action-insert_arg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-insert_arg.png -------------------------------------------------------------------------------- /icons/lo32-action-insert_tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-insert_tag.png -------------------------------------------------------------------------------- /icons/lo32-action-nexterror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-nexterror.png -------------------------------------------------------------------------------- /icons/lo32-action-nextfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-nextfuzzy.png -------------------------------------------------------------------------------- /icons/lo32-action-preverror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-preverror.png -------------------------------------------------------------------------------- /icons/lo32-action-prevfuzzy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-prevfuzzy.png -------------------------------------------------------------------------------- /icons/sr/16-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr/16-actions-approved.png -------------------------------------------------------------------------------- /icons/sr/22-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr/22-actions-approved.png -------------------------------------------------------------------------------- /icons/sr/32-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr/32-actions-approved.png -------------------------------------------------------------------------------- /icons/sr/48-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr/48-actions-approved.png -------------------------------------------------------------------------------- /po/it/docs/lokalize/glossary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/glossary.png -------------------------------------------------------------------------------- /po/sr/docs/lokalize/glossary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/sr/docs/lokalize/glossary.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/glossary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/glossary.png -------------------------------------------------------------------------------- /icons/16-actions-catalogmanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-catalogmanager.png -------------------------------------------------------------------------------- /icons/16-actions-msgid2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-msgid2msgstr.png -------------------------------------------------------------------------------- /icons/16-actions-nexttemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-nexttemplate.png -------------------------------------------------------------------------------- /icons/16-actions-prevtemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-prevtemplate.png -------------------------------------------------------------------------------- /icons/16-actions-search2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-search2msgstr.png -------------------------------------------------------------------------------- /icons/22-actions-catalogmanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-catalogmanager.png -------------------------------------------------------------------------------- /icons/22-actions-msgid2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-msgid2msgstr.png -------------------------------------------------------------------------------- /icons/22-actions-nexttemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-nexttemplate.png -------------------------------------------------------------------------------- /icons/22-actions-prevtemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-prevtemplate.png -------------------------------------------------------------------------------- /icons/22-actions-search2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-search2msgstr.png -------------------------------------------------------------------------------- /icons/32-actions-catalogmanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-catalogmanager.png -------------------------------------------------------------------------------- /icons/32-actions-msgid2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-msgid2msgstr.png -------------------------------------------------------------------------------- /icons/32-actions-nexttemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-nexttemplate.png -------------------------------------------------------------------------------- /icons/32-actions-prevtemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-prevtemplate.png -------------------------------------------------------------------------------- /icons/32-actions-search2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-search2msgstr.png -------------------------------------------------------------------------------- /icons/global/128-apps-lokalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/global/128-apps-lokalize.png -------------------------------------------------------------------------------- /icons/global/32-apps-lokalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/global/32-apps-lokalize.png -------------------------------------------------------------------------------- /icons/global/64-apps-lokalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/global/64-apps-lokalize.png -------------------------------------------------------------------------------- /icons/global/sc-apps-lokalize.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/global/sc-apps-lokalize.svgz -------------------------------------------------------------------------------- /icons/lo16-action-msgid2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-msgid2msgstr.png -------------------------------------------------------------------------------- /icons/lo16-action-nexttemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-nexttemplate.png -------------------------------------------------------------------------------- /icons/lo16-action-prevtemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-prevtemplate.png -------------------------------------------------------------------------------- /icons/lo16-action-search2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-search2msgstr.png -------------------------------------------------------------------------------- /icons/lo16-action-transsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-transsearch.png -------------------------------------------------------------------------------- /icons/lo32-action-msgid2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-msgid2msgstr.png -------------------------------------------------------------------------------- /icons/lo32-action-nexttemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-nexttemplate.png -------------------------------------------------------------------------------- /icons/lo32-action-prevtemplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-prevtemplate.png -------------------------------------------------------------------------------- /icons/lo32-action-search2msgstr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-search2msgstr.png -------------------------------------------------------------------------------- /icons/lo32-action-transsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-transsearch.png -------------------------------------------------------------------------------- /icons/sr/sc-actions-approved.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr/sc-actions-approved.svgz -------------------------------------------------------------------------------- /icons/16-actions-nextfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-nextfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/16-actions-nextuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-nextuntranslated.png -------------------------------------------------------------------------------- /icons/16-actions-prevfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-prevfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/16-actions-prevuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/16-actions-prevuntranslated.png -------------------------------------------------------------------------------- /icons/22-actions-nextfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-nextfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/22-actions-nextuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-nextuntranslated.png -------------------------------------------------------------------------------- /icons/22-actions-prevfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-prevfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/22-actions-prevuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/22-actions-prevuntranslated.png -------------------------------------------------------------------------------- /icons/32-actions-nextfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-nextfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/32-actions-nextuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-nextuntranslated.png -------------------------------------------------------------------------------- /icons/32-actions-prevfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-prevfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/32-actions-prevuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/32-actions-prevuntranslated.png -------------------------------------------------------------------------------- /icons/lo32-action-catalogmanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-catalogmanager.png -------------------------------------------------------------------------------- /po/it/docs/lokalize/original-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/original-diff.png -------------------------------------------------------------------------------- /po/sr/docs/lokalize/original-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/sr/docs/lokalize/original-diff.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/original-diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/original-diff.png -------------------------------------------------------------------------------- /icons/lo16-action-nextfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-nextfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/lo16-action-nextuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-nextuntranslated.png -------------------------------------------------------------------------------- /icons/lo16-action-prevfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-prevfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/lo16-action-prevuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo16-action-prevuntranslated.png -------------------------------------------------------------------------------- /icons/lo32-action-nextfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-nextfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/lo32-action-nextuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-nextuntranslated.png -------------------------------------------------------------------------------- /icons/lo32-action-prevfuzzyuntrans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-prevfuzzyuntrans.png -------------------------------------------------------------------------------- /icons/lo32-action-prevuntranslated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/lo32-action-prevuntranslated.png -------------------------------------------------------------------------------- /icons/sr@latin/16-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@latin/16-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@latin/22-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@latin/22-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@latin/32-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@latin/32-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@latin/48-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@latin/48-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@latin/sc-actions-approved.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@latin/sc-actions-approved.svgz -------------------------------------------------------------------------------- /po/it/docs/lokalize/project_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/project_overview.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/project_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/project_overview.png -------------------------------------------------------------------------------- /icons/sr@ijekavian/16-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavian/16-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@ijekavian/22-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavian/22-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@ijekavian/32-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavian/32-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@ijekavian/48-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavian/48-actions-approved.png -------------------------------------------------------------------------------- /po/it/docs/lokalize/configure_toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/configure_toolbar.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/configure_toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/configure_toolbar.png -------------------------------------------------------------------------------- /icons/sr@ijekavian/sc-actions-approved.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavian/sc-actions-approved.svgz -------------------------------------------------------------------------------- /po/it/docs/lokalize/configure_shortcuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/configure_shortcuts.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/configure_shortcuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/configure_shortcuts.png -------------------------------------------------------------------------------- /icons/sr@ijekavianlatin/16-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavianlatin/16-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@ijekavianlatin/22-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavianlatin/22-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@ijekavianlatin/32-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavianlatin/32-actions-approved.png -------------------------------------------------------------------------------- /icons/sr@ijekavianlatin/48-actions-approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavianlatin/48-actions-approved.png -------------------------------------------------------------------------------- /po/it/docs/lokalize/default_editor_lokalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/it/docs/lokalize/default_editor_lokalize.png -------------------------------------------------------------------------------- /po/uk/docs/lokalize/default_editor_lokalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/po/uk/docs/lokalize/default_editor_lokalize.png -------------------------------------------------------------------------------- /icons/sr@ijekavianlatin/sc-actions-approved.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KDE/lokalize/HEAD/icons/sr@ijekavianlatin/sc-actions-approved.svgz -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # clang-format 2 | 2ca28539e96d032fd6851a645b96fe4e5f9a6dbf 3 | # astyle reformat 4 | 052e647bbab8026808fb3e3dd1cdf1365c4d3aaa 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .clang-format 2 | .clangd 3 | compile_commands.json 4 | CMakeLists.txt.user 5 | 6 | .cache/ 7 | build/ 8 | 9 | Session.vim 10 | -------------------------------------------------------------------------------- /.craft.ini: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: None 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | [BlueprintSettings] 5 | kde/kdesdk/lokalize.packageAppx=True 6 | -------------------------------------------------------------------------------- /src/common/unixhelpers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | QString fullUserName() 5 | { 6 | return QString::fromUtf8(getlogin()); 7 | } 8 | -------------------------------------------------------------------------------- /src/project/projectbase.kcfgc: -------------------------------------------------------------------------------- 1 | File=projectbase.kcfg 2 | ClassName=ProjectBase 3 | Singleton=false 4 | Mutators=true 5 | GlobalEnums=true 6 | UseEnumTypes=true 7 | -------------------------------------------------------------------------------- /src/project/projectlocal.kcfgc: -------------------------------------------------------------------------------- 1 | File=projectlocal.kcfg 2 | ClassName=ProjectLocal 3 | Singleton=false 4 | Mutators=true 5 | GlobalEnums=true 6 | UseEnumTypes=true 7 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ########### install files ############### 2 | # 3 | kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR lokalize) 4 | -------------------------------------------------------------------------------- /src/common/machelpers.mm: -------------------------------------------------------------------------------- 1 | #include 2 | #import 3 | 4 | QString fullUserName() 5 | { 6 | return QString::fromNSString(NSFullUserName()); 7 | } -------------------------------------------------------------------------------- /Messages.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | $EXTRACTRC `find . -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp 3 | $XGETTEXT `find . -name \*.cpp -o -name \*.h` -o $podir/lokalize.pot 4 | rm -f rc.cpp 5 | -------------------------------------------------------------------------------- /autotests/testresources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | fakeexample.po 4 | faketemplate.pot 5 | fakeexample_spdxcopyright.po 6 | 7 | 8 | -------------------------------------------------------------------------------- /icons/global/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ecm_install_icons(ICONS 2 | 32-apps-lokalize.png 3 | 64-apps-lokalize.png 4 | sc-apps-lokalize.svgz 5 | 128-apps-lokalize.png 6 | DESTINATION ${KDE_INSTALL_ICONDIR} 7 | THEME hicolor 8 | ) 9 | -------------------------------------------------------------------------------- /src/scriptsui.rc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-Qt-Commercial-exception-1.0.txt: -------------------------------------------------------------------------------- 1 | As a special exception, the copyright holder(s) give permission to link 2 | this program with the Qt Library (commercial or non-commercial edition), 3 | and distribute the resulting executable, without including the source 4 | code for the Qt library in the source distribution. 5 | -------------------------------------------------------------------------------- /src/prefs/prefs_lokalize.kcfgc: -------------------------------------------------------------------------------- 1 | # Code generation options for kconfig_compiler 2 | File=lokalize.kcfg 3 | ClassName=Settings 4 | Singleton=true 5 | Mutators=Leds,AutoSpellcheck,AltTransViewEverShownWithData,HideCompletedItems 6 | ItemAccessors=true 7 | SetUserTexts=true 8 | # will create the necessary code for setting those variables 9 | -------------------------------------------------------------------------------- /icons/sr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ECMInstallIcons) 2 | ecm_install_icons(ICONS 3 | 16-actions-approved.png 4 | 22-actions-approved.png 5 | 32-actions-approved.png 6 | 48-actions-approved.png 7 | sc-actions-approved.svgz 8 | DESTINATION ${KDE_INSTALL_DATADIR}/lokalize/icons 9 | LANG sr 10 | THEME hicolor 11 | ) 12 | -------------------------------------------------------------------------------- /icons/sr@latin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ECMInstallIcons) 2 | ecm_install_icons(ICONS 3 | 16-actions-approved.png 4 | 22-actions-approved.png 5 | 32-actions-approved.png 6 | 48-actions-approved.png 7 | sc-actions-approved.svgz 8 | DESTINATION ${KDE_INSTALL_DATADIR}/lokalize/icons 9 | LANG sr@latin 10 | THEME hicolor 11 | ) 12 | -------------------------------------------------------------------------------- /icons/sr@ijekavian/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ECMInstallIcons) 2 | ecm_install_icons(ICONS 3 | 16-actions-approved.png 4 | 22-actions-approved.png 5 | 32-actions-approved.png 6 | 48-actions-approved.png 7 | sc-actions-approved.svgz 8 | DESTINATION ${KDE_INSTALL_DATADIR}/lokalize/icons 9 | LANG sr@ijekavian 10 | THEME hicolor 11 | ) 12 | -------------------------------------------------------------------------------- /icons/sr@ijekavianlatin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(ECMInstallIcons) 2 | ecm_install_icons(ICONS 3 | 16-actions-approved.png 4 | 22-actions-approved.png 5 | 32-actions-approved.png 6 | 48-actions-approved.png 7 | sc-actions-approved.svgz 8 | DESTINATION ${KDE_INSTALL_DATADIR}/lokalize/icons 9 | LANG sr@ijekavianlatin 10 | THEME hicolor 11 | ) 12 | -------------------------------------------------------------------------------- /src/version.h.cmake: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2018 Simon Depiets 5 | SPDX-FileCopyrightText: 2007-2017 Nick Shaforostoff 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef LOKALIZE_VERSION 11 | #define LOKALIZE_VERSION "${RELEASE_SERVICE_VERSION}" 12 | #endif 13 | -------------------------------------------------------------------------------- /src/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Qt${QT_MAJOR_VERSION}Test CONFIG REQUIRED) 2 | include(ECMAddTests) 3 | 4 | ecm_add_test(projectmodeltest.cpp LINK_LIBRARIES liblokalize Qt::Test) 5 | ecm_add_test(gettextheadertest.cpp LINK_LIBRARIES liblokalize Qt::Test) 6 | ecm_add_test(filemetadatatest.cpp LINK_LIBRARIES liblokalize Qt::Test) 7 | ecm_add_test(glossarytest.cpp LINK_LIBRARIES liblokalize Qt::Test) 8 | ecm_add_test(tmjobstest.cpp LINK_LIBRARIES liblokalize Qt::Test) 9 | -------------------------------------------------------------------------------- /src/common/domroutines.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2011 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef DOMROUTINES_H 11 | #define DOMROUTINES_H 12 | 13 | #include 14 | 15 | void setText(QDomElement element, QString text); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/project/kde-i18n-lists.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2008 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef LISTS_H 11 | #define LISTS_H 12 | 13 | #include 14 | 15 | QString getMailingList(); // implementation is in project.cpp 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/tm/translationmemoryrui.rc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Main Toolbar 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/lokalize.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | editorui.rc 5 | lokalizemainwindowui.rc 6 | scriptsui.rc 7 | project/projectmanagerui.rc 8 | tm/translationmemoryrui.rc 9 | filesearch/filesearchtabui.rc 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/filesearch/filesearchtabui.rc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Main Toolbar 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #ifndef LANGUAGETOOLPARSER_H 8 | #define LANGUAGETOOLPARSER_H 9 | 10 | #include 11 | 12 | class QJsonObject; 13 | 14 | class LanguageToolParser 15 | { 16 | public: 17 | LanguageToolParser() = default; 18 | ~LanguageToolParser() = default; 19 | QString parseResult(const QJsonObject &obj, const QString &text) const; 20 | }; 21 | 22 | #endif // LANGUAGETOOLPARSER_H 23 | -------------------------------------------------------------------------------- /src/common/stemming.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef STEMMING_H 11 | #define STEMMING_H 12 | 13 | #include 14 | 15 | QString enhanceLangCode(const QString &langCode); // it -> it_IT 16 | QString stem(const QString &langCode, const QString &word); 17 | void cleanupSpellers(); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Mainpage.dox: -------------------------------------------------------------------------------- 1 | /** @mainpage Lokalize 2 | * 3 | * Lokalize is a computer-aided translation system that focuses on productivity 4 | * and performance. Lokalize applies a paragraph-by-paragraph translation 5 | * approach when translating documentation, and takes a message-by-message 6 | * approach when translating GUI components. 7 | * 8 | * This package is part of KDE, and a component of the KDE SDK module. 9 | * 10 | * Much work on Lokalize was done as part of a Google Summer of Code 2007 project by Nick Shaforostoff. 11 | */ 12 | -------------------------------------------------------------------------------- /src/common/winhelpers.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2017 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include 11 | #include 12 | #define SECURITY_WIN32 13 | #include 14 | 15 | QString fullUserName() 16 | { 17 | ushort name[100]; 18 | unsigned long size = 99; 19 | GetUserNameW((LPWSTR)name, &size); 20 | return QString::fromUtf16(name); 21 | } 22 | -------------------------------------------------------------------------------- /autotests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-3-Clause 2 | # SPDX-FileCopyrightText: Andreas Cord-Landwehr 3 | 4 | include_directories( 5 | ${CMAKE_SOURCE_DIR}/src/ 6 | ) 7 | 8 | ecm_add_test( 9 | test_gettextheaderparser.cpp 10 | test_gettextheaderparser.h 11 | testresources.qrc 12 | ${CMAKE_SOURCE_DIR}/src/catalog/gettextheaderparser.cpp 13 | LINK_LIBRARIES Qt::Core Qt::Test liblokalize 14 | TEST_NAME test_gettextheaderparser 15 | ) 16 | 17 | ecm_add_test(difftest.cpp LINK_LIBRARIES Qt::Test liblokalize) 18 | target_include_directories(difftest PRIVATE ${CMAKE_SOURCE_DIR}/src/project) 19 | -------------------------------------------------------------------------------- /src/tm/org.kde.lokalize.TranslationMemory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/metadata/xliffextractor.h: -------------------------------------------------------------------------------- 1 | /* 2 | XLIFF translation file analyzer 3 | 4 | SPDX-FileCopyrightText: 2011 Albert Astals Cid 5 | SPDX-FileCopyrightText: 2015 Nick Shaforostoff 6 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 7 | 8 | SPDX-License-Identifier: LGPL-2.1-or-later 9 | */ 10 | 11 | #ifndef XLIFFEXTRACTOR_H 12 | #define XLIFFEXTRACTOR_H 13 | 14 | #include "filemetadata.h" 15 | 16 | class XliffExtractor 17 | { 18 | public: 19 | XliffExtractor() = default; 20 | FileMetaData extract(const QString &filePath); 21 | }; 22 | 23 | #endif // XLIFFEXTRACTOR_H 24 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: None 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | include: 5 | - project: sysadmin/ci-utilities 6 | file: 7 | - /gitlab-templates/linux-qt6.yml 8 | - /gitlab-templates/linux-qt6-next.yml 9 | - /gitlab-templates/freebsd-qt6.yml 10 | - /gitlab-templates/windows-qt6.yml 11 | - /gitlab-templates/flatpak.yml 12 | - /gitlab-templates/craft-windows-x86-64-qt6.yml 13 | - /gitlab-templates/craft-windows-appx-qt6.yml 14 | - /gitlab-templates/craft-macos-x86-64-qt6.yml 15 | - /gitlab-templates/craft-macos-arm64-qt6.yml 16 | - /gitlab-templates/documentation.yml 17 | -------------------------------------------------------------------------------- /src/catalog/catalogcapabilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef CATALOGCAPABILITIES_H 11 | #define CATALOGCAPABILITIES_H 12 | 13 | enum CatalogCapabilities { 14 | KeepsNoteAuthors = 1, 15 | MultipleNotes = 2, 16 | Phases = 4, 17 | ExtendedStates = 8, 18 | Tags = 16, 19 | }; 20 | 21 | enum CatalogType { 22 | Gettext, 23 | Xliff, 24 | Ts, 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/catalog/gettext/exportplugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of KAider 3 | This file is based on the one from KBabel 4 | 5 | SPDX-FileCopyrightText: 2002-2003 Stanislav Visnovsky 6 | SPDX-FileCopyrightText: 2007 Nick Shaforostoff 7 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 8 | 9 | SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0 10 | */ 11 | 12 | #include "catalogfileplugin.h" 13 | 14 | using namespace GettextCatalog; 15 | 16 | CatalogExportPlugin::CatalogExportPlugin() 17 | { 18 | } 19 | 20 | CatalogExportPlugin::~CatalogExportPlugin() 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /autotests/faketemplate.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR This file is copyright: 3 | # This file is distributed under the same license as the Foo package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: Foo\n" 10 | "Report-Msgid-Bugs-To: https://bugs.kde.org\n" 11 | "POT-Creation-Date: 2022-08-22 00:44+0000\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | -------------------------------------------------------------------------------- /src/project/org.kde.lokalize.ProjectOverview.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/tests/data/tmjobs/test.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | Advanced colors 8 | 9 | 10 | ActivityInfo| 11 | /home/test/trunk/l10n-support/fr/summit/messages/gcompris/gcompris_qt.po 12 | Couleurs avancées 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /LICENSES/LicenseRef-KDE-Accepted-GPL.txt: -------------------------------------------------------------------------------- 1 | This library is free software; you can redistribute it and/or 2 | modify it under the terms of the GNU General Public License as 3 | published by the Free Software Foundation; either version 3 of 4 | the license or (at your option) at any later version that is 5 | accepted by the membership of KDE e.V. (or its successor 6 | approved by the membership of KDE e.V.), which shall act as a 7 | proxy as defined in Section 14 of version 3 of the license. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | -------------------------------------------------------------------------------- /src/catalog/state.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef STATE_H 11 | #define STATE_H 12 | 13 | ///@see https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#state 14 | enum TargetState { 15 | New, 16 | NeedsTranslation, 17 | NeedsL10n, 18 | NeedsAdaptation, 19 | Translated, 20 | NeedsReviewTranslation, 21 | NeedsReviewL10n, 22 | NeedsReviewAdaptation, 23 | Final, 24 | SignedOff, 25 | StateCount 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Build", 6 | "type": "shell", 7 | "command": "kde-builder", 8 | "args": [ 9 | "--no-src", 10 | "--no-include-dependencies", 11 | "--debug", 12 | "lokalize" 13 | ] 14 | }, 15 | { 16 | "label": "Build and run", 17 | "type": "shell", 18 | "command": "kde-builder", 19 | "args": [ 20 | "--run", 21 | "lokalize" 22 | ], 23 | "dependsOn": [ 24 | "Build" 25 | ] 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolgrammarerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #ifndef LANGUAGETOOLGRAMMARERROR_H 8 | #define LANGUAGETOOLGRAMMARERROR_H 9 | 10 | #include 11 | 12 | class QJsonObject; 13 | 14 | class LanguageToolGrammarError 15 | { 16 | public: 17 | LanguageToolGrammarError() = default; 18 | ~LanguageToolGrammarError() = default; 19 | 20 | QString parse(const QJsonObject &obj, const QString &text); 21 | void setTesting(bool b); 22 | 23 | private: 24 | static QStringList parseSuggestion(const QJsonObject &obj); 25 | bool mTesting = false; 26 | }; 27 | 28 | #endif // LANGUAGETOOLGRAMMARERROR_H 29 | -------------------------------------------------------------------------------- /src/common/headerviewmenu.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2015 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef HEADERVIEWMENU_H 11 | #define HEADERVIEWMENU_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | class QAction; 18 | 19 | class HeaderViewMenuHandler : public QObject 20 | { 21 | Q_OBJECT 22 | public: 23 | explicit HeaderViewMenuHandler(QHeaderView *parent); 24 | private Q_SLOTS: 25 | void headerMenuRequested(QPoint); 26 | void headerMenuActionToggled(QAction *); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /.kde-ci.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: None 2 | # SPDX-License-Identifier: CC0-1.0 3 | 4 | Dependencies: 5 | - 'on': ['@all'] 6 | 'require': 7 | 'frameworks/extra-cmake-modules': '@stable-kf6' 8 | 'frameworks/ki18n': '@stable-kf6' 9 | 'frameworks/kio': '@stable-kf6' 10 | 'frameworks/kxmlgui': '@stable-kf6' 11 | 'frameworks/knotifications': '@stable-kf6' 12 | 'frameworks/kconfig': '@stable-kf6' 13 | 'frameworks/kcoreaddons': '@stable-kf6' 14 | 'frameworks/kdoctools': '@stable-kf6' 15 | 'frameworks/sonnet': '@stable-kf6' 16 | 'frameworks/kdbusaddons': '@stable-kf6' 17 | 'frameworks/kcrash': '@stable-kf6' 18 | 'frameworks/kcolorscheme': '@stable-kf6' 19 | 20 | Options: 21 | require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows'] 22 | -------------------------------------------------------------------------------- /po/sr/docs/lokalize/l10n-track: -------------------------------------------------------------------------------- 1 | # Do not edit manually, except to remove complete lines. 2 | 3 | missing ¦configure_shortcuts.png¦ bdd15b7557e2dbb8a7158b73c7095ea5 bdd15b7557e2dbb8a7158b73c7095ea5 4 | missing ¦configure_toolbar.png¦ 87c7b7d8355480463c36f60e77b9998f 87c7b7d8355480463c36f60e77b9998f 5 | missing ¦default_editor_lokalize.png¦ e4ca2f82b6e11574d0c406d57fa488ee e4ca2f82b6e11574d0c406d57fa488ee 6 | fuzzy ¦glossary.png¦ 134fa43f493963649ba9a455260975e6 977313 7 | fuzzy ¦original-diff.png¦ a2d5dfc739cea627924cf17b92771ddc 876104 8 | missing ¦project_overview.png¦ 50df7bf4e97c72e45f7ccb2a23074ef4 50df7bf4e97c72e45f7ccb2a23074ef4 9 | fuzzy ¦sync.png¦ 70ad33a5fb9311cc8b39a8143fe28366 876104 10 | fuzzy ¦tmview.png¦ 89587c5b6ccd8eed0729c98e4e545932 965749 11 | 12 | -------------------------------------------------------------------------------- /src/common/domroutines.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2011 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include "domroutines.h" 11 | 12 | void setText(QDomElement element, QString text) 13 | { 14 | QDomNodeList children = element.childNodes(); 15 | for (int i = 0; i < children.count(); i++) { 16 | if (children.at(i).isCharacterData()) { 17 | children.at(i).toCharacterData().setData(text); 18 | text.clear(); 19 | } 20 | } 21 | 22 | if (!text.isEmpty()) 23 | element.appendChild(element.ownerDocument().createTextNode(text)); 24 | } 25 | -------------------------------------------------------------------------------- /src/tools/widgettextcaptureconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2012 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef WIDGETTEXTCAPTURECONFIG_H 11 | #define WIDGETTEXTCAPTURECONFIG_H 12 | 13 | #include 14 | 15 | class Ui_WidgetTextCapture; 16 | 17 | class WidgetTextCaptureConfig : public QDialog 18 | { 19 | Q_OBJECT 20 | public: 21 | explicit WidgetTextCaptureConfig(QWidget *parent = nullptr); 22 | ~WidgetTextCaptureConfig() override; 23 | public Q_SLOTS: 24 | void writeConfig(); 25 | 26 | private: 27 | Ui_WidgetTextCapture *const ui; 28 | }; 29 | 30 | #endif // WIDGETTEXTCAPTURECONFIG_H 31 | -------------------------------------------------------------------------------- /scripts/find-gui-text.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TEXT=$1 4 | PACKAGE=$2 5 | LOKALIZE_INSTANCES=`qdbus org.kde.lokalize*` 6 | if [ -z $LOKALIZE_INSTANCES ]; then lokalize>/dev/null 2>/dev/null & fi 7 | 8 | let COUNTER=0 9 | while [ -z $LOKALIZE_INSTANCES ]; do \ 10 | let COUNTER=$COUNTER+1 11 | if [ $COUNTER -gt 10 ]; then exit ; fi 12 | sleep 1 13 | LOKALIZE_INSTANCES=`qdbus org.kde.lokalize*` ;\ 14 | done 15 | 16 | for LOKALIZE_INSTANCE in $LOKALIZE_INSTANCES; do \ 17 | qdbus $LOKALIZE_INSTANCE /ThisIsWhatYouWant/FileSearch/0 org.kde.Lokalize.FileSearch.findGuiTextPackage "$TEXT" "$PACKAGE"; \ 18 | qdbus $LOKALIZE_INSTANCE /ThisIsWhatYouWant org.kde.Lokalize.MainWindow.showTranslationMemory; \ 19 | qdbus $LOKALIZE_INSTANCE /ThisIsWhatYouWant/TranslationMemory/0 org.kde.Lokalize.TranslationMemory.findGuiTextPackage "$TEXT" "$PACKAGE"; \ 20 | done 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lokalize 2 | [**Lokalize**](https://www.kde.org/applications/development/lokalize) is a computer-aided translation system that focuses on productivity and quality assurance. It is targeted for software translation and also integrates external conversion tools for freelance office document translation. 3 | 4 | ## Getting started 5 | * [Downloading and installing Lokalize](https://userbase.kde.org/Lokalize) on Windows or Unix 6 | * [The Lokalize Handbook](https://docs.kde.org/?application=lokalize) 7 | 8 | ## Features 9 | - Project management overview 10 | - Translation merging (synchronization) 11 | - Translation memory 12 | - Glossary 13 | - Spell-checking 14 | 15 | ## Getting in Touch 16 | * [KDE Localization web site](https://l10n.kde.org) is the platform for the KDE Translation ecosystem 17 | * [Reporting a bug](https://bugs.kde.org/enter_bug.cgi?format=guided&product=lokalize) 18 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolmanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #ifndef LANGUAGETOOLMANAGER_H 8 | #define LANGUAGETOOLMANAGER_H 9 | 10 | #include 11 | 12 | class QColor; 13 | class QNetworkAccessManager; 14 | 15 | class LanguageToolManager : public QObject 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit LanguageToolManager(QObject *parent = nullptr); 20 | ~LanguageToolManager() override = default; 21 | 22 | static LanguageToolManager *self(); 23 | 24 | QNetworkAccessManager *networkAccessManager() const; 25 | 26 | Q_REQUIRED_RESULT QString languageToolCheckPath() const; 27 | 28 | private: 29 | Q_DISABLE_COPY(LanguageToolManager) 30 | QNetworkAccessManager *mNetworkAccessManager = nullptr; 31 | }; 32 | 33 | #endif // LANGUAGETOOLMANAGER_H 34 | -------------------------------------------------------------------------------- /autotests/fakeexample.po: -------------------------------------------------------------------------------- 1 | # German translations for Foo package. 2 | # Copyright (C) 2020 This file is copyright: 3 | # This file is distributed under the same license as the kjournald package. 4 | # John Doe , 2020. 5 | # 6 | # Automatically generated, 2020. 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: foo\n" 10 | "Report-Msgid-Bugs-To: https://bugs.kde.org\n" 11 | "POT-Creation-Date: 2020-08-22 00:44+0000\n" 12 | "PO-Revision-Date: 2020-06-15 11:35+0200\n" 13 | "Last-Translator: John Doe \n" 14 | "Language-Team: German \n" 15 | "Language: de\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=2; plural=n != 1;\n" 20 | "X-Generator: Lokalize 22.04.1\n" 21 | 22 | #: browser/FilterCriteriaView.qml:26 23 | #, kde-format 24 | msgid "Expanded" 25 | msgstr "Ausgeklappt" 26 | -------------------------------------------------------------------------------- /autotests/difftest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2024 Volker Krause 3 | SPDX-License-Identifier: LGPL-2.1-or-later 4 | */ 5 | 6 | #include 7 | 8 | #include "../src/common/diff.h" 9 | #include "../src/project/project.h" 10 | 11 | using namespace Qt::Literals; 12 | 13 | class DiffTest : public QObject 14 | { 15 | Q_OBJECT 16 | private Q_SLOTS: 17 | void testDiff() 18 | { 19 | QCOMPARE(userVisibleWordDiff(u"VeryUnique FooBaz StringTest"_s, 20 | u"VeryUnique FooBaz StringTest"_s, 21 | Project::instance()->accel(), 22 | Project::instance()->markup()), 23 | "{LokalizeAdd}{/LokalizeAdd}VeryUnique FooBaz StringTest{LokalizeAdd}{/LokalizeAdd}"_L1); 24 | } 25 | }; 26 | 27 | QTEST_GUILESS_MAIN(DiffTest) 28 | 29 | #include "difftest.moc" 30 | -------------------------------------------------------------------------------- /autotests/fakeexample_spdxcopyright.po: -------------------------------------------------------------------------------- 1 | # German translations for Foo package. 2 | # Copyright (C) 2020 This file is copyright: 3 | # This file is distributed under the same license as the kjournald package. 4 | # SPDX-FileCopyrightText: 2020 John Doe 5 | # 6 | # Automatically generated, 2020. 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: foo\n" 10 | "Report-Msgid-Bugs-To: https://bugs.kde.org\n" 11 | "POT-Creation-Date: 2020-08-22 00:44+0000\n" 12 | "PO-Revision-Date: 2020-06-15 11:35+0200\n" 13 | "Last-Translator: John Doe \n" 14 | "Language-Team: German \n" 15 | "Language: de\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=2; plural=n != 1;\n" 20 | "X-Generator: Lokalize 22.04.1\n" 21 | 22 | #: browser/FilterCriteriaView.qml:26 23 | #, kde-format 24 | msgid "Expanded" 25 | msgstr "Ausgeklappt" 26 | -------------------------------------------------------------------------------- /src/project/projectlocal.kcfg: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Approver 18 | 19 | 20 | true 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/tm/rule.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2011 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef QARULE_H 11 | #define QARULE_H 12 | 13 | #include 14 | 15 | class QRegularExpression; 16 | class QString; 17 | 18 | struct StringRule { 19 | QVector sources; 20 | QVector targets; 21 | QVector falseFriends; 22 | }; 23 | 24 | struct Rule { 25 | QVector sources; 26 | QVector targets; 27 | QVector falseFriends; 28 | }; 29 | 30 | struct StartLen { 31 | short start{0}; 32 | short len{0}; 33 | 34 | explicit StartLen(short s = 0, short l = 0) 35 | : start(s) 36 | , len(l) 37 | { 38 | } 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolparser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #include "languagetoolparser.h" 8 | #include "languagetoolgrammarerror.h" 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | QString LanguageToolParser::parseResult(const QJsonObject &obj, const QString &text) const 16 | { 17 | QString infos; 18 | const QJsonArray array = obj.value(QLatin1String("matches")).toArray(); 19 | for (const QJsonValue ¤t : array) { 20 | if (current.type() == QJsonValue::Object) { 21 | const QJsonObject languageToolObject = current.toObject(); 22 | LanguageToolGrammarError error; 23 | infos.append(error.parse(languageToolObject, text)); 24 | } 25 | } 26 | if (infos.isEmpty()) 27 | infos = i18n("No errors"); 28 | return infos; 29 | } 30 | -------------------------------------------------------------------------------- /src/filesearch/org.kde.lokalize.FileSearch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/resizewatcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2025 Finley Watson 5 | 6 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #ifndef RESIZEWATCHER_H 10 | #define RESIZEWATCHER_H 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | class QWidget; 17 | 18 | class SaveLayoutAfterResizeWatcher : public QObject 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit SaveLayoutAfterResizeWatcher(QObject *parent = nullptr); 24 | void addWidget(QWidget *widget); 25 | void removeWidget(QWidget *widget); 26 | 27 | Q_SIGNALS: 28 | void signalEditorTabNeedsLayoutSaving(); 29 | 30 | protected: 31 | bool eventFilter(QObject *watched, QEvent *event) override; 32 | 33 | private: 34 | QSet m_watchedWidgets; 35 | QTimer m_timerBetweenLastResizeAndSignalTriggered; 36 | bool m_startupPeriodFinished = false; 37 | bool m_dragInProgress = false; 38 | }; 39 | 40 | #endif // RESIZEWATCHER 41 | -------------------------------------------------------------------------------- /src/catalog/gettext/importplugin_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | This file contains parts of KBabel code 4 | 5 | SPDX-FileCopyrightText: 2002-2003 Stanislav Visnovsky 6 | 7 | 8 | SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0 9 | */ 10 | #ifndef IMPORTPLUGINPRIVATE_H 11 | #define IMPORTPLUGINPRIVATE_H 12 | 13 | #include "catalogitem.h" 14 | 15 | #include 16 | 17 | namespace GettextCatalog 18 | { 19 | class GettextStorage; 20 | 21 | class CatalogImportPluginPrivate 22 | { 23 | public: 24 | GettextStorage *_catalog; 25 | bool _updateHeader; 26 | bool _updateGeneratedFromDocbook; 27 | bool _updateCodec; 28 | bool _updateErrorList; 29 | bool _updateCatalogExtraData; 30 | 31 | bool _generatedFromDocbook; 32 | std::list _entries; 33 | std::list _obsoleteEntries; 34 | CatalogItem _header; 35 | QByteArray _codec; 36 | QList _errorList; 37 | QStringList _catalogExtraData; 38 | }; 39 | 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /autotests/test_gettextheaderparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: GPL-2.0-or-later 3 | SPDX-FileCopyrightText: 2022 Andreas Cord-Landwehr 4 | */ 5 | 6 | #ifndef TEST_GETTEXTHEADERPARSER_H 7 | #define TEST_GETTEXTHEADERPARSER_H 8 | 9 | #include 10 | 11 | class TestGetTextHeaderParser : public QObject 12 | { 13 | Q_OBJECT 14 | 15 | private Q_SLOTS: 16 | void updateLastTranslatorAddTranslator(); 17 | void updateLastTranslatorReplaceTranslator(); 18 | void updateGenericCopyrightYear(); 19 | void updateAuthorsWithNameEmail(); 20 | void updateAuthorsWithNameEmailYear(); 21 | void updateAuthorsWithNameEmailYearYear(); 22 | void updateAuthorsWithCopyrightNameEmail(); 23 | void updateAuthorsWithCopyrightYearNameEmail(); 24 | void updateAuthorsWithCopyrightYearYearNameEmail(); 25 | void updateAuthorsInitialAddition(); 26 | void updateAuthorsAddNewCopyrightOwner(); 27 | void updateAuthorsTestModifyExistingCopyrightOwner(); 28 | void updateAuthorsCopyrightText(); 29 | 30 | private: 31 | static const QString sCurrentYear; 32 | }; 33 | #endif 34 | -------------------------------------------------------------------------------- /src/project/projectmanagerui.rc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | &Go 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | &Edit 23 | 24 | 25 | 26 | Main Toolbar 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/catalog/alttrans.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef ALTTRANS_H 11 | #define ALTTRANS_H 12 | 13 | #include "catalogstring.h" 14 | 15 | struct AltTrans { 16 | ///@see https://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#alttranstype 17 | enum Type { 18 | Proposal, 19 | PreviousVersion, 20 | Rejected, 21 | Reference, 22 | Accepted, 23 | Other, 24 | }; 25 | Type type{Other}; 26 | 27 | CatalogString context; 28 | CatalogString source; 29 | CatalogString target; 30 | 31 | short score{0}; 32 | 33 | QString lang; 34 | QString origin; 35 | QString phase; 36 | 37 | explicit AltTrans(const CatalogString &c = CatalogString(), const CatalogString &s = CatalogString(), const QString &o = QString()) 38 | : context(c) 39 | , source(s) 40 | , origin(o) 41 | { 42 | } 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /cmake/FindHUNSPELL.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find HUNSPELL 2 | # Once done this will define 3 | # 4 | # HUNSPELL_FOUND - system has HUNSPELL 5 | # HUNSPELL_INCLUDE_DIRS - the HUNSPELL include directory 6 | # HUNSPELL_LIBRARIES - The libraries needed to use HUNSPELL 7 | 8 | # SPDX-FileCopyrightText: 2017 Pino Toscano 9 | # 10 | # SPDX-License-Identifier: BSD-3-Clause 11 | 12 | find_package(PkgConfig) 13 | pkg_check_modules(PKG_HUNSPELL QUIET hunspell) 14 | 15 | find_path(HUNSPELL_INCLUDE_DIRS 16 | NAMES hunspell.hxx 17 | PATH_SUFFIXES hunspell 18 | HINTS ${PKG_HUNSPELL_INCLUDE_DIRS} 19 | ) 20 | find_library(HUNSPELL_LIBRARIES 21 | NAMES ${PKG_HUNSPELL_LIBRARIES} hunspell hunspell-1.6 hunspell-1.5 hunspell-1.4 hunspell-1.3 hunspell-1.2 libhunspell 22 | HINTS ${PKG_HUNSPELL_LIBRARY_DIRS} 23 | ) 24 | 25 | include(FindPackageHandleStandardArgs) 26 | find_package_handle_standard_args(HUNSPELL 27 | REQUIRED_VARS HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIRS 28 | VERSION_VAR PKG_HUNSPELL_VERSION 29 | ) 30 | 31 | mark_as_advanced(HUNSPELL_INCLUDE_DIRS HUNSPELL_LIBRARIES) 32 | -------------------------------------------------------------------------------- /src/completionstorage.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef COMPLETIONSTORAGE_H 11 | #define COMPLETIONSTORAGE_H 12 | 13 | #include "catalog.h" 14 | 15 | #include 16 | #include 17 | 18 | class CompletionStorage 19 | { 20 | private: 21 | CompletionStorage() = default; 22 | ~CompletionStorage() = default; 23 | 24 | static CompletionStorage *_instance; 25 | static void cleanupCompletionStorage(); 26 | 27 | public: 28 | static CompletionStorage *instance(); 29 | 30 | void scanCatalog(Catalog *); 31 | QStringList makeCompletion(const QString &) const; 32 | 33 | public: 34 | const QRegularExpression rxSplit{QStringLiteral("\\W+|\\d+"), QRegularExpression::UseUnicodePropertiesOption}; 35 | 36 | private: 37 | QMap m_words; // how many occurencies a word has 38 | // QSet save which files we scanned? 39 | }; 40 | 41 | #endif // COMPLETIONSTORAGE_H 42 | -------------------------------------------------------------------------------- /src/tm/qaview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2011 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef QAVIEW_H 11 | #define QAVIEW_H 12 | 13 | #include "rule.h" 14 | 15 | #include 16 | 17 | class QaModel; 18 | class QTreeView; 19 | 20 | class QaView : public QDockWidget 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | explicit QaView(QWidget *); 26 | ~QaView(); 27 | 28 | bool loadRules(QString filename = QString()); 29 | bool saveRules(QString filename = QString()); 30 | QVector rules() const; 31 | 32 | public Q_SLOTS: 33 | void addRule(); 34 | void removeRule(); 35 | 36 | Q_SIGNALS: 37 | void rulesChanged(); 38 | 39 | private: 40 | QTreeView *const m_browser; 41 | QaModel *m_qaModel{}; 42 | QString m_filename; 43 | 44 | QVector m_rules; 45 | }; 46 | 47 | int findMatchingRule(const QVector &rules, const QString &source, const QString &target, QVector &positions); 48 | 49 | #endif // QAVIEW_H 50 | -------------------------------------------------------------------------------- /src/common/htmlhelpers.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2014 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | QString escapeWithLinks(const QString &text) 15 | { 16 | QString html; 17 | static QRegularExpression urlDetector(QStringLiteral("(https?|ftp)://[^\\s/$.?#].[^\\s]*")); 18 | QStringList parts = text.split(urlDetector); 19 | if (parts.size()) 20 | html += parts.takeFirst().toHtmlEscaped(); 21 | 22 | QRegularExpressionMatchIterator i = urlDetector.globalMatch(text); 23 | while (i.hasNext()) { 24 | QRegularExpressionMatch match = i.next(); 25 | QString word = match.captured(0); 26 | html += QStringLiteral("") + word.toHtmlEscaped() + QStringLiteral(""); 27 | if (parts.size()) 28 | html += parts.takeFirst().toHtmlEscaped(); 29 | } 30 | return html; 31 | } 32 | -------------------------------------------------------------------------------- /src/catalog/note.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef NOTE_H 11 | #define NOTE_H 12 | 13 | #include 14 | 15 | struct Note { 16 | enum Owner { 17 | General, 18 | Source, 19 | Target, 20 | }; 21 | 22 | QString content; 23 | char priority{5}; // 1 is the highest 24 | Owner annotates{General}; 25 | QString from; 26 | QString lang; 27 | 28 | explicit Note(const QString &content_ = QString()) 29 | : content(content_) 30 | { 31 | } 32 | 33 | Note(const QString &content_, char priority_, Owner annotates_, const QString &from_, const QString &lang_) 34 | : content(content_) 35 | , priority(priority_) 36 | , annotates(annotates_) 37 | , from(from_) 38 | , lang(lang_) 39 | { 40 | } 41 | 42 | bool operator<(const Note &other) const 43 | { 44 | return priority < other.priority; 45 | } 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/catalog/gettextheader.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2008-2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef GETTEXTHEADER_H 11 | #define GETTEXTHEADER_H 12 | 13 | #include 14 | 15 | class QDateTime; 16 | 17 | int numberOfPluralFormsFromHeader(const QString &header); 18 | QString GNUPluralForms(const QString &lang); 19 | 20 | QString formatGettextDate(const QDateTime &dt); 21 | 22 | void updateHeader(QString &header, 23 | QString &comment, 24 | QString &langCode, 25 | int &numberOfPluralForms, 26 | const QString &CatalogProjectId, 27 | bool generatedFromDocbook, 28 | bool belongsToProject, 29 | bool forSaving, 30 | const QString &codec); 31 | 32 | // for XLIFF 33 | int numberOfPluralFormsForLangCode(const QString &langCode); 34 | 35 | /// @returns false if author info is still empty after function finishes 36 | bool askAuthorInfoIfEmpty(); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/project/org.kde.lokalize.Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/metadata/poextractor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Gettext translation file analyzer 3 | 4 | SPDX-FileCopyrightText: 2007 Montel Laurent 5 | SPDX-FileCopyrightText: 2009 Jos van den Oever 6 | SPDX-FileCopyrightText: 2014 Nick Shaforostoff 7 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 8 | 9 | SPDX-License-Identifier: LGPL-2.1-or-later 10 | */ 11 | 12 | #ifndef POEXTRACTOR_H 13 | #define POEXTRACTOR_H 14 | 15 | #include "filemetadata.h" 16 | 17 | class POExtractor 18 | { 19 | public: 20 | POExtractor() = default; 21 | FileMetaData extract(const QString &filePath); 22 | 23 | private: 24 | void endMessage(); 25 | void handleComment(const char *data, uint32_t length); 26 | void handleLine(const char *data, uint32_t length); 27 | 28 | enum PoState { 29 | COMMENT, 30 | MSGCTXT, 31 | MSGID, 32 | MSGID_PLURAL, 33 | MSGSTR, 34 | MSGSTR_PLURAL, 35 | WHITESPACE, 36 | ERROR, 37 | }; 38 | PoState state{WHITESPACE}; 39 | int messages{0}; 40 | int untranslated{0}; 41 | int fuzzy{0}; 42 | bool isFuzzy{false}; 43 | bool isTranslated{false}; 44 | }; 45 | 46 | #endif // PLAINTEXTEXTRACTOR_H 47 | -------------------------------------------------------------------------------- /src/tests/data/glossary/terms.tbx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | test 9 | 10 | test 1 11 | 12 | 13 | synonym test 14 | 15 | 16 | 17 | 18 | test C 19 | 20 | 21 | corresponding target synonym 22 | 23 | 24 | 25 | definition 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/common/termlabel.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef TERMLABEL_H 11 | #define TERMLABEL_H 12 | 13 | #include 14 | 15 | namespace GlossaryNS 16 | { 17 | /** 18 | * flowlayout item 19 | */ 20 | class TermLabel : public QLabel // QPushButton 21 | { 22 | Q_OBJECT 23 | public: 24 | explicit TermLabel(QAction *a = nullptr) 25 | : m_action(a) 26 | { 27 | } 28 | ~TermLabel() override = default; 29 | 30 | /** 31 | * @param term is the term matched 32 | * @param entryId is a whole entry 33 | * @param capFirst whether the first letter should be capitalized 34 | */ 35 | void setText(const QString &term, const QByteArray &entryId, bool capFirst); 36 | void mousePressEvent(QMouseEvent *) override; 37 | 38 | public Q_SLOTS: 39 | void insert(); 40 | Q_SIGNALS: 41 | void insertTerm(const QString &); 42 | 43 | private: 44 | QByteArray m_entryId; 45 | bool m_capFirst{false}; 46 | QAction *const m_action; // used only for shortcut purposes 47 | }; 48 | 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /src/tests/filemetadatatest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Lokalize 3 | * 4 | * SPDX-FileCopyrightText: 2023 Johnny Jazeix 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #include "metadata/filemetadata.h" 10 | 11 | #include 12 | 13 | class FileMetaDataTest : public QObject 14 | { 15 | Q_OBJECT 16 | 17 | private Q_SLOTS: 18 | void testXliff(); 19 | }; 20 | 21 | void FileMetaDataTest::testXliff() 22 | { 23 | FileMetaData metaData = FileMetaData::extract(QFINDTESTDATA("data/xliff-extractor/testxliffmerge_en.xlf")); 24 | 25 | QCOMPARE(metaData.invalid_file, false); 26 | QCOMPARE(metaData.translated, 12); 27 | QCOMPARE(metaData.translated_reviewer, 11); 28 | QCOMPARE(metaData.translated_approver, 11); 29 | QCOMPARE(metaData.untranslated, 1); 30 | QCOMPARE(metaData.fuzzy, 1); 31 | QCOMPARE(metaData.fuzzy_reviewer, 2); 32 | QCOMPARE(metaData.fuzzy_approver, 2); 33 | QCOMPARE(metaData.lastTranslator, QString()); 34 | QCOMPARE(metaData.sourceDate, QString()); 35 | QCOMPARE(metaData.translationDate, QString()); 36 | QCOMPARE(metaData.filePath, QFINDTESTDATA("data/xliff-extractor/testxliffmerge_en.xlf")); 37 | } 38 | 39 | QTEST_GUILESS_MAIN(FileMetaDataTest) 40 | 41 | #include "filemetadatatest.moc" 42 | -------------------------------------------------------------------------------- /src/metadata/filemetadata.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2018 Karl Ove Hufthammer 5 | SPDX-FileCopyrightText: 2007-2014 Nick Shaforostoff 6 | SPDX-FileCopyrightText: 2009 Viesturs Zarins 7 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 8 | SPDX-FileCopyrightText: 2019 Alexander Potashev 9 | 10 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 11 | */ 12 | 13 | #ifndef LOKALIZE_FILEMETADATA_H 14 | #define LOKALIZE_FILEMETADATA_H 15 | 16 | #include 17 | 18 | class QDataStream; 19 | 20 | struct FileMetaData { 21 | bool invalid_file{false}; 22 | int translated{0}; 23 | int translated_reviewer{0}; 24 | int translated_approver{0}; 25 | int untranslated{0}; 26 | int fuzzy{0}; 27 | int fuzzy_reviewer{0}; 28 | int fuzzy_approver{0}; 29 | 30 | QString lastTranslator; 31 | QString sourceDate; 32 | QString translationDate; 33 | 34 | QString filePath; 35 | 36 | FileMetaData() = default; 37 | static FileMetaData extract(const QString &filePath); 38 | }; 39 | 40 | QDataStream &operator<<(QDataStream &s, const FileMetaData &d); 41 | QDataStream &operator>>(QDataStream &s, FileMetaData &d); 42 | 43 | #endif // LOKALIZE_FILEMETADATA_H 44 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolmanager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #include "languagetoolmanager.h" 8 | #include "prefs_lokalize.h" 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | LanguageToolManager::LanguageToolManager(QObject *parent) 18 | : QObject(parent) 19 | , mNetworkAccessManager(new QNetworkAccessManager(this)) 20 | { 21 | mNetworkAccessManager->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy); 22 | mNetworkAccessManager->setStrictTransportSecurityEnabled(true); 23 | mNetworkAccessManager->enableStrictTransportSecurityStore(true); 24 | } 25 | 26 | LanguageToolManager *LanguageToolManager::self() 27 | { 28 | static LanguageToolManager s_self; 29 | return &s_self; 30 | } 31 | 32 | QNetworkAccessManager *LanguageToolManager::networkAccessManager() const 33 | { 34 | return mNetworkAccessManager; 35 | } 36 | 37 | QString LanguageToolManager::languageToolCheckPath() const 38 | { 39 | return (Settings::self()->languageToolCustom() ? Settings::self()->languageToolInstancePath() : QStringLiteral("https://languagetool.org/api/v2")) 40 | + QStringLiteral("/check"); 41 | } 42 | 43 | #include "moc_languagetoolmanager.cpp" 44 | -------------------------------------------------------------------------------- /src/project/prefs_project_local.ui: -------------------------------------------------------------------------------- 1 | 2 | prefs_project_local 3 | 4 | 5 | 6 | 0 7 | 0 8 | 611 9 | 439 10 | 11 | 12 | 13 | 14 | 15 | 16 | QFormLayout::ExpandingFieldsGrow 17 | 18 | 19 | 20 | 21 | Role: 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Translator 30 | 31 | 32 | 33 | 34 | Reviewer 35 | 36 | 37 | 38 | 39 | Approver 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/project/updatestatsjob.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2018 Karl Ove Hufthammer 5 | SPDX-FileCopyrightText: 2007-2014 Nick Shaforostoff 6 | SPDX-FileCopyrightText: 2009 Viesturs Zarins 7 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 8 | SPDX-FileCopyrightText: 2019 Alexander Potashev 9 | 10 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 11 | */ 12 | 13 | #ifndef LOKALIZE_UPDATESTATSJOB_H 14 | #define LOKALIZE_UPDATESTATSJOB_H 15 | 16 | #include "metadata/filemetadata.h" 17 | 18 | #include 19 | #include 20 | 21 | class KFileItem; 22 | 23 | class UpdateStatsJob : public QObject, public QRunnable 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit UpdateStatsJob(const QList &files, QObject *owner = nullptr); 29 | ~UpdateStatsJob() override = default; 30 | 31 | int priority() const 32 | { 33 | return 35; // SEE jobs.h 34 | } 35 | 36 | void setStatus(int status); 37 | 38 | QList m_files; 39 | QList m_info; 40 | volatile int m_status{0}; // 0 = running; -1 = cancel; -2 = abort 41 | 42 | protected: 43 | void run() override; 44 | 45 | Q_SIGNALS: 46 | void done(UpdateStatsJob *); 47 | }; 48 | 49 | #endif // LOKALIZE_UPDATESTATSJOB_H 50 | -------------------------------------------------------------------------------- /src/tests/glossarytest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Lokalize 3 | * 4 | * SPDX-FileCopyrightText: 2023 Johnny Jazeix 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #include "glossary/glossary.h" 10 | 11 | #include 12 | 13 | class GlossaryTest : public QObject 14 | { 15 | Q_OBJECT 16 | 17 | private Q_SLOTS: 18 | void testLoad(); 19 | }; 20 | 21 | void GlossaryTest::testLoad() 22 | { 23 | GlossaryNS::Glossary glossary(nullptr); 24 | glossary.load(QFINDTESTDATA("data/glossary/terms.tbx")); 25 | 26 | QStringList terms = glossary.terms(QStringLiteral("test-1").toUtf8(), QStringLiteral("en-US")); 27 | QCOMPARE(terms[0], QStringLiteral("test 1")); 28 | QCOMPARE(terms[1], QStringLiteral("synonym test")); 29 | terms = glossary.terms(QStringLiteral("test-1").toUtf8(), QStringLiteral("C")); 30 | QCOMPARE(terms[0], QStringLiteral("test C")); 31 | QCOMPARE(terms[1], QStringLiteral("corresponding target synonym")); 32 | terms = glossary.terms(QStringLiteral("test-1").toUtf8(), QStringLiteral("hu")); 33 | QCOMPARE(terms.size(), 0); 34 | 35 | terms = glossary.terms(QStringLiteral("test-2").toUtf8(), QStringLiteral("hu")); 36 | QCOMPARE(terms.size(), 0); 37 | 38 | QCOMPARE(glossary.path(), QFINDTESTDATA("data/glossary/terms.tbx")); 39 | } 40 | 41 | QTEST_GUILESS_MAIN(GlossaryTest) 42 | 43 | #include "glossarytest.moc" 44 | -------------------------------------------------------------------------------- /src/tm/tmscanapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef SCANAPI_H 11 | #define SCANAPI_H 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | bool dragIsAcceptable(const QList &urls); 20 | QString shorterFilePath(const QString path); 21 | 22 | namespace TM 23 | { 24 | class ScanJob; 25 | class ScanJobFeedingBack; 26 | 27 | void purgeMissingFilesFromTM(const QStringList &urls, const QString &dbName); 28 | 29 | /// wrapper. returns gross number of jobs started 30 | int scanRecursive(const QStringList &urls, const QString &dbName); 31 | 32 | class RecursiveScanJob : public KJob 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit RecursiveScanJob(const QString &dbName, QObject *parent = nullptr); 37 | void setJobs(const QVector &jobs); 38 | void start() override; 39 | 40 | public Q_SLOTS: 41 | void scanJobFinished(ScanJobFeedingBack *); 42 | void scanJobDestroyed(); 43 | 44 | protected: 45 | bool doKill() override; 46 | 47 | private: 48 | QString m_dbName; 49 | QElapsedTimer m_time; 50 | QVector m_jobs; 51 | qulonglong m_destroyedJobs{0}; 52 | }; 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/catalog/gettextheaderparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2022 Andreas Cord-Landwehr 3 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 4 | */ 5 | 6 | #ifndef GETTEXTHEADERPARSER_H 7 | #define GETTEXTHEADERPARSER_H 8 | 9 | #include 10 | 11 | /** 12 | * @brief The GetTextHeaderParser class 13 | * 14 | * This class operates on the file header that is represented as a list of lines. 15 | * The list itself should be generated by splitting the obtained file header by newlines. 16 | */ 17 | class GetTextHeaderParser 18 | { 19 | public: 20 | static void updateLastTranslator(QStringList &headerList, const QString &authorName, const QString &authorEmail); 21 | static void updateGeneralCopyrightYear(QStringList &commentList); 22 | static void updateAuthors(QStringList &commentList, const QString &authorName, const QString &authorEmail); 23 | static QString joinAuthor(const QString &authorName, const QString &authorEmail); 24 | /** 25 | * Parse the copyright line and return updated SPDX compatible license line with updated year 26 | * 27 | * This function performs no operation if the current year (due to system time) is already present in string. 28 | * The returned line is prefixed by a "#" comment marker. 29 | */ 30 | static QString updateAuthorCopyrightLine(const QString &line); 31 | 32 | static const QString sCurrentYear; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/catalog/phase.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef PHASE_H 11 | #define PHASE_H 12 | 13 | #include "projectlocal.h" 14 | 15 | class QDate; 16 | class QString; 17 | class Catalog; 18 | 19 | struct Phase { 20 | QString name; 21 | QString process; 22 | QString company; 23 | QDate date; 24 | QString contact; 25 | QString email; 26 | QString phone; 27 | QString tool; 28 | 29 | Phase(); 30 | 31 | Phase(const Phase &rhs) = default; 32 | Phase &operator=(const Phase &rhs) = default; 33 | 34 | bool operator<(const Phase &other) const 35 | { 36 | return date < other.date; 37 | } 38 | bool operator>(const Phase &other) const 39 | { 40 | return date > other.date; 41 | } 42 | }; 43 | 44 | struct Tool { 45 | QString tool; 46 | QString name; 47 | QString version; 48 | QString company; 49 | }; 50 | 51 | const char *const *processes(); 52 | ProjectLocal::PersonRole roleForProcess(const QString &phase); 53 | enum InitOptions { 54 | ForceAdd = 1, 55 | }; 56 | ///@returns true if phase must be added to catalog 57 | bool initPhaseForCatalog(Catalog *catalog, Phase &phase, int options = 0); 58 | void generatePhaseForCatalogIfNeeded(Catalog *catalog); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/common/languagelistmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef LANGUAGELISTMODEL_H 11 | #define LANGUAGELISTMODEL_H 12 | 13 | #include 14 | 15 | class QSortFilterProxyModel; 16 | 17 | class LanguageListModel : public QStringListModel 18 | { 19 | enum ModelType { 20 | Default, 21 | WithEmptyLang, 22 | }; 23 | 24 | public: 25 | static LanguageListModel *instance(); 26 | static LanguageListModel *emptyLangInstance(); 27 | 28 | private: 29 | static LanguageListModel *_instance; 30 | static LanguageListModel *_emptyLangInstance; 31 | static void cleanupLanguageListModel(); 32 | 33 | explicit LanguageListModel(ModelType type = Default, QObject *parent = nullptr); 34 | QSortFilterProxyModel *const m_sortModel; 35 | 36 | public: 37 | QVariant data(const QModelIndex &index, int role) const override; 38 | QFlags flags(const QModelIndex &index) const override; 39 | 40 | QSortFilterProxyModel *sortModel() const 41 | { 42 | return m_sortModel; 43 | } 44 | int sortModelRowForLangCode(const QString &); 45 | QString langCodeForSortModelRow(int); 46 | }; 47 | 48 | QString getTargetLangCode(const QString &title, bool askUser = false); 49 | 50 | #endif // LANGUAGELISTMODEL_H 51 | -------------------------------------------------------------------------------- /DESIGN: -------------------------------------------------------------------------------- 1 | The most global class is 'Project'. It is a singleton and keeps project-related data/settings 2 | 'Settings' is also a singleton (src/prefs). 3 | 4 | ==LokalizeMainWindow== 5 | 'LokalizeMainWindow' is the main window with multitabs interface. 6 | Uses QMdiArea for tabbing interface, and guiFactory()->addClient()/guiFactory()->removeClient() 7 | to merge actions from tabs (editor, project overview, tm-search tab), and StatusBarProxy to deliver info from tabs. 8 | Tabs are KMainWindows + KXmlGuiCleints. 9 | 10 | ==Project Overview tab== 11 | Hacks KDirLister to merge contents from two dirs. 12 | uses kdesdk/strigi-analyzer/po to scan translation files 13 | 14 | ==Editor tab== 15 | 'EditorTab' is a dispatcher (controller) for one catalog editing window (tab). 16 | 'EditorView' is msgid/msgstr viewer/editor for it. 17 | 'MsgCtxtView', 'GlossaryView' and other QDockWidget derivatives provide specialized features. 18 | All specialized actions should go into views (QDockWidgets) or separate classes used from views. 19 | 20 | 'Catalog' is a controller+proxymodel for CatalogStorage translation files 21 | 'CatalogStorage' is interface for different storage models (QVector for gettext, QDom for xliff) 22 | 23 | ==Translation Memory== 24 | Implemented as series of jobs running in second thread (src/tm/jobs.cpp). 25 | See initDB() for database schema 26 | 27 | ==Glossary== 28 | SAX parser/generator based. Tries to preserve unknown metadata on saving when possible. 29 | 30 | 31 | API docs: 32 | http://api.kde.org/4.x-api/kdesdk-apidocs/lokalize/html/annotated.html 33 | -------------------------------------------------------------------------------- /LICENSES/BSD-3-Clause.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) . All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, 4 | are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 26 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /src/org.kde.lokalize.MainWindow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolgrammarerror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #include "languagetoolgrammarerror.h" 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | QString LanguageToolGrammarError::parse(const QJsonObject &obj, const QString &text) 15 | { 16 | QString mError = obj[QStringLiteral("message")].toString(); 17 | int mStart = obj[QStringLiteral("offset")].toInt(-1); 18 | int mLength = obj[QStringLiteral("length")].toInt(-1); 19 | QStringList mSuggestions = parseSuggestion(obj); 20 | QString result = mError; 21 | if (mLength > 0) 22 | result = result + QStringLiteral(" (") + text.mid(mStart, mLength) + QStringLiteral(")"); 23 | if (mSuggestions.count() > 0) 24 | result = result + QStringLiteral("\n") + i18n("Suggestions:") + QStringLiteral(" ") + mSuggestions.join(QStringLiteral(", ")); 25 | return result + QStringLiteral("\n\n"); 26 | } 27 | 28 | void LanguageToolGrammarError::setTesting(bool b) 29 | { 30 | mTesting = b; 31 | } 32 | 33 | QStringList LanguageToolGrammarError::parseSuggestion(const QJsonObject &obj) 34 | { 35 | QStringList lst; 36 | const QJsonArray array = obj[QStringLiteral("replacements")].toArray(); 37 | for (const QJsonValue ¤t : array) { 38 | if (current.type() == QJsonValue::Object) { 39 | const QJsonObject suggestionObject = current.toObject(); 40 | lst.append(suggestionObject[QLatin1String("value")].toString()); 41 | } 42 | } 43 | return lst; 44 | } 45 | -------------------------------------------------------------------------------- /src/tests/gettextheadertest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Lokalize 3 | * 4 | * SPDX-FileCopyrightText: 2019 Alexander Potashev 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #include "gettextheader.h" 10 | 11 | #include 12 | #include 13 | 14 | class GettextHeaderTest : public QObject 15 | { 16 | Q_OBJECT 17 | 18 | private Q_SLOTS: 19 | void testFormatDate(); 20 | }; 21 | 22 | void GettextHeaderTest::testFormatDate() 23 | { 24 | QCOMPARE(formatGettextDate(QDateTime(QDate(2006, 8, 3), QTime(7, 31, 32), Qt::UTC)), QStringLiteral("2006-08-03 07:31+0000")); 25 | QCOMPARE(formatGettextDate(QDateTime(QDate(2006, 8, 3), QTime(7, 31, 32), QTimeZone("Europe/Moscow"))), QStringLiteral("2006-08-03 07:31+0400")); 26 | QCOMPARE(formatGettextDate(QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("Europe/Moscow"))), QStringLiteral("2018-08-03 07:31+0300")); 27 | QCOMPARE(formatGettextDate(QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("America/New_York"))), QStringLiteral("2018-08-03 07:31-0400")); 28 | QCOMPARE(formatGettextDate(QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone(-14 * 3600))), QStringLiteral("2018-08-03 07:31-1400")); 29 | QCOMPARE(formatGettextDate(QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone(14 * 3600))), QStringLiteral("2018-08-03 07:31+1400")); 30 | QCOMPARE(formatGettextDate(QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("Asia/Kolkata"))), QStringLiteral("2018-08-03 07:31+0530")); 31 | } 32 | 33 | QTEST_GUILESS_MAIN(GettextHeaderTest) 34 | 35 | #include "gettextheadertest.moc" 36 | -------------------------------------------------------------------------------- /src/tm/tmmanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2011 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0 8 | */ 9 | 10 | #ifndef TMMANAGER_H 11 | #define TMMANAGER_H 12 | 13 | #include "ui_dbparams.h" 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | class QModelIndex; 21 | class QTreeView; 22 | 23 | namespace TM 24 | { 25 | /** 26 | * Window for managing Translation Memory databases 27 | */ 28 | class TMManagerWin : public KMainWindow 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit TMManagerWin(QWidget *parent = nullptr); 33 | ~TMManagerWin() = default; 34 | 35 | private Q_SLOTS: 36 | void addDir(); 37 | void addDB(); 38 | void importTMX(); 39 | void exportTMX(); 40 | void removeDB(); 41 | 42 | void initLater(); 43 | void slotItemActivated(const QModelIndex &); 44 | 45 | private: 46 | QTreeView *m_tmListWidget{}; 47 | }; 48 | 49 | class OpenDBJob; 50 | 51 | // TODO remote tms 52 | class DBPropertiesDialog : public QDialog, Ui_DBParams 53 | { 54 | Q_OBJECT 55 | public: 56 | explicit DBPropertiesDialog(QWidget *parent, const QString &name = QString()); 57 | 58 | private: 59 | void accept() override; 60 | private Q_SLOTS: 61 | void setConnectionBoxVisible(int type); 62 | void openJobDone(OpenDBJob *); 63 | void checkConnectionOptions(); 64 | void feedbackRegardingAcceptable(); 65 | 66 | private: 67 | bool m_connectionOptionsValid{}; 68 | QTimer m_checkDelayer; 69 | }; 70 | 71 | } 72 | #endif 73 | -------------------------------------------------------------------------------- /src/noteeditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef NOTEEDITOR_H 11 | #define NOTEEDITOR_H 12 | 13 | #include "note.h" 14 | 15 | #include 16 | 17 | class QStringListModel; 18 | class QLabel; 19 | class QTextBrowser; 20 | class QComboBox; 21 | class TextEdit; 22 | 23 | int displayNotes(QTextBrowser *browser, const QVector ¬es, int active = 0, bool multiple = true); 24 | QString escapeWithLinks(const QString &text); // defined in htmlhelpers.cpp 25 | 26 | class NoteEditor : public QWidget 27 | { 28 | Q_OBJECT 29 | public: 30 | explicit NoteEditor(QWidget *parent); 31 | ~NoteEditor() override 32 | { 33 | } 34 | 35 | Note note(); 36 | void setNote(const Note &, int idx); 37 | int noteIndex() 38 | { 39 | return m_idx; 40 | } 41 | 42 | void setNoteAuthors(const QStringList &); 43 | void setFromFieldVisible(bool); 44 | 45 | Q_SIGNALS: 46 | void accepted(); 47 | void rejected(); 48 | 49 | private: 50 | QComboBox *m_from{}; 51 | QLabel *m_fromLabel{}; 52 | QStringListModel *m_authors{}; 53 | TextEdit *m_edit{}; 54 | int m_idx{-1}; 55 | Note m_note{}; 56 | }; 57 | 58 | class TextEdit : public QPlainTextEdit 59 | { 60 | Q_OBJECT 61 | public: 62 | explicit TextEdit(QWidget *parent) 63 | : QPlainTextEdit(parent) 64 | { 65 | } 66 | void keyPressEvent(QKeyEvent *e) override; 67 | Q_SIGNALS: 68 | void accepted(); 69 | void rejected(); 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/glossary/glossaryview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef GLOSSARYVIEW_H 11 | #define GLOSSARYVIEW_H 12 | 13 | #include "pos.h" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | class Catalog; 20 | class FlowLayout; 21 | class QAction; 22 | class QDragEnterEvent; 23 | class QDropEvent; 24 | class QEvent; 25 | class QFrame; 26 | class QScrollArea; 27 | 28 | namespace GlossaryNS 29 | { 30 | class Glossary; 31 | 32 | #define GLOSSARY_SHORTCUTS 11 33 | class GlossaryView : public QDockWidget 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | explicit GlossaryView(QWidget *, Catalog *, const QVector &); 39 | ~GlossaryView(); 40 | 41 | public Q_SLOTS: 42 | // plural messages usually contain the same words... 43 | void slotNewEntryDisplayed(); 44 | void slotNewEntryDisplayed(DocPosition pos); // a little hacky, but... :) 45 | 46 | Q_SIGNALS: 47 | void termInsertRequested(const QString &); 48 | 49 | private: 50 | void clear(); 51 | 52 | private: 53 | QScrollArea *const m_browser; 54 | Catalog *const m_catalog; 55 | FlowLayout *const m_flowLayout; 56 | Glossary *const m_glossary; 57 | const QRegularExpression m_rxClean; 58 | const QRegularExpression m_rxSplit{QStringLiteral("\\W|\\d"), QRegularExpression::UseUnicodePropertiesOption}; 59 | int m_currentIndex{-1}; 60 | 61 | QString m_normTitle; 62 | QString m_hasInfoTitle; 63 | bool m_hasInfo{}; 64 | }; 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /src/lokalizetabpagebase.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2025 Finley Watson 5 | 6 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #include "lokalizetabpagebase.h" 10 | 11 | void LokalizeTabPageBaseNoQMainWindow::setUpdatedXMLFile() 12 | { 13 | QString localXml = guiClient()->localXMLFile(); 14 | if (QFile::exists(localXml)) { 15 | lastXMLUpdate = QFileInfo(localXml).lastModified(); 16 | } 17 | } 18 | 19 | void LokalizeTabPageBaseNoQMainWindow::reloadUpdatedXML() 20 | { 21 | QString localXml = guiClient()->localXMLFile(); 22 | if (QFile::exists(localXml)) { 23 | QDateTime newXMLUpdate = QFileInfo(localXml).lastModified(); 24 | if (newXMLUpdate > lastXMLUpdate) { 25 | lastXMLUpdate = newXMLUpdate; 26 | guiClient()->reloadXML(); 27 | } 28 | } 29 | } 30 | 31 | KXMLGUIClient *LokalizeTabPageBaseNoQMainWindow::guiClient() 32 | { 33 | return (KXMLGUIClient *)this; 34 | } 35 | 36 | void LokalizeTabPageBase::setUpdatedXMLFile() 37 | { 38 | QString localXml = guiClient()->localXMLFile(); 39 | if (QFile::exists(localXml)) { 40 | lastXMLUpdate = QFileInfo(localXml).lastModified(); 41 | } 42 | } 43 | 44 | void LokalizeTabPageBase::reloadUpdatedXML() 45 | { 46 | QString localXml = guiClient()->localXMLFile(); 47 | if (QFile::exists(localXml)) { 48 | QDateTime newXMLUpdate = QFileInfo(localXml).lastModified(); 49 | if (newXMLUpdate > lastXMLUpdate) { 50 | lastXMLUpdate = newXMLUpdate; 51 | guiClient()->reloadXML(); 52 | } 53 | } 54 | } 55 | 56 | KXMLGUIClient *LokalizeTabPageBase::guiClient() 57 | { 58 | return (KXMLGUIClient *)this; 59 | } 60 | -------------------------------------------------------------------------------- /src/common/fastsizehintitemdelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2012 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef FASTSIZEHINTITEMDELEGATE_H 11 | #define FASTSIZEHINTITEMDELEGATE_H 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | QString convertToHtml(QString string, bool italics = false); 20 | 21 | /** 22 | * remember to connect appropriate signals to reset slot 23 | * for delegate to have actual cache 24 | * 25 | * @author Nick Shaforostoff 26 | */ 27 | class FastSizeHintItemDelegate : public QItemDelegate 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | enum Roles { 33 | HtmlDisplayRole = Qt::UserRole + 5, 34 | }; 35 | 36 | explicit FastSizeHintItemDelegate(QObject *parent, const QVector &slc, const QVector &rtc); 37 | ~FastSizeHintItemDelegate() override = default; 38 | 39 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 40 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 41 | 42 | public Q_SLOTS: 43 | void reset(); 44 | 45 | private: 46 | QVector singleLineColumns; 47 | QVector richTextColumns; 48 | 49 | struct RowColumn { 50 | short row : 16; 51 | short column : 16; 52 | }; 53 | union RowColumnUnion { 54 | RowColumn index; 55 | int v; 56 | }; 57 | mutable QCache cache; 58 | 59 | KColorScheme activeScheme{QPalette::Active, KColorScheme::View}; 60 | }; 61 | #endif // FASTSIZEHINTITEMDELEGATE_H 62 | -------------------------------------------------------------------------------- /src/syntaxhighlighter.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | SPDX-FileCopyrightText: 2024 Karl Ove Hufthammer 7 | 8 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 9 | */ 10 | 11 | #ifndef HIGHLIGHTER_H 12 | #define HIGHLIGHTER_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | class QTextCharFormat; 23 | class QTextEdit; 24 | 25 | class SyntaxHighlighter : public Sonnet::Highlighter 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit SyntaxHighlighter(QTextEdit *parent); 31 | ~SyntaxHighlighter() override = default; 32 | 33 | void setApprovementState(bool a) 34 | { 35 | m_approved = a; 36 | } 37 | void setSourceString(const QString &s) 38 | { 39 | m_sourceString = s; 40 | } 41 | 42 | protected: 43 | void highlightBlock(const QString &text) override; 44 | 45 | void setMisspelled(int start, int count) override; 46 | void unsetMisspelled(int start, int count) override; 47 | 48 | private Q_SLOTS: 49 | void settingsChanged(); 50 | 51 | private: 52 | struct HighlightingRule { 53 | QRegularExpression pattern; 54 | QTextCharFormat format; 55 | }; 56 | QVector highlightingRules; 57 | QTextCharFormat tagFormat; 58 | KStatefulBrush tagBrush{KColorScheme::View, KColorScheme::VisitedText}; 59 | KStatefulBrush escapeCharBrush{KColorScheme::View, KColorScheme::PositiveText}; 60 | bool m_approved{true}; 61 | QString m_sourceString; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/tm/tmentry.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | 9 | 10 | */ 11 | 12 | #ifndef TMENTRY_H 13 | #define TMENTRY_H 14 | 15 | #include "catalogstring.h" 16 | 17 | #include 18 | #include 19 | 20 | namespace TM 21 | { 22 | 23 | struct TMEntry { 24 | CatalogString source; 25 | CatalogString target; 26 | 27 | QString ctxt; 28 | QString file; 29 | QDate date; 30 | QDate changeDate; 31 | QString changeAuthor; 32 | 33 | // the remaining are used only for results 34 | qlonglong id; 35 | short score : 16; // 100.00%==10000 36 | ushort hits : 15; 37 | bool obsolete : 1; 38 | // This is the clean dbName, not the connectionName 39 | QString dbName; 40 | 41 | QString diff; 42 | 43 | // different databases can have different settings: 44 | QString accelExpr; 45 | QString markupExpr; 46 | 47 | bool operator>(const TMEntry &other) const 48 | { 49 | if (score == other.score) { 50 | if (hits == other.hits) 51 | return date > other.date; 52 | return hits > other.hits; 53 | } 54 | return score > other.score; 55 | } 56 | bool operator<(const TMEntry &other) const 57 | { 58 | if (score == other.score) { 59 | if (hits == other.hits) 60 | return date < other.date; 61 | return hits < other.hits; 62 | } 63 | return score < other.score; 64 | } 65 | 66 | TMEntry() 67 | : id(-1) 68 | , score(0) 69 | , hits(0) 70 | , obsolete(false) 71 | { 72 | } 73 | }; 74 | 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/common/headerviewmenu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2015 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include "headerviewmenu.h" 11 | 12 | #include 13 | #include 14 | 15 | HeaderViewMenuHandler::HeaderViewMenuHandler(QHeaderView *headerView) 16 | : QObject(headerView) 17 | { 18 | headerView->setContextMenuPolicy(Qt::CustomContextMenu); 19 | connect(headerView, &QHeaderView::customContextMenuRequested, this, &HeaderViewMenuHandler::headerMenuRequested); 20 | } 21 | 22 | void HeaderViewMenuHandler::headerMenuRequested(QPoint pos) 23 | { 24 | QHeaderView *headerView = static_cast(parent()); 25 | bool allowHiding = (headerView->count() - headerView->hiddenSectionCount()) > 1; 26 | QMenu *headerMenu = new QMenu(headerView); 27 | connect(headerMenu, &QMenu::aboutToHide, headerMenu, &QMenu::deleteLater, Qt::QueuedConnection); 28 | connect(headerMenu, &QMenu::triggered, this, &HeaderViewMenuHandler::headerMenuActionToggled); 29 | for (int i = 0; i < headerView->count(); ++i) { 30 | QAction *a = headerMenu->addAction(headerView->model()->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString()); 31 | a->setData(i); 32 | a->setCheckable(true); 33 | a->setChecked(!headerView->isSectionHidden(i)); 34 | a->setEnabled(headerView->isSectionHidden(i) || allowHiding); 35 | } 36 | headerMenu->popup(headerView->mapToGlobal(pos)); 37 | } 38 | 39 | void HeaderViewMenuHandler::headerMenuActionToggled(QAction *a) 40 | { 41 | QHeaderView *headerView = static_cast(parent()); 42 | headerView->setSectionHidden(a->data().toInt(), !a->isChecked()); 43 | } 44 | 45 | #include "moc_headerviewmenu.cpp" 46 | -------------------------------------------------------------------------------- /src/tm/qamodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2011-2012 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef QAMODEL_H 11 | #define QAMODEL_H 12 | 13 | #include "rule.h" 14 | 15 | #include 16 | #include 17 | 18 | class QaModel : public QAbstractListModel 19 | { 20 | // Q_OBJECT 21 | public: 22 | enum Columns { 23 | // ID = 0, 24 | Source = 0, 25 | FalseFriend, 26 | ColumnCount, 27 | }; 28 | 29 | explicit QaModel(QObject *parent = nullptr); 30 | ~QaModel() override; 31 | 32 | bool loadRules(const QString &filename); 33 | bool saveRules(QString filename = QString()); 34 | 35 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 36 | int columnCount(const QModelIndex &parent = QModelIndex()) const override 37 | { 38 | return ColumnCount; 39 | Q_UNUSED(parent) 40 | } 41 | QVariant headerData(int section, Qt::Orientation, int role = Qt::DisplayRole) const override; 42 | Qt::ItemFlags flags(const QModelIndex &) const override; 43 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 44 | QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const override; 45 | 46 | QVector toVector() const; 47 | 48 | QModelIndex appendRow(); 49 | void removeRow(const QModelIndex &); 50 | 51 | static QaModel *instance(); 52 | static bool isInstantiated(); 53 | 54 | private: 55 | static QaModel *_instance; 56 | static void cleanupQaModel(); 57 | 58 | private: 59 | QDomDocument m_doc; 60 | QDomNodeList m_entries; 61 | QString m_filename; 62 | }; 63 | 64 | #endif // QAMODEL_H 65 | -------------------------------------------------------------------------------- /src/lokalizemainwindowui.rc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | &File 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | &Project 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Tool&views 52 | 53 | 54 | 55 | 56 | 64 | 65 | -------------------------------------------------------------------------------- /src/languagetool/languagetoolresultjob.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2019-2020 Laurent Montel 3 | 4 | SPDX-License-Identifier: GPL-2.0-or-later 5 | */ 6 | 7 | #ifndef LANGUAGETOOLRESULTJOB_H 8 | #define LANGUAGETOOLRESULTJOB_H 9 | 10 | #include 11 | 12 | class QNetworkAccessManager; 13 | class QNetworkReply; 14 | class QNetworkRequest; 15 | 16 | class LanguageToolResultJob : public QObject 17 | { 18 | Q_OBJECT 19 | public: 20 | explicit LanguageToolResultJob(QObject *parent = nullptr); 21 | ~LanguageToolResultJob() override = default; 22 | 23 | bool canStart() const; 24 | void start(); 25 | Q_REQUIRED_RESULT QStringList arguments() const; 26 | void setArguments(const QStringList &arguments); 27 | 28 | QNetworkAccessManager *networkAccessManager() const; 29 | void setNetworkAccessManager(QNetworkAccessManager *networkAccessManager); 30 | 31 | Q_REQUIRED_RESULT QString text() const; 32 | void setText(const QString &text); 33 | 34 | Q_REQUIRED_RESULT QString url() const; 35 | void setUrl(const QString &url); 36 | 37 | Q_REQUIRED_RESULT QString language() const; 38 | void setLanguage(const QString &language); 39 | 40 | Q_SIGNALS: 41 | void finished(const QString &result); 42 | void error(const QString &errorStr); 43 | 44 | private: 45 | Q_DISABLE_COPY(LanguageToolResultJob) 46 | enum class JobError { 47 | NotError, 48 | EmptyText, 49 | UrlNotDefined, 50 | NetworkManagerNotDefined, 51 | LanguageNotDefined, 52 | }; 53 | 54 | LanguageToolResultJob::JobError canStartError() const; 55 | void slotCheckGrammarFinished(); 56 | void addRequestAttribute(QNetworkRequest &request) const; 57 | void slotFinish(QNetworkReply *reply); 58 | QStringList mArguments; 59 | QString mText; 60 | QString mUrl; 61 | QString mLanguage; 62 | QNetworkAccessManager *mNetworkAccessManager = nullptr; 63 | }; 64 | 65 | #endif // LANGUAGETOOLRESULTJOB_H 66 | -------------------------------------------------------------------------------- /src/phaseswindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef PHASESWINDOW_H 11 | #define PHASESWINDOW_H 12 | 13 | #include "note.h" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | class QUrl; 20 | class QModelIndex; 21 | class QDialogButtonBox; 22 | class QStackedLayout; 23 | class QTextBrowser; 24 | class NoteEditor; 25 | class PhasesModel; 26 | class MyTreeView; 27 | class Catalog; 28 | 29 | class PhasesWindow : public QDialog 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit PhasesWindow(Catalog *catalog, QWidget *parent); 34 | ~PhasesWindow() override = default; 35 | 36 | private Q_SLOTS: 37 | void displayPhaseNotes(const QModelIndex ¤t); 38 | void addPhase(); 39 | void handleResult(); 40 | void anchorClicked(QUrl); 41 | void noteEditAccepted(); 42 | void noteEditRejected(); 43 | 44 | private: 45 | Catalog *m_catalog{}; 46 | PhasesModel *m_model{}; 47 | MyTreeView *m_view{}; 48 | QTextBrowser *m_browser{}; 49 | NoteEditor *m_editor{}; 50 | QWidget *m_noteView{}; 51 | QStackedLayout *m_stackedLayout{}; 52 | QDialogButtonBox *m_buttonBox{}; 53 | 54 | QMap> m_phaseNotes; 55 | }; 56 | 57 | #include 58 | 59 | class MyTreeView : public QTreeView 60 | { 61 | Q_OBJECT 62 | public: 63 | explicit MyTreeView(QWidget *parent) 64 | : QTreeView(parent) 65 | { 66 | } 67 | ~MyTreeView() override = default; 68 | 69 | Q_SIGNALS: 70 | void currentIndexChanged(const QModelIndex ¤t); 71 | 72 | private: 73 | void currentChanged(const QModelIndex ¤t, const QModelIndex &) override 74 | { 75 | Q_EMIT currentIndexChanged(current); 76 | } 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/catalog/gettext/gettextexport.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | This file contains parts of KBabel code 4 | 5 | SPDX-FileCopyrightText: 2002 Stanislav Visnovsky 6 | SPDX-FileCopyrightText: 2006 Nicolas GOUTTE 7 | 8 | SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0 9 | */ 10 | #ifndef GETTEXTEXPORTPLUGIN_H 11 | #define GETTEXTEXPORTPLUGIN_H 12 | 13 | #include "catalogfileplugin.h" 14 | 15 | class QTextStream; 16 | 17 | namespace GettextCatalog 18 | { 19 | class GettextStorage; 20 | 21 | /** 22 | * @brief The class for exporting GNU gettext PO files. 23 | * 24 | * As an extra information, it stores the list of all obsolete entries. 25 | */ 26 | 27 | class GettextExportPlugin 28 | { 29 | public: 30 | explicit GettextExportPlugin(short wrapWidth = 1); 31 | ConversionStatus save(QIODevice *device, const GettextStorage *catalog); 32 | 33 | private: 34 | /** 35 | * Write a PO comment to @p stream and take care that each comment lines start with a # character 36 | */ 37 | void writeComment(QTextStream &stream, const QString &comment) const; 38 | 39 | /** 40 | * Write a PO keyword (msgctxt, msgid, msgstr, msgstr_plural, msgstr[0]) and the corresponding text. 41 | * This includes wrapping the text. 42 | */ 43 | void writeKeyword(QTextStream &stream, const QString &keyword, QString text, bool containsHtml = true, bool startedWithEmptyLine = false) const; 44 | 45 | public: 46 | /** 47 | * @brief Width of the wrap 48 | * 49 | * This is the width of the wrap in characters (not bytes), including everything 50 | * (e.g. keyword, quote characters, spaces). 51 | * 52 | * - A value of 0 means no wrap (existing wrapping is removed) 53 | * - 1-3 means, wrapping is not changed 54 | * - Negative values are reserved for future extensions 55 | * @note 56 | * - Gettext's default value is 78 characters 57 | * - Very small values might not be correctly supported. 58 | */ 59 | short m_wrapWidth; 60 | }; 61 | } 62 | #endif 63 | -------------------------------------------------------------------------------- /src/cataloglistview/cataloglistview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef CATALOGLISTVIEW_H 11 | #define CATALOGLISTVIEW_H 12 | 13 | #include "mergecatalog.h" 14 | #include "pos.h" 15 | 16 | #include 17 | 18 | class QTreeView; 19 | class CatalogTreeFilterModel; 20 | class CatalogTreeModel; 21 | class Catalog; 22 | class QLineEdit; 23 | class QMenu; 24 | class QAction; 25 | class QModelIndex; 26 | class CatalogTreeView; 27 | 28 | class CatalogView : public QDockWidget 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | explicit CatalogView(QWidget *, Catalog *); 34 | ~CatalogView() override; 35 | 36 | void setEntryFilteredOut(int entry, bool filteredOut); 37 | 38 | int nextEntryNumber(); 39 | int prevEntryNumber(); 40 | int firstEntryNumber(); 41 | int lastEntryNumber(); 42 | 43 | private: 44 | int siblingEntryNumber(int step); 45 | void refreshCurrentIndex(); 46 | 47 | public Q_SLOTS: 48 | void slotNewEntryDisplayed(const DocPosition &); 49 | void setEntriesFilteredOut(bool filteredOut = false); 50 | void setFocus(); 51 | void reset(); 52 | void setMergeCatalogPointer(MergeCatalog *pointer); 53 | 54 | Q_SIGNALS: 55 | void gotoEntry(const DocPosition &, int selection); 56 | void escaped(); 57 | // signaled when the filtered position of the current entry has changed 58 | void entryProxiedPositionChanged(); 59 | 60 | private Q_SLOTS: 61 | void slotItemActivated(const QModelIndex &); 62 | void setFilterRegExp(); 63 | void fillFilterOptionsMenu(); 64 | void filterOptionToggled(QAction *); 65 | 66 | private: 67 | CatalogTreeView *const m_browser; 68 | QLineEdit *const m_lineEdit; 69 | QMenu *m_filterOptionsMenu = nullptr; 70 | CatalogTreeModel *const m_model; 71 | CatalogTreeFilterModel *const m_proxyModel; 72 | int m_lastKnownDocPosition; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/tm/managedatabases.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | TMManager 4 | 5 | 6 | 7 | 0 8 | 0 9 | 557 10 | 401 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Create 20 | 21 | 22 | 23 | 24 | 25 | 26 | Add Data 27 | 28 | 29 | 30 | 31 | 32 | 33 | Add Data from TMX 34 | 35 | 36 | 37 | 38 | 39 | 40 | Export to TMX 41 | 42 | 43 | 44 | 45 | 46 | 47 | Remove 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | false 57 | 58 | 59 | true 60 | 61 | 62 | false 63 | 64 | 65 | true 66 | 67 | 68 | false 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/common/flowlayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2004-2007 Trolltech ASA. All rights reserved. 6 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 7 | 8 | SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0 9 | */ 10 | #ifndef FLOWLAYOUT_H 11 | #define FLOWLAYOUT_H 12 | 13 | #include 14 | #include 15 | 16 | class QAction; 17 | 18 | /** 19 | * used in glossary 20 | * 21 | * copied from 'pretty' docs 22 | */ 23 | class FlowLayout : public QLayout 24 | { 25 | public: 26 | enum User { 27 | glossary, 28 | standard, 29 | }; 30 | 31 | /** 32 | * c'tor for glossary view 33 | */ 34 | explicit FlowLayout(User user = standard, 35 | QWidget *signalingWidget = nullptr, 36 | const QVector &actions = QVector(), 37 | int margin = 0, 38 | int spacing = -1); 39 | 40 | ~FlowLayout() override; 41 | 42 | void addItem(QLayoutItem *item) override; 43 | Qt::Orientations expandingDirections() const override; 44 | bool hasHeightForWidth() const override; 45 | int heightForWidth(int) const override; 46 | int count() const override; 47 | QLayoutItem *itemAt(int index) const override; 48 | QSize minimumSize() const override; 49 | void setGeometry(const QRect &rect) override; 50 | QSize sizeHint() const override; 51 | QLayoutItem *takeAt(int index) override; 52 | 53 | /** 54 | * @param term is the term matched 55 | * @param entryId is index of entry in the Glossary list 56 | * @param capFirst whether the first letter should be capitalized 57 | */ 58 | void addTerm(const QString &term, const QByteArray &entryId, bool capFirst = false); 59 | void clearTerms(); 60 | 61 | private: 62 | int doLayout(const QRect &rect, bool testOnly) const; 63 | 64 | QList itemList; 65 | int m_index{0}; // of the nearest free label ; or the next index of btn 66 | QWidget *m_receiver{nullptr}; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/binunitsview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef BINUNITSVIEW_H 11 | #define BINUNITSVIEW_H 12 | 13 | #include "pos.h" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | class BinUnitsModel; 20 | class Catalog; 21 | class MyTreeView; 22 | 23 | class BinUnitsView : public QDockWidget 24 | { 25 | Q_OBJECT 26 | public: 27 | explicit BinUnitsView(Catalog *catalog, QWidget *parent); 28 | 29 | public Q_SLOTS: 30 | void selectUnit(const QString &id); 31 | 32 | private: 33 | void contextMenuEvent(QContextMenuEvent *event) override; 34 | private Q_SLOTS: 35 | void mouseDoubleClicked(const QModelIndex &); 36 | void fileLoaded(); 37 | 38 | private: 39 | Catalog *m_catalog{}; 40 | BinUnitsModel *m_model{}; 41 | MyTreeView *m_view{}; 42 | }; 43 | 44 | class BinUnitsModel : public QAbstractListModel 45 | { 46 | Q_OBJECT 47 | public: 48 | enum BinUnitsModelColumns { 49 | SourceFilePath = 0, 50 | TargetFilePath, 51 | Approved, 52 | ColumnCount, 53 | }; 54 | 55 | BinUnitsModel(Catalog *catalog, QObject *parent); 56 | ~BinUnitsModel() override = default; 57 | 58 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; 59 | int columnCount(const QModelIndex &parent = QModelIndex()) const override 60 | { 61 | Q_UNUSED(parent); 62 | return ColumnCount; 63 | } 64 | QVariant data(const QModelIndex &, int role = Qt::DisplayRole) const override; 65 | QVariant headerData(int section, Qt::Orientation, int role = Qt::DisplayRole) const override; 66 | 67 | void setTargetFilePath(int row, const QString &); 68 | 69 | private Q_SLOTS: 70 | void fileLoaded(); 71 | void entryModified(const DocPosition &); 72 | void updateFile(QString path); 73 | 74 | private: 75 | Catalog *m_catalog; 76 | mutable QHash m_imageCache; 77 | }; 78 | 79 | #endif // BINUNITSVIEW_H 80 | -------------------------------------------------------------------------------- /src/kaider_findextension.ui: -------------------------------------------------------------------------------- 1 | 2 | findExtension 3 | 4 | 5 | 6 | 0 7 | 0 8 | 300 9 | 60 10 | 11 | 12 | 13 | 14 | 0 15 | 16 | 17 | 4 18 | 19 | 20 | 4 21 | 22 | 23 | 0 24 | 25 | 26 | 27 | 28 | 29 | 30 | Skip tags 31 | 32 | 33 | Skip markup 34 | 35 | 36 | 37 | 38 | 39 | 40 | Ignore accelerator marks 41 | 42 | 43 | Ignore accelerator marks 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Include notes 55 | 56 | 57 | 58 | 59 | 60 | 61 | Qt::Vertical 62 | 63 | 64 | 65 | 20 66 | 40 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/msgctxtview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2014 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef MSGCTXTVIEW_H 11 | #define MSGCTXTVIEW_H 12 | 13 | #include "note.h" 14 | #include "pos.h" 15 | 16 | #include 17 | #include 18 | 19 | class Catalog; 20 | class NoteEditor; 21 | class KProcess; 22 | class QTextBrowser; 23 | class QStackedLayout; 24 | 25 | class MsgCtxtView : public QDockWidget 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit MsgCtxtView(QWidget *, Catalog *); 31 | ~MsgCtxtView() override; 32 | 33 | void gotoEntry(const DocPosition &, int selection = 0); 34 | void addNote(DocPosition, const QString &text); 35 | void addTemporaryEntryNote(int entry, const QString &text); 36 | public Q_SLOTS: 37 | void removeErrorNotes(); 38 | void cleanup(); 39 | void languageTool(const QString &text); 40 | void addNoteUI(); 41 | private Q_SLOTS: 42 | void anchorClicked(const QUrl &link); 43 | void noteEditAccepted(); 44 | void noteEditRejected(); 45 | void process(); 46 | void pology(); 47 | void pologyReceivedStandardOutput(); 48 | void pologyReceivedStandardError(); 49 | void pologyHasFinished(); 50 | 51 | Q_SIGNALS: 52 | void srcFileOpenRequested(const QString &srcPath, int line); 53 | void escaped(); 54 | 55 | private: 56 | QTextBrowser *m_browser{}; 57 | NoteEditor *m_editor{}; 58 | QStackedLayout *m_stackedLayout{}; 59 | 60 | Catalog *m_catalog{}; 61 | QMap> m_unfinishedNotes; // note and its index 62 | QMultiMap m_tempNotes; 63 | QMultiMap m_pologyNotes; 64 | QMultiMap m_languageToolNotes; 65 | int m_selection{}; 66 | int m_offset{}; 67 | bool m_hasInfo{}; 68 | bool m_hasErrorNotes{}; 69 | DocPos m_entry{}; 70 | DocPos m_prevEntry{}; 71 | 72 | KProcess *m_pologyProcess{}; 73 | int m_pologyProcessInProgress{}; 74 | bool m_pologyStartedReceivingOutput{}; 75 | QString m_pologyData; 76 | 77 | static const QString BR; 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/tools/widgettextcaptureconfig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2012 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include "widgettextcaptureconfig.h" 11 | #include "ui_widgettextcaptureconfig.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | WidgetTextCaptureConfig::WidgetTextCaptureConfig(QWidget *parent) 19 | : QDialog(parent) 20 | , ui(new Ui_WidgetTextCapture) 21 | { 22 | setAttribute(Qt::WA_DeleteOnClose, true); 23 | ui->setupUi(this); 24 | setWindowTitle(i18nc("@title", "Widget Text Capture")); 25 | 26 | KConfigGroup cg(KSharedConfig::openConfig(), QStringLiteral("Development")); 27 | bool copyWidgetText = cg.readEntry("CopyWidgetText", false); 28 | QString copyWidgetTextCommand = cg.readEntry("CopyWidgetTextCommand", QString()); 29 | ui->none->setChecked(!copyWidgetText); 30 | ui->clipboard->setChecked(copyWidgetText && copyWidgetTextCommand.isEmpty()); 31 | ui->search->setChecked(copyWidgetText && !copyWidgetTextCommand.isEmpty()); 32 | 33 | connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &WidgetTextCaptureConfig::accept); 34 | connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &WidgetTextCaptureConfig::reject); 35 | connect(this, &WidgetTextCaptureConfig::accepted, this, &WidgetTextCaptureConfig::writeConfig); 36 | } 37 | 38 | WidgetTextCaptureConfig::~WidgetTextCaptureConfig() 39 | { 40 | delete ui; 41 | } 42 | 43 | void WidgetTextCaptureConfig::writeConfig() 44 | { 45 | KConfig konfig(QLatin1String("kdeglobals"), KConfig::NoGlobals); 46 | KConfigGroup cg = konfig.group(QStringLiteral("Development")); 47 | cg.writeEntry("CopyWidgetText", !ui->none->isChecked()); 48 | if (ui->clipboard->isChecked()) 49 | cg.writeEntry("CopyWidgetTextCommand", QString()); 50 | else if (ui->search->isChecked()) 51 | cg.writeEntry("CopyWidgetTextCommand", "/bin/sh /usr/share/lokalize/scripts/find-gui-text.sh \"%1\" \"%2\""); 52 | 53 | konfig.sync(); 54 | } 55 | 56 | #include "moc_widgettextcaptureconfig.cpp" 57 | -------------------------------------------------------------------------------- /src/mergemode/mergeview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef MERGEVIEW_H 11 | #define MERGEVIEW_H 12 | 13 | #include "mergecatalog.h" 14 | #include "pos.h" 15 | 16 | #include 17 | 18 | class QTextEdit; 19 | class Catalog; 20 | class MergeCatalog; 21 | class QDragEnterEvent; 22 | class QDropEvent; 23 | 24 | class MergeView : public QDockWidget 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | explicit MergeView(QWidget *, Catalog *, bool primary); 30 | ~MergeView() override; 31 | 32 | void dragEnterEvent(QDragEnterEvent *event) override; 33 | void dropEvent(QDropEvent *) override; 34 | QString filePath(); 35 | bool isModified(); 36 | 37 | private: 38 | /** 39 | * checks if there are any other plural forms waiting to be synced for current pos 40 | * @returns number of form or -1 41 | */ 42 | int pluralFormsAvailableForward(); 43 | int pluralFormsAvailableBackward(); 44 | 45 | bool event(QEvent *event) override; 46 | 47 | public Q_SLOTS: 48 | void mergeOpen(QString mergeFilePath = QString()); 49 | void cleanup(); 50 | void slotNewEntryDisplayed(const DocPosition &); 51 | void slotUpdate(const DocPosition &); 52 | 53 | void gotoNextChanged(bool approvedOnly = false); 54 | void gotoNextChangedApproved(); 55 | void gotoPrevChanged(); 56 | void mergeAccept(); 57 | void mergeAcceptAllForEmpty(); 58 | void mergeBack(); 59 | 60 | Q_SIGNALS: 61 | void signalPriorChangedAvailable(bool); 62 | void signalNextChangedAvailable(bool); 63 | void signalEntryWithMergeDisplayed(bool); 64 | 65 | void gotoEntry(const DocPosition &, int); 66 | 67 | void mergeCatalogAvailable(bool); 68 | void mergeCatalogPointerChanged(MergeCatalog *mergeCatalog); 69 | 70 | private: 71 | QTextEdit *m_browser{nullptr}; 72 | Catalog *m_baseCatalog{nullptr}; 73 | MergeCatalog *m_mergeCatalog{nullptr}; 74 | DocPosition m_pos; 75 | QString m_normTitle; 76 | QString m_hasInfoTitle; 77 | bool m_hasInfo{false}; 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /.flatpak-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "org.kde.lokalize", 3 | "branch": "master", 4 | "runtime": "org.kde.Platform", 5 | "runtime-version": "6.10", 6 | "sdk": "org.kde.Sdk", 7 | "command": "lokalize", 8 | "tags": [ 9 | "nightly" 10 | ], 11 | "desktop-file-name-suffix": " (Nightly)", 12 | "finish-args": [ 13 | "--share=ipc", 14 | "--socket=fallback-x11", 15 | "--socket=wayland", 16 | "--device=dri" 17 | ], 18 | "cleanup": [ 19 | "*.a", 20 | "*.la", 21 | "/doc", 22 | "/docs", 23 | "/include", 24 | "/lib/cmake", 25 | "/lib/pkgconfig", 26 | "/lib/x86_64-linux-gnu/cmake", 27 | "/lib/x86_64-linux-gnu/pkgconfig", 28 | "/man", 29 | "/share/cmake", 30 | "/share/doc", 31 | "/share/man", 32 | "/share/pkgconfig" 33 | ], 34 | "modules": [ 35 | { 36 | "name": "hunspell", 37 | "sources": [ 38 | { 39 | "type": "git", 40 | "url": "https://github.com/hunspell/hunspell.git" 41 | }, 42 | { 43 | "type": "script", 44 | "dest-filename": "autogen.sh", 45 | "commands": [ 46 | "AUTOMAKE=\"automake --foreign\" autoreconf -vfi" 47 | ] 48 | } 49 | ] 50 | }, 51 | { 52 | "name": "kddockwidgets", 53 | "buildsystem": "cmake-ninja", 54 | "config-opts": [ 55 | "-DKDDockWidgets_FRONTENDS=qtwidgets" 56 | ], 57 | "sources": [ 58 | { 59 | "type": "archive", 60 | "url": "https://github.com/KDAB/KDDockWidgets/releases/download/v2.3.0/kddockwidgets-2.3.0.tar.gz", 61 | "sha256": "843baf9e1812c1ab82fd81d85b57cbc0d29bb43245efeb2539039780004b1056" 62 | } 63 | ] 64 | }, 65 | { 66 | "name": "lokalize", 67 | "buildsystem": "cmake-ninja", 68 | "sources": [ 69 | { 70 | "type": "dir", 71 | "path": "." 72 | } 73 | ] 74 | } 75 | ] 76 | } 77 | -------------------------------------------------------------------------------- /src/resizewatcher.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2025 Finley Watson 5 | 6 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #include "resizewatcher.h" 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | SaveLayoutAfterResizeWatcher::SaveLayoutAfterResizeWatcher(QObject *parent) 17 | : QObject(parent) 18 | , m_timerBetweenLastResizeAndSignalTriggered(new QTimer(this)) 19 | { 20 | m_timerBetweenLastResizeAndSignalTriggered.setInterval(500); 21 | m_timerBetweenLastResizeAndSignalTriggered.callOnTimeout([this] { 22 | this->m_timerBetweenLastResizeAndSignalTriggered.stop(); 23 | if (!m_dragInProgress) 24 | Q_EMIT signalEditorTabNeedsLayoutSaving(); 25 | }); 26 | QTimer::singleShot(1000, [this] { 27 | m_startupPeriodFinished = true; 28 | }); 29 | } 30 | 31 | void SaveLayoutAfterResizeWatcher::addWidget(QWidget *widget) 32 | { 33 | if (widget && !m_watchedWidgets.contains(widget)) { 34 | m_watchedWidgets.insert(widget); 35 | widget->installEventFilter(this); 36 | } 37 | } 38 | 39 | void SaveLayoutAfterResizeWatcher::removeWidget(QWidget *widget) 40 | { 41 | if (widget && m_watchedWidgets.contains(widget)) { 42 | m_watchedWidgets.remove(widget); 43 | widget->removeEventFilter(this); 44 | } 45 | } 46 | 47 | bool SaveLayoutAfterResizeWatcher::eventFilter(QObject *watched, QEvent *event) 48 | { 49 | if (!m_watchedWidgets.contains(static_cast(watched))) 50 | return QObject::eventFilter(watched, event); 51 | switch (event->type()) { 52 | case QEvent::Resize: 53 | if (m_startupPeriodFinished && !m_dragInProgress) { 54 | m_timerBetweenLastResizeAndSignalTriggered.start(); 55 | } 56 | break; 57 | case QEvent::MouseButtonPress: 58 | m_dragInProgress = true; 59 | break; 60 | case QEvent::MouseButtonRelease: 61 | m_dragInProgress = false; 62 | QTimer::singleShot(200, [this] { 63 | Q_EMIT signalEditorTabNeedsLayoutSaving(); 64 | }); 65 | break; 66 | default: 67 | break; 68 | } 69 | return QObject::eventFilter(watched, event); 70 | } 71 | -------------------------------------------------------------------------------- /tests/testxliffmerge_en.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | test symbols 7 | 8 | 9 | test changing ids of inlined markup. And one more. 10 | 11 | 12 | test changing ids of units themseves. 13 | 14 | 15 | test changing the text 2. 16 | 17 | 18 | test no change. 19 | 20 | 21 | test adding text. 22 | 23 | 24 | test no change. 25 | 26 | 27 | test removing some tags. 28 | 29 | 30 | test adding attributes. 31 | 32 | 33 | test preserving alt-trans. 34 | 35 | 36 | test preserving alt-trans when text is changed 2. 37 | 38 | 39 | test inline position change. 40 | 41 | 42 | mrk preserving test: seg1seg2 43 | 44 | 45 | mrk1test: seg2 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/tests/data/dir-halftranslated/halftranslated.po: -------------------------------------------------------------------------------- 1 | # translation of libkworkspace.po to Russian 2 | # Copyright (C) YEAR This_file_is_part_of_KDE 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # 5 | # Leonid Kanter , 2008. 6 | # Nick Shaforostoff , 2008. 7 | # Nick Shaforostoff , 2009. 8 | # Andrey Cherepanov , 2009. 9 | # Alexander Potashev , 2019. 10 | msgid "" 11 | msgstr "" 12 | "Project-Id-Version: libkworkspace\n" 13 | "Report-Msgid-Bugs-To: https://bugs.kde.org\n" 14 | "POT-Creation-Date: 2019-05-20 03:26+0200\n" 15 | "PO-Revision-Date: 2019-06-13 08:53+0300\n" 16 | "Last-Translator: Alexander Potashev \n" 17 | "Language-Team: Russian \n" 18 | "Language: ru\n" 19 | "MIME-Version: 1.0\n" 20 | "Content-Type: text/plain; charset=UTF-8\n" 21 | "Content-Transfer-Encoding: 8bit\n" 22 | "X-Generator: Lokalize 19.07.70\n" 23 | "Plural-Forms: nplurals=4; plural=n==1 ? 3 : n%10==1 && n%100!=11 ? 0 : n" 24 | "%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" 25 | "X-Environment: kde\n" 26 | "X-Accelerator-Marker: &\n" 27 | "X-Text-Markup: kde4\n" 28 | 29 | #: kdisplaymanager.cpp:779 30 | #, kde-format 31 | msgctxt "user: ..." 32 | msgid "%1: TTY login" 33 | msgstr "%1: консольный сеанс" 34 | 35 | #: kdisplaymanager.cpp:785 36 | #, fuzzy, kde-format 37 | msgctxt "... location (TTY or X display)" 38 | msgid "Unused" 39 | msgstr "Не используется" 40 | 41 | #: kdisplaymanager.cpp:787 42 | #, kde-format 43 | msgid "X login on remote host" 44 | msgstr "" 45 | 46 | #: kdisplaymanager.cpp:788 47 | #, kde-format 48 | msgctxt "... host" 49 | msgid "X login on %1" 50 | msgstr "" 51 | 52 | #: kdisplaymanager.cpp:791 53 | #, kde-format 54 | msgctxt "user: session type" 55 | msgid "%1: %2" 56 | msgstr "%1: %2" 57 | 58 | #: kdisplaymanager.cpp:806 59 | #, kde-format 60 | msgctxt "session (location)" 61 | msgid "%1 (%2)" 62 | msgstr "%1 (%2)" 63 | 64 | #~ msgctxt "" 65 | #~ "Action that reorganizes the windows to try to have them less cluttered" 66 | #~ msgid "Unclutter Windows" 67 | #~ msgstr "Упорядочить окна" 68 | 69 | #~ msgctxt "Action that reorganizes the windows so that they are in cascade" 70 | #~ msgid "Cascade Windows" 71 | #~ msgstr "Расположить окна каскадом" 72 | 73 | #~ msgid "On All Desktops" 74 | #~ msgstr "На всех рабочих столах" 75 | 76 | #~ msgid "No Windows" 77 | #~ msgstr "Нет окон" 78 | -------------------------------------------------------------------------------- /src/completionstorage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009-2014 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include "completionstorage.h" 11 | #include "lokalize_debug.h" 12 | #include "prefs_lokalize.h" 13 | #include "project.h" 14 | 15 | #include 16 | #include 17 | 18 | CompletionStorage *CompletionStorage::_instance = nullptr; 19 | void CompletionStorage::cleanupCompletionStorage() 20 | { 21 | delete CompletionStorage::_instance; 22 | CompletionStorage::_instance = nullptr; 23 | } 24 | 25 | CompletionStorage *CompletionStorage::instance() 26 | { 27 | if (_instance == nullptr) { 28 | _instance = new CompletionStorage(); 29 | qAddPostRoutine(CompletionStorage::cleanupCompletionStorage); 30 | } 31 | return _instance; 32 | } 33 | 34 | void CompletionStorage::scanCatalog(Catalog *catalog) 35 | { 36 | if (!catalog->numberOfEntries()) 37 | return; 38 | QElapsedTimer a; 39 | a.start(); 40 | 41 | int wordCompletionLength = Settings::self()->wordCompletionLength(); 42 | wordCompletionLength += 3; // only long words 43 | 44 | QString accel = Project::instance()->accel(); 45 | 46 | DocPosition pos(0); 47 | do { 48 | QString string = catalog->targetWithTags(pos).string; 49 | string.remove(accel); 50 | 51 | const QStringList words = string.toLower().split(rxSplit, Qt::SkipEmptyParts); 52 | for (const QString &word : words) { 53 | if (word.length() < wordCompletionLength) 54 | continue; 55 | m_words[word]++; 56 | } 57 | } while (switchNext(catalog, pos)); 58 | 59 | qCWarning(LOKALIZE_LOG) << "indexed" << catalog->url() << "for word completion in" << a.elapsed() << "msecs"; 60 | } 61 | 62 | QStringList CompletionStorage::makeCompletion(const QString &word) const 63 | { 64 | if (word.isEmpty()) 65 | return QStringList(); 66 | QMultiMap hits; // we use the fact that qmap sorts it's items by keys 67 | QString cleanWord = word.toLower(); 68 | QMap::const_iterator it = m_words.lowerBound(cleanWord); 69 | while (it != m_words.constEnd() && it.key().startsWith(cleanWord)) { 70 | hits.insert(-it.value(), it.key().mid(word.length())); 71 | ++it; 72 | } 73 | return hits.values(); 74 | } 75 | -------------------------------------------------------------------------------- /src/tests/tmjobstest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Lokalize 3 | * 4 | * SPDX-FileCopyrightText: 2023 Johnny Jazeix 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #include "project.h" 10 | #include "tm/jobs.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | class TmJobsTest : public QObject 19 | { 20 | Q_OBJECT 21 | 22 | private Q_SLOTS: 23 | void testImportJob(); 24 | }; 25 | 26 | void TmJobsTest::testImportJob() 27 | { 28 | Project::instance()->setLangCode(QStringLiteral("fr")); 29 | QString tmxFile = QFINDTESTDATA("data/tmjobs/test.tmx"); 30 | QFileInfo fileInfo(tmxFile); 31 | qputenv("XDG_DATA_HOME", QFile::encodeName(fileInfo.absoluteDir().absolutePath())); 32 | QThreadPool pool; 33 | QString dbName = QStringLiteral("en_US-fr"); 34 | TM::OpenDBJob *openDBJob = new TM::OpenDBJob(dbName); 35 | pool.start(openDBJob); 36 | QThread::sleep(2); 37 | 38 | TM::ImportTmxJob *importJob = new TM::ImportTmxJob(tmxFile, dbName); 39 | pool.start(importJob); 40 | // Give 2 seconds to import the data 41 | QThread::sleep(2); 42 | TM::ExecQueryJob *queryJob = nullptr; 43 | QVector data{ 44 | {QStringLiteral("files"), QStringLiteral("path"), QStringLiteral("/home/test/trunk/l10n-support/fr/summit/messages/gcompris/gcompris_qt.po")}, 45 | {QStringLiteral("source_strings"), QStringLiteral("source"), QStringLiteral("Advanced colors")}, 46 | {QStringLiteral("target_strings"), QStringLiteral("target"), QStringLiteral("Couleurs avancées")}, 47 | }; 48 | for (const QStringList &d : data) { 49 | QMutex m; 50 | QString queryString = QStringLiteral("SELECT * FROM %1").arg(d[0]); 51 | queryJob = new TM::ExecQueryJob(queryString, dbName, &m); 52 | connect(queryJob, &TM::ExecQueryJob::done, [&d, queryJob] { 53 | QSqlQuery *query = queryJob->query; 54 | if (query->next()) { 55 | int fieldId = query->record().indexOf(d[1]); 56 | QCOMPARE(query->value(fieldId).toString(), d[2]); 57 | } else { 58 | QFAIL("Query should have one element"); 59 | } 60 | }); 61 | pool.start(queryJob); 62 | QThread::sleep(1); 63 | } 64 | // reset 65 | qputenv("XDG_DATA_HOME", QByteArray()); 66 | } 67 | 68 | QTEST_GUILESS_MAIN(TmJobsTest) 69 | 70 | #include "tmjobstest.moc" 71 | -------------------------------------------------------------------------------- /src/alttransview.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2008 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | SPDX-FileCopyrightText: 2024 Finley Watson 7 | 8 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 9 | */ 10 | 11 | #ifndef ALTTRANSVIEW_H 12 | #define ALTTRANSVIEW_H 13 | 14 | #include "alttrans.h" 15 | #include "pos.h" 16 | 17 | #include 18 | 19 | #define ALTTRANS_SHORTCUTS 9 20 | 21 | class Catalog; 22 | class QAction; 23 | 24 | namespace TM 25 | { 26 | class DynamicItemHeightQListWidget; 27 | } 28 | 29 | class AltTransView : public QDockWidget 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit AltTransView(QWidget *, Catalog *, const QVector &); 35 | ~AltTransView() override; 36 | /* 37 | * @short Triggered for each show / hide event. 38 | * Resizes the items in the view so that when the view 39 | * is first shown, its items are laid out correctly. 40 | */ 41 | void showEvent(QShowEvent *event) override; 42 | /* 43 | * @short Open a dialogue when data is available. 44 | * When there is data in the Alternative Translation View 45 | * but the view is hidden, inform the user that displaying 46 | * the view might be useful, and allow the user to show it. 47 | * @author Finley Watson 48 | */ 49 | void conditionallyPromptToDisplay(); 50 | 51 | public Q_SLOTS: 52 | void slotNewEntryDisplayed(const DocPosition &); 53 | void fileLoaded(); 54 | void attachAltTransFile(const QString &); 55 | void addAlternateTranslation(int entry, const QString &); 56 | 57 | private Q_SLOTS: 58 | void process(); 59 | void initLater(); 60 | void slotUseSuggestion(int); 61 | 62 | Q_SIGNALS: 63 | void refreshRequested(); 64 | void textInsertRequested(const QString &); 65 | 66 | private: 67 | void dragEnterEvent(QDragEnterEvent *event) override; 68 | void dropEvent(QDropEvent *event) override; 69 | bool event(QEvent *event) override; 70 | 71 | private: 72 | TM::DynamicItemHeightQListWidget *m_entriesList{nullptr}; 73 | Catalog *m_catalog; 74 | QString m_normTitle; 75 | QString m_hasInfoTitle; 76 | bool m_hasInfo{}; 77 | bool m_everCheckedAboutPromptingToShow{}; 78 | DocPos m_entry; 79 | DocPos m_prevEntry; 80 | 81 | QVector m_entries; 82 | QVector m_actions; // need them to get shortcuts 83 | }; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/tests/data/xliff-extractor/testxliffmerge_en.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | test symbols 7 | 8 | 9 | test changing ids of inlined markup. And one more. 10 | fuzzy found 11 | 12 | 13 | test changing ids of units themselves. 14 | fuzzy found 15 | 16 | 17 | test changing the text 2. 18 | 19 | 20 | test no change. 21 | 22 | 23 | 24 | test adding text. 25 | 26 | 27 | test no change. 28 | 29 | 30 | test removing some tags. 31 | 32 | 33 | test adding attributes. 34 | 35 | 36 | test preserving alt-trans. 37 | 38 | 39 | test preserving alt-trans when text is changed 2. 40 | 41 | 42 | test inline position change. 43 | 44 | 45 | mrk preserving test: seg1seg2 46 | 47 | 48 | mrk1test: seg2 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/catalog/catalog_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | This file is based on the one from KBabel 4 | 5 | SPDX-FileCopyrightText: 1999-2000 Matthias Kiefer 6 | SPDX-FileCopyrightText: 2001-2004 Stanislav Visnovsky 7 | SPDX-FileCopyrightText: 2007 Nick Shaforostoff 8 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 9 | 10 | 11 | SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0 12 | */ 13 | 14 | #ifndef CATALOG_PRIVATE_H 15 | #define CATALOG_PRIVATE_H 16 | 17 | #include "alttrans.h" 18 | #include "pos.h" 19 | #include "projectlocal.h" 20 | #include "state.h" 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | class CatalogStorage; 32 | class Catalog; 33 | 34 | class CatalogPrivate 35 | { 36 | public: 37 | /** url of the po-file, that belongs to this catalog */ 38 | QString _filePath; 39 | QString _packageName; 40 | QString _packageDir; 41 | 42 | /** identification string for used import filter*/ 43 | QString _importID; 44 | 45 | int _numberOfPluralForms{-1}; 46 | 47 | QTimer _autoSaveTimer; 48 | KAutoSaveFile *_autoSave{}; 49 | bool _autoSaveDirty{true}; 50 | bool _autoSaveRecovered{false}; 51 | 52 | bool _readOnly{false}; 53 | // for wrapping 54 | short _maxLineLength{80}; 55 | 56 | std::list _nonApprovedIndex; 57 | std::list _nonApprovedNonEmptyIndex; 58 | std::list _emptyIndex; 59 | std::list _errorIndex; 60 | 61 | std::list _bookmarkIndex; 62 | 63 | QVector> _statesIndex; 64 | 65 | std::list _altTransCatalogs; 66 | QMap _altTranslations; 67 | 68 | // for undo/redo 69 | // keeps pos of the entry that was last modified 70 | DocPosition _lastModifiedPos{}; 71 | 72 | QSet _modifiedEntries; // just for the nice gui 73 | 74 | QString _phase; 75 | ProjectLocal::PersonRole _phaseRole{ProjectLocal::Undefined}; 76 | 77 | explicit CatalogPrivate(QObject *parent) 78 | : _autoSave(new KAutoSaveFile(parent)) 79 | { 80 | Q_UNUSED(parent) 81 | _statesIndex.resize(StateCount); 82 | } 83 | 84 | bool addToEmptyIndexIfAppropriate(CatalogStorage *, const DocPosition &pos, bool alreadyEmpty); 85 | bool removeFromUntransIndexIfAppropriate(CatalogStorage *, const DocPosition &pos); 86 | }; 87 | 88 | #endif // CATALOG_PRIVATE_H 89 | -------------------------------------------------------------------------------- /icons/osx/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrincipalClass 6 | NSApplication 7 | CFBundleIconFile 8 | 9 | CFBundlePackageType 10 | APPL 11 | CFBundleGetInfoString 12 | Created by Qt/QMake 13 | CFBundleSignature 14 | ???? 15 | CFBundleExecutable 16 | Lokalize 17 | CFBundleShortVersionString 18 | 1.9 19 | CFBundleVersion 20 | 1.9 21 | CFBundleIdentifier 22 | com.kde.lokalize 23 | CFBundleIconFile 24 | Lokalize.icns 25 | LSMinimumSystemVersion 26 | 10.7 27 | 28 | 29 | 30 | CFBundleDocumentTypes 31 | 32 | 33 | CFBundleTypeExtensions 34 | 35 | xlf 36 | xliff 37 | 38 | CFBundleTypeIconFile 39 | LokalizeXliff.icns 40 | CFBundleTypeMIMETypes 41 | 42 | application/x-xliff+xml 43 | 44 | CFBundleTypeName 45 | XLIFF Translation File 46 | CFBundleTypeRole 47 | Editor 48 | 49 | 50 | CFBundleTypeExtensions 51 | 52 | pot 53 | 54 | CFBundleTypeIconFile 55 | LokalizePot.icns 56 | CFBundleTypeMIMETypes 57 | 58 | text/x-gettext-translation-template 59 | text/x-pot 60 | 61 | CFBundleTypeName 62 | Gettext Translation Template 63 | CFBundleTypeRole 64 | Editor 65 | 66 | 67 | CFBundleTypeExtensions 68 | 69 | po 70 | 71 | CFBundleTypeIconFile 72 | LokalizePo.icns 73 | CFBundleTypeMIMETypes 74 | 75 | text/x-gettext-translation 76 | text/x-gettext-catalog 77 | text/x-po 78 | 79 | CFBundleTypeName 80 | Gettext PO file 81 | CFBundleTypeRole 82 | Editor 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/catalog/phase.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2009 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include "phase.h" 11 | #include "catalog.h" 12 | #include "cmd.h" 13 | #include "gettextheader.h" 14 | #include "prefs_lokalize.h" 15 | #include "project.h" 16 | #include "version.h" 17 | 18 | #include 19 | 20 | #include 21 | 22 | const char *const *processes() 23 | { 24 | static const char *const processes[] = {"translation", "review", "approval"}; 25 | return processes; 26 | } 27 | 28 | // guess role 29 | ProjectLocal::PersonRole roleForProcess(const QString &process) 30 | { 31 | int i = ProjectLocal::Undefined; 32 | while (i >= 0 && !process.startsWith(QLatin1String(processes()[--i]))) 33 | ; 34 | return (i == -1) ? Project::local()->role() : ProjectLocal::PersonRole(i); 35 | } 36 | 37 | void generatePhaseForCatalogIfNeeded(Catalog *catalog) 38 | { 39 | if (Q_LIKELY(!(catalog->capabilities() & Phases) || catalog->activePhaseRole() == ProjectLocal::Undefined)) 40 | return; 41 | 42 | Phase phase; 43 | phase.process = QLatin1String(processes()[Project::local()->role()]); 44 | 45 | if (initPhaseForCatalog(catalog, phase)) 46 | static_cast(catalog)->push(new UpdatePhaseCmd(catalog, phase)); 47 | 48 | catalog->setActivePhase(phase.name, roleForProcess(phase.process)); 49 | } 50 | 51 | bool initPhaseForCatalog(Catalog *catalog, Phase &phase, int options) 52 | { 53 | askAuthorInfoIfEmpty(); 54 | 55 | phase.contact = Settings::authorName(); 56 | 57 | QSet names; 58 | QList phases = catalog->allPhases(); 59 | std::sort(phases.begin(), phases.end(), std::greater()); 60 | for (const Phase &p : std::as_const(phases)) { 61 | if (!(options & ForceAdd) && p.contact == phase.contact && p.process == phase.process) { 62 | phase = p; 63 | break; 64 | } 65 | names.insert(p.name); 66 | } 67 | 68 | if (phase.name.isEmpty()) { 69 | int i = 0; 70 | while (names.contains(phase.name = phase.process + QStringLiteral("-%1").arg(++i))) 71 | ; 72 | phase.date = QDate::currentDate(); 73 | phase.email = Settings::authorEmail(); 74 | return true; 75 | } 76 | return false; 77 | } 78 | 79 | Phase::Phase() 80 | : date(QDate::currentDate()) 81 | , tool(QStringLiteral("lokalize-" LOKALIZE_VERSION)) 82 | { 83 | } 84 | -------------------------------------------------------------------------------- /src/metadata/filemetadata.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2018 Karl Ove Hufthammer 5 | SPDX-FileCopyrightText: 2007-2014 Nick Shaforostoff 6 | SPDX-FileCopyrightText: 2009 Viesturs Zarins 7 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 8 | SPDX-FileCopyrightText: 2019 Alexander Potashev 9 | 10 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 11 | */ 12 | 13 | #include "filemetadata.h" 14 | #include "poextractor.h" 15 | #include "xliffextractor.h" 16 | 17 | #include 18 | 19 | // static 20 | FileMetaData FileMetaData::extract(const QString &filePath) 21 | { 22 | if (filePath.endsWith(QLatin1String(".po")) || filePath.endsWith(QLatin1String(".pot"))) { 23 | POExtractor extractor; 24 | return extractor.extract(filePath); 25 | } else if (filePath.endsWith(QLatin1String(".xlf")) || filePath.endsWith(QLatin1String(".xliff"))) { 26 | XliffExtractor extractor; 27 | return extractor.extract(filePath); 28 | } else if (filePath.endsWith(QLatin1String(".ts"))) { 29 | } 30 | 31 | return {}; 32 | } 33 | 34 | QDataStream &operator<<(QDataStream &s, const FileMetaData &d) 35 | { 36 | // Magic number 37 | s << (quint32)0xABC42BCA; 38 | // Version 39 | s << (qint32)1; 40 | s << d.translated; 41 | s << d.translated_approver; 42 | s << d.translated_reviewer; 43 | s << d.fuzzy; 44 | s << d.fuzzy_approver; 45 | s << d.fuzzy_reviewer; 46 | s << d.untranslated; 47 | s << d.lastTranslator; 48 | s << d.translationDate; 49 | s << d.sourceDate; 50 | s << d.invalid_file; 51 | return s; 52 | } 53 | 54 | QDataStream &operator>>(QDataStream &s, FileMetaData &d) 55 | { 56 | // Read the magic number 57 | qint32 version = 0; 58 | quint32 magic; 59 | s >> magic; 60 | if (magic == 0xABC42BCA) { 61 | // This is a valid magic number, we can expect a version number 62 | // Else it's the old format 63 | s >> version; 64 | s >> d.translated; 65 | } else { 66 | // Legacy format, the magic number was actually the translated count 67 | d.translated = magic; 68 | } 69 | s >> d.translated_approver; 70 | s >> d.translated_reviewer; 71 | s >> d.fuzzy; 72 | s >> d.fuzzy_approver; 73 | s >> d.fuzzy_reviewer; 74 | s >> d.untranslated; 75 | s >> d.lastTranslator; 76 | s >> d.translationDate; 77 | s >> d.sourceDate; 78 | if (version >= 1) { 79 | s >> d.invalid_file; 80 | } 81 | return s; 82 | } 83 | -------------------------------------------------------------------------------- /src/prefs/prefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2014 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef PREFS_H 11 | #define PREFS_H 12 | 13 | #include 14 | 15 | class KEditListWidget; 16 | 17 | /** 18 | * Singleton that manages cfgs for Lokalize and projects 19 | */ 20 | class SettingsController : public QObject 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | SettingsController(); 26 | ~SettingsController() override = default; 27 | 28 | bool dirty{false}; 29 | 30 | void setMainWindowPtr(QWidget *w) 31 | { 32 | m_mainWindowPtr = w; 33 | } 34 | QWidget *mainWindowPtr() 35 | { 36 | return m_mainWindowPtr; 37 | } 38 | 39 | public Q_SLOTS: 40 | void showSettingsDialog(); 41 | 42 | bool ensureProjectIsLoaded(); 43 | QString projectOpen(QString path = QString(), bool doOpen = true); 44 | bool projectCreate(); 45 | void projectConfigure(); 46 | 47 | void reflectProjectConfigChange(); 48 | 49 | void reflectRelativePathsHack(); 50 | 51 | Q_SIGNALS: 52 | void generalSettingsChanged(); 53 | 54 | private: 55 | KEditListWidget *m_scriptsRelPrefWidget{nullptr}; // HACK to get relative filenames in the project file 56 | KEditListWidget *m_scriptsPrefWidget{nullptr}; 57 | QWidget *m_mainWindowPtr{nullptr}; 58 | 59 | private: 60 | static SettingsController *_instance; 61 | static void cleanupSettingsController(); 62 | 63 | public: 64 | static SettingsController *instance(); 65 | }; 66 | 67 | /** 68 | * helper widget to save relative paths in project file, 69 | * thus allowing its publishing in e.g. svn 70 | */ 71 | class RelPathSaver : public QLineEdit 72 | { 73 | Q_OBJECT 74 | public: 75 | explicit RelPathSaver(QWidget *p) 76 | : QLineEdit(p) 77 | { 78 | } 79 | public Q_SLOTS: 80 | void setText(const QString &); 81 | }; 82 | 83 | /** 84 | * helper widget to save lang code text values 85 | * identified by LanguageListModel string index internally 86 | */ 87 | class LangCodeSaver : public QLineEdit 88 | { 89 | Q_OBJECT 90 | public: 91 | explicit LangCodeSaver(QWidget *p) 92 | : QLineEdit(p) 93 | { 94 | } 95 | public Q_SLOTS: 96 | void setLangCode(int); 97 | }; 98 | 99 | void writeUiState(const char *elementName, const QByteArray &); 100 | QByteArray readUiState(const char *elementName); 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /src/statusbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2007 Joris Guisson 3 | SPDX-FileCopyrightText: 2007 Ivan Vasic 4 | SPDX-FileCopyrightText: 2025 Finley Watson 5 | SPDX-License-Identifier: GPL-2.0-or-later 6 | */ 7 | 8 | #ifndef STATUSBAR_H 9 | #define STATUSBAR_H 10 | 11 | #include "lokalizetabpagebase.h" 12 | 13 | #include 14 | 15 | class QLabel; 16 | 17 | /** 18 | * Class which handles the status bar: use a single instance of the status 19 | * bar, and dynamically switch the tab page that is connected to it 20 | * depending on the tab page currently visible. Signals and slots allow 21 | * the tab page to communicate with the status bar. 22 | * */ 23 | class LokalizeStatusBar : public QStatusBar 24 | { 25 | Q_OBJECT 26 | public: 27 | LokalizeStatusBar(QWidget *parent); 28 | ~LokalizeStatusBar() override; 29 | 30 | // Set and clear sections in the status bar. These are slots. 31 | void setCurrentIndex(const int currentIndex); 32 | void clearCurrentIndex(); 33 | void setTotalCount(const int totalCount); 34 | void clearTotalCount(); 35 | void setFuzzyNotReadyCount(const int fuzzyNotReadyCount, const int totalCount); 36 | void clearFuzzyNotReadyCount(); 37 | void setUntranslatedCount(const int untranslatedCount, const int totalCount); 38 | void clearUntranslatedCount(); 39 | void setReadyCount(const QString text); 40 | void clearTranslationStatus(); 41 | void clear(); 42 | // Connect a tab page to the status bar and 43 | // save connections for disconnection later. 44 | void connectSignals(LokalizeTabPageBase *tab); 45 | void connectSignals(LokalizeTabPageBaseNoQMainWindow *tab); 46 | // Disconnect the currently visible tab: use the 47 | // saved connections to perform disconnections. 48 | void disconnectSignals(); 49 | 50 | // The connections currently in use between tab page 51 | // signals and the status bar's slots. 52 | QMetaObject::Connection m_connectionCurrent; 53 | QMetaObject::Connection m_connectionTotal; 54 | QMetaObject::Connection m_connectionFuzzyNotReady; 55 | QMetaObject::Connection m_connectionUntranslated; 56 | QMetaObject::Connection m_connectionTranslationStatus; 57 | 58 | private: 59 | // Variables used to create the QLabels in the status bar. 60 | int m_currentIndex; 61 | int m_totalCount; 62 | int m_fuzzyNotReadyCount; 63 | int m_untranslatedCount; 64 | QString m_translationStatusString; 65 | // QLabels in the status bar. 66 | QLabel *m_currentLabel; 67 | QLabel *m_totalLabel; 68 | QLabel *m_fuzzyNotReadyLabel; 69 | QLabel *m_untranslatedLabel; 70 | QLabel *m_translationStatusLabel; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/common/termlabel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #include "termlabel.h" 11 | #include "glossary.h" 12 | #include "glossarywindow.h" 13 | #include "project.h" 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | using namespace GlossaryNS; 22 | 23 | void TermLabel::insert() 24 | { 25 | GlossaryNS::Glossary *glossary = Project::instance()->glossary(); 26 | if (m_entryId.isEmpty()) 27 | return; 28 | QString termTrans; 29 | const QStringList &termTarget = glossary->terms(m_entryId, Project::instance()->targetLangCode()); 30 | if (termTarget.count() > 1) { 31 | QMenu menu; 32 | 33 | int limit = termTarget.count(); 34 | menu.setActiveAction(menu.addAction(termTarget.at(0))); 35 | int i = 1; 36 | for (; i < limit; ++i) 37 | menu.addAction(termTarget.at(i)); 38 | 39 | QAction *txt = menu.exec(mapToGlobal(QPoint(0, 0))); 40 | if (!txt) 41 | return; 42 | termTrans = txt->text(); 43 | } else if (termTarget.count() == 1) 44 | termTrans = termTarget.first(); 45 | 46 | if (m_capFirst && !termTrans.isEmpty()) 47 | termTrans[0] = termTrans.at(0).toUpper(); 48 | 49 | Q_EMIT insertTerm(termTrans); 50 | } 51 | 52 | void TermLabel::mousePressEvent(QMouseEvent *event) 53 | { 54 | if (event->button() == Qt::RightButton) { 55 | QMenu menu; 56 | 57 | menu.addAction(i18nc("@action:inmenu Edit term", "Edit")); 58 | 59 | QAction *txt = menu.exec(event->globalPosition().toPoint()); 60 | if (txt) { 61 | GlossaryNS::GlossaryWindow *glossaryWindow = Project::instance()->showGlossary(); 62 | if (glossaryWindow) 63 | glossaryWindow->selectEntry(m_entryId); 64 | } 65 | } else 66 | insert(); 67 | } 68 | 69 | void TermLabel::setText(const QString &term, const QByteArray &entryId, bool capFirst) 70 | { 71 | m_entryId = entryId; 72 | m_capFirst = capFirst; 73 | 74 | static const QString n = QStringLiteral(" \n "); 75 | QLabel::setText( 76 | QString(term 77 | + QString(m_action ? QString(QStringLiteral(" [") + m_action->shortcut().toString(QKeySequence::NativeText) + QStringLiteral("] \n ")) 78 | : n) // m_shortcut 79 | + Project::instance()->glossary()->terms(m_entryId, Project::instance()->targetLangCode()).join(n) + n)); 80 | } 81 | 82 | #include "moc_termlabel.cpp" 83 | -------------------------------------------------------------------------------- /src/common/diff.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | wordDiff algorithm adoption and further refinement: 5 | SPDX-FileCopyrightText: 2007 Nick Shaforostoff 6 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 7 | SPDX-FileCopyrightText: 2024 Finley Watson 8 | 9 | (based on Markus Stengel's GPL implementation of LCS-Delta algorithm as it is described in "Introduction to Algorithms", MIT Press, 2001, Second Edition, 10 | written by Thomas H. Cormen et. al. It uses dynamic programming to solve the Longest Common Subsequence (LCS) problem.) SPDX-License-Identifier: GPL-2.0-only 11 | OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 12 | */ 13 | 14 | #ifndef DIFF_H 15 | #define DIFF_H 16 | 17 | #include 18 | 19 | // The following are tags that go at the beginning and end of 20 | // generated diff sections while the diffs are processed 21 | // internally. They are converted to coloured HTML when 22 | // displayed to the user. 23 | static const QString addMarkerStart = QLatin1String("{LokalizeAdd}"); 24 | static const QString addMarkerEnd = QLatin1String("{/LokalizeAdd}"); 25 | static const QString delMarkerStart = QLatin1String("{LokalizeDel}"); 26 | static const QString delMarkerEnd = QLatin1String("{/LokalizeDel}"); 27 | 28 | /** 29 | * @short Word-by-word diff algorithm 30 | * 31 | * Word-by-word diff algorithm 32 | * 33 | * Based on Markus Stengel's GPLv2+ implementation of LCS-Delta algorithm 34 | * as it is described in "Introduction to Algorithms", MIT Press, 2001, Second Edition, written by Thomas H. Cormen et. al. 35 | * It uses dynamic programming to solve the Longest Common Subsequence (LCS) problem. 36 | * 37 | * This is high-level wrapper 38 | * 39 | * @author Nick Shaforostoff 40 | */ 41 | enum { 42 | Html = 1, 43 | }; 44 | QString userVisibleWordDiff(const QString &oldString, const QString &newString, const QString &accelRx, const QString &markupRx, int options = 0); 45 | 46 | /** 47 | * This is low-level wrapper used for evaluating translation memory search results 48 | * 49 | * You have to explicitly prepend lists with identical strings 50 | */ 51 | QString wordDiff(QStringList s1, QStringList s2); 52 | 53 | /** 54 | * @short Converts curly brace tags into user-readable HTML-coloured diffs 55 | * 56 | * This takes a string with Lokalize's diff marker tags e.g. 57 | * "a{LokalizeAdd}b{/LokalizeAdd}c{LokalizeDel}d{/LokalizeDel}" 58 | * and replaces the curly brace tags with HTML and CSS that 59 | * colours the diff using inline CSS. Returns a QString of 60 | * the coloured diff for use in user-visible areas like the 61 | * translation memory. 62 | * 63 | * @author Finley Watson 64 | */ 65 | QString diffToHtmlDiff(const QString &diff); 66 | 67 | #endif // DIFF_H 68 | -------------------------------------------------------------------------------- /src/prefs/prefs_general.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | prefs_general 4 | 5 | 6 | 7 | 0 8 | 0 9 | 612 10 | 375 11 | 12 | 13 | 14 | 15 | 11 16 | 17 | 18 | 11 19 | 20 | 21 | 11 22 | 23 | 24 | 11 25 | 26 | 27 | 6 28 | 29 | 30 | 31 | 32 | Qt::Vertical 33 | 34 | 35 | 36 | 20 37 | 40 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Restore the previously opened files when launching Lokalize 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Defines the behavior of the next/previous tab shortcuts 55 | 56 | 57 | Next/previous tab shortcut behavior 58 | 59 | 60 | kcfg_TabSwitch 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | According to tab position 69 | 70 | 71 | 72 | 73 | According to tab activation order 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Use a custom editor to open source files 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/prefs/prefs_languagetool.ui: -------------------------------------------------------------------------------- 1 | 2 | prefs_languagetool 3 | 4 | 5 | 6 | 0 7 | 0 8 | 611 9 | 439 10 | 11 | 12 | 13 | 14 | 15 | 16 | QFormLayout::ExpandingFieldsGrow 17 | 18 | 19 | 20 | 21 | Use custom LanguageTool server 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Server Path: 32 | 33 | 34 | false 35 | 36 | 37 | kcfg_LanguageToolInstancePath 38 | 39 | 40 | 41 | 42 | 43 | 44 | The path of your custom Language Tool server 45 | 46 | 47 | Please enter the path of your custom Language Tool server, if any 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Delay before automatic checking after you stop typing (in seconds, 0 to disable) 59 | 60 | 61 | kcfg_LanguageToolDelay 62 | 63 | 64 | Set to 0 to disable auto checking 65 | 66 | 67 | 68 | 69 | 70 | 71 | Set to 0 to disable auto checking 72 | 73 | 74 | 0 75 | 76 | 77 | 20 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Lokalize project 2 | cmake_minimum_required(VERSION 3.16) 3 | 4 | # KDE Application Version, managed by release script 5 | set (RELEASE_SERVICE_VERSION_MAJOR "26") 6 | set (RELEASE_SERVICE_VERSION_MINOR "03") 7 | set (RELEASE_SERVICE_VERSION_MICRO "70") 8 | set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}") 9 | 10 | project(lokalize VERSION ${RELEASE_SERVICE_VERSION}) 11 | 12 | set(QT_MIN_VERSION "6.6.0") 13 | set(KF_MIN_VERSION "6.3.0") 14 | set(KDE_COMPILERSETTINGS_LEVEL "5.85") 15 | 16 | # search packages used 17 | find_package(ECM ${KF_MIN_VERSION} REQUIRED CONFIG) 18 | find_package(KDDockWidgets-qt6 REQUIRED) 19 | set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 20 | include(KDEInstallDirs) 21 | include(KDECMakeSettings) 22 | include(KDECompilerSettings NO_POLICY_SCOPE) 23 | include(ECMAddAppIcon) 24 | include(ECMQtDeclareLoggingCategory) 25 | include(ECMAddTests) 26 | include(KDEClangFormat) 27 | include(KDEGitCommitHooks) 28 | 29 | option(BUILD_DOC "Whether to build the documentation" ON) 30 | 31 | find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets Sql Test) 32 | 33 | find_package(KF6 ${KF_MIN_VERSION} REQUIRED I18n TextWidgets KIO XmlGui Notifications Config CoreAddons Sonnet Crash IconThemes ColorScheme) 34 | 35 | set(USE_DBUS_DEFAULT OFF) 36 | if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAIKU) 37 | set(USE_DBUS_DEFAULT ON) 38 | endif() 39 | option(USE_DBUS "Build components using DBus" ${USE_DBUS_DEFAULT}) 40 | if(USE_DBUS) 41 | find_package(Qt6DBus REQUIRED) 42 | find_package(KF6DBusAddons REQUIRED) 43 | set(HAVE_DBUS 1) 44 | endif() 45 | 46 | 47 | if(BUILD_DOC) 48 | find_package(KF6DocTools ${KF_MIN_VERSION}) 49 | set_package_properties(KF6DocTools PROPERTIES 50 | DESCRIPTION "Tools to generate documentation" 51 | TYPE REQUIRED 52 | ) 53 | endif() 54 | 55 | find_package(HUNSPELL) 56 | set_package_properties( 57 | HUNSPELL PROPERTIES 58 | DESCRIPTION "Library used for stemming" 59 | URL "https://hunspell.github.io/" 60 | TYPE REQUIRED 61 | PURPOSE "Required to build Lokalize.") 62 | 63 | add_subdirectory(src) 64 | add_subdirectory(icons) 65 | add_subdirectory(autotests) 66 | 67 | file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.hpp *.c) 68 | kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) 69 | 70 | kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT) 71 | 72 | install(FILES org.kde.lokalize.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) 73 | 74 | if(BUILD_DOC) 75 | add_subdirectory(doc) 76 | kdoctools_install(po) 77 | endif() 78 | 79 | ki18n_install(po) 80 | 81 | configure_file( 82 | ${CMAKE_CURRENT_SOURCE_DIR}/config-lokalize.h.cmake 83 | ${CMAKE_CURRENT_BINARY_DIR}/src/config-lokalize.h 84 | ) 85 | 86 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) 87 | -------------------------------------------------------------------------------- /src/tm/dbfilesmodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2011 Nick Shaforostoff 5 | SPDX-FileCopyrightText: 2018-2019 Simon Depiets 6 | 7 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 8 | */ 9 | 10 | #ifndef DBFILESMODEL_H 11 | #define DBFILESMODEL_H 12 | 13 | #include "jobs.h" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | class QFileSystemModel; 20 | class QPersistentModelIndex; 21 | 22 | namespace TM 23 | { 24 | class OpenDBJob; 25 | 26 | class DBFilesModel : public QSortFilterProxyModel 27 | { 28 | Q_OBJECT 29 | public: 30 | enum Columns { 31 | Name = 0, 32 | SourceLang, 33 | TargetLang, 34 | Pairs, 35 | OriginalsCount, 36 | TranslationsCount, 37 | ColumnCount, 38 | }; 39 | 40 | enum Rolse { 41 | FileNameRole = Qt::UserRole + 50, 42 | NameRole = Qt::UserRole + 51, 43 | }; 44 | 45 | DBFilesModel(); 46 | ~DBFilesModel() override; 47 | 48 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 49 | int columnCount(const QModelIndex &parent = QModelIndex()) const override; 50 | Qt::ItemFlags flags(const QModelIndex &) const override 51 | { 52 | return Qt::ItemIsSelectable | Qt::ItemIsEnabled; 53 | } 54 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; 55 | 56 | QModelIndex rootIndex() const; 57 | void removeTM(QModelIndex); 58 | 59 | // can be zero!!! 60 | QPersistentModelIndex *projectDBIndex() const 61 | { 62 | return projectDB; 63 | } 64 | 65 | void openDB(const QString &name, DbType type = Undefined, bool forceCurrentProjectConfig = false); 66 | void openDB(OpenDBJob *); 67 | 68 | static DBFilesModel *instance(); 69 | 70 | private: 71 | static DBFilesModel *_instance; 72 | static void cleanupDBFilesModel(); 73 | 74 | protected: 75 | bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; 76 | 77 | public Q_SLOTS: 78 | void updateStats(const QModelIndex &topLeft, const QModelIndex &bottomRight); 79 | void calcStats(const QModelIndex &parent, int start, int end); 80 | void openJobDone(OpenDBJob *); 81 | void closeJobDone(CloseDBJob *); 82 | void updateProjectTmIndex(); 83 | 84 | private: 85 | mutable QPersistentModelIndex *projectDB{}; 86 | QFileSystemModel *m_fileSystemModel{}; 87 | QString m_tmRootPath; 88 | QElapsedTimer m_timeSinceLastUpdate; 89 | 90 | QMap m_stats; 91 | 92 | public: 93 | QMap m_configurations; 94 | QList m_openingDb; 95 | QMutex m_openingDbLock; 96 | }; 97 | 98 | } 99 | #endif 100 | -------------------------------------------------------------------------------- /src/catalog/pos.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Lokalize 3 | 4 | SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff 5 | 6 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 7 | */ 8 | 9 | #ifndef POS_H 10 | #define POS_H 11 | 12 | #include 13 | 14 | class Catalog; 15 | 16 | /** 17 | * This struct represents a position in a catalog. 18 | * A position is a tuple (index,pluralform,textoffset). 19 | * 20 | * @short Structure that represents a position in a catalog 21 | */ 22 | struct DocPosition { 23 | enum Part { 24 | UndefPart = 0, 25 | Source = 1, 26 | Target = 2, 27 | Comment = 4, 28 | }; 29 | 30 | int entry : 32; 31 | Part part : 8; 32 | char form : 8; 33 | uint offset : 16; 34 | 35 | DocPosition() 36 | : entry(-1) 37 | , part(Target) 38 | , form(0) 39 | , offset(0) 40 | { 41 | } 42 | 43 | DocPosition(int entry_, Part part_, char form_ = 0, uint offset_ = 0) 44 | : entry(entry_) 45 | , part(part_) 46 | , form(form_) 47 | , offset(offset_) 48 | { 49 | } 50 | 51 | explicit DocPosition(int entry_, char form_ = 0, uint offset_ = 0) 52 | : entry(entry_) 53 | , part(Target) 54 | , form(form_) 55 | , offset(offset_) 56 | { 57 | } 58 | 59 | bool operator==(const DocPosition &pos) const 60 | { 61 | return entry == pos.entry && form == pos.form; 62 | }; 63 | }; 64 | Q_DECLARE_METATYPE(DocPosition) 65 | 66 | bool switchPrev(Catalog *&, DocPosition &pos, int parts = DocPosition::Target); 67 | bool switchNext(Catalog *&, DocPosition &pos, int parts = DocPosition::Target); 68 | 69 | /** 70 | * simpler version of DocPosition for use in QMap 71 | */ 72 | struct DocPos { 73 | int entry : 24; 74 | uchar form : 8; 75 | 76 | DocPos() 77 | : entry(-1) 78 | , form(0) 79 | { 80 | } 81 | 82 | DocPos(int _entry, uchar _form) 83 | : entry(_entry) 84 | , form(_form) 85 | { 86 | } 87 | explicit DocPos(const DocPosition &pos) 88 | : entry(pos.entry) 89 | , form(pos.form) 90 | { 91 | } 92 | 93 | bool operator<(const DocPos &pos) const 94 | { 95 | return entry == pos.entry ? form < pos.form : entry < pos.entry; 96 | } 97 | 98 | bool operator==(const DocPos &pos) const 99 | { 100 | return entry == pos.entry && form == pos.form; 101 | } 102 | 103 | bool operator!=(const DocPos &pos) const 104 | { 105 | return entry != pos.entry || form != pos.form; 106 | } 107 | 108 | DocPosition toDocPosition() 109 | { 110 | return DocPosition(entry, DocPosition::Target, form); 111 | } 112 | }; 113 | Q_DECLARE_METATYPE(DocPos) 114 | 115 | inline uint qHash(const DocPos &key) 116 | { 117 | return qHash((key.entry << 8) | key.form); 118 | } 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /src/prefs/prefs_pology.ui: -------------------------------------------------------------------------------- 1 | 2 | prefs_pology 3 | 4 | 5 | 6 | 0 7 | 0 8 | 611 9 | 439 10 | 11 | 12 | 13 | 14 | 15 | 16 | QFormLayout::ExpandingFieldsGrow 17 | 18 | 19 | 20 | 21 | Enable Pology verification 22 | 23 | 24 | 25 | 26 | 27 | 28 | The Pology command to run in order to check a single entry. Use the following placeholders in order to set-up the commands: %u is the entry number, %f is the file name. For instance: posieve -u %u check-rules %f 29 | 30 | 31 | true 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 611 40 | 100 41 | 42 | 43 | 44 | The Pology command to run in order to check a single entry. 45 | 46 | 47 | Please enter here the Pology command to be run in order to check a single entry 48 | 49 | 50 | 51 | 52 | 53 | 54 | The Pology command to run in order to check a whole file. This command should include "-s lokalize", placeholder %f is the file name. For instance: posieve -s lokalize check-rules %f 55 | 56 | 57 | true 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 611 66 | 100 67 | 68 | 69 | 70 | The Pology command to run in order to check a whole file. 71 | 72 | 73 | Please enter here the Pology command to be run in order to check a whole file 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | --------------------------------------------------------------------------------