diff --git a/.prettierrc.yaml b/.prettierrc.yaml
index b028678..d3baa6e 100644
--- a/.prettierrc.yaml
+++ b/.prettierrc.yaml
@@ -1,2 +1 @@
trailingComma: all
-xmlWhitespaceSensitivity: "ignore"
diff --git a/README.md b/README.md
index 09e5aab..0289df6 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,33 @@ make test
Flathub builds https://flathub.org/builds/#/apps/re.sonny.Commit
+## Maintainer
+
+
+
+ i18n
+
+```sh
+# To update the pot file
+xgettext -f po/POTFILES -o po/re.sonny.Commit.pot -cTRANSLATORS --from-code=UTF-8
+
+# To create a translation
+msginit -i po/re.sonny.Commit.pot -o po/fr.po -l fr_FR.UTF-8
+
+# To update translations
+msgmerge -U po/*.po po/Commit.pot
+```
+
+See https://github.com/sonnyp/Commit/pull/14#issuecomment-894070878
+
+
+
+
+
+Publish new version
+
+
+
## Building
diff --git a/data/re.sonny.Commit.appdata.xml b/data/re.sonny.Commit.appdata.xml
index 8b04cc6..dc546f3 100644
--- a/data/re.sonny.Commit.appdata.xml
+++ b/data/re.sonny.Commit.appdata.xml
@@ -2,7 +2,7 @@
re.sonny.Commit
re.sonny.Commit.desktop
- Commit
+ Commit
Sonny Piers
sonny@fastmail.net
CC0-1.0
diff --git a/data/re.sonny.Commit.desktop b/data/re.sonny.Commit.desktop
index 99e5bc6..1bdf8c8 100644
--- a/data/re.sonny.Commit.desktop
+++ b/data/re.sonny.Commit.desktop
@@ -1,4 +1,5 @@
[Desktop Entry]
+# TRANSLATORS: Don't translate
Name=Commit
Comment=Commit message editor
Exec=re.sonny.Commit
@@ -7,4 +8,5 @@ Type=Application
Categories=Development;Utility;RevisionControl;TextEditor;GNOME;GTK;
StartupNotify=true
Icon=re.sonny.Commit
+# TRANSLATORS: Don't translate
Keywords=git;mercurial;hg;scm;
diff --git a/package-lock.json b/package-lock.json
index 406e6d8..91c90d7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,7 +5,7 @@
"packages": {
"": {
"devDependencies": {
- "@prettier/plugin-xml": "^0.13.1",
+ "@prettier/plugin-xml": "^1.0.2",
"eslint": "^7.17.0",
"eslint-plugin-import": "^2.22.1",
"husky": "^6.0.0",
@@ -146,13 +146,13 @@
}
},
"node_modules/@prettier/plugin-xml": {
- "version": "0.13.1",
- "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-0.13.1.tgz",
- "integrity": "sha512-jJbjvFEsxOT2Jhv2yydOvJbnSREJy+OECwHyZaYr05jLXlJeBrzy5YY1fDYpwTfKk1B2YqNExXI+x3Zm5yGfeA==",
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-1.0.2.tgz",
+ "integrity": "sha512-QNqKaa56/7trSqVuGDUzS9xw6Hx0qOklAwA7A2Mn89FPnPywyrK/GNCO71XK0AfoRNrmY0vETVpR2pWpBwfzow==",
"dev": true,
"dependencies": {
- "@xml-tools/parser": "^1.0.2",
- "prettier": ">=1.10"
+ "@xml-tools/parser": "^1.0.11",
+ "prettier": ">=2.3"
}
},
"node_modules/@types/json5": {
@@ -168,9 +168,9 @@
"dev": true
},
"node_modules/@xml-tools/parser": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.10.tgz",
- "integrity": "sha512-9oRb68wEKT+MRB7e2GwTiKicRKVXKzquBDGgH6YcGafvnSYXorWi2oaTVtbv2109RlGiQSnoXaQFUXCnHwFS7Q==",
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.11.tgz",
+ "integrity": "sha512-aKqQ077XnR+oQtHJlrAflaZaL7qZsulWc/i/ZEooar5JiWj1eLt0+Wg28cpa+XLney107wXqneC+oG1IZvxkTA==",
"dev": true,
"dependencies": {
"chevrotain": "7.1.1"
@@ -2178,9 +2178,9 @@
}
},
"node_modules/prettier": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
- "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
+ "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
@@ -2894,13 +2894,13 @@
}
},
"@prettier/plugin-xml": {
- "version": "0.13.1",
- "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-0.13.1.tgz",
- "integrity": "sha512-jJbjvFEsxOT2Jhv2yydOvJbnSREJy+OECwHyZaYr05jLXlJeBrzy5YY1fDYpwTfKk1B2YqNExXI+x3Zm5yGfeA==",
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-1.0.2.tgz",
+ "integrity": "sha512-QNqKaa56/7trSqVuGDUzS9xw6Hx0qOklAwA7A2Mn89FPnPywyrK/GNCO71XK0AfoRNrmY0vETVpR2pWpBwfzow==",
"dev": true,
"requires": {
- "@xml-tools/parser": "^1.0.2",
- "prettier": ">=1.10"
+ "@xml-tools/parser": "^1.0.11",
+ "prettier": ">=2.3"
}
},
"@types/json5": {
@@ -2916,9 +2916,9 @@
"dev": true
},
"@xml-tools/parser": {
- "version": "1.0.10",
- "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.10.tgz",
- "integrity": "sha512-9oRb68wEKT+MRB7e2GwTiKicRKVXKzquBDGgH6YcGafvnSYXorWi2oaTVtbv2109RlGiQSnoXaQFUXCnHwFS7Q==",
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/@xml-tools/parser/-/parser-1.0.11.tgz",
+ "integrity": "sha512-aKqQ077XnR+oQtHJlrAflaZaL7qZsulWc/i/ZEooar5JiWj1eLt0+Wg28cpa+XLney107wXqneC+oG1IZvxkTA==",
"dev": true,
"requires": {
"chevrotain": "7.1.1"
@@ -4437,9 +4437,9 @@
"dev": true
},
"prettier": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz",
- "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==",
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
+ "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
"dev": true
},
"progress": {
diff --git a/package.json b/package.json
index c1383dd..fbccd6f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"devDependencies": {
- "@prettier/plugin-xml": "^0.13.1",
+ "@prettier/plugin-xml": "^1.0.2",
"eslint": "^7.17.0",
"eslint-plugin-import": "^2.22.1",
"husky": "^6.0.0",
diff --git a/po/POTFILES b/po/POTFILES
index 8895bed..c17c83a 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -1,4 +1,8 @@
data/re.sonny.Commit.desktop
data/re.sonny.Commit.appdata.xml
data/re.sonny.Commit.gschema.xml
+src/about.js
src/window.ui
+src/preferences.ui
+src/welcome.js
+src/welcome.ui
diff --git a/po/meson.build b/po/meson.build
index 0551287..0990d41 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1 @@
-i18n.gettext('Commit', preset: 'glib')
+i18n.gettext('re.sonny.Commit', preset: 'glib')
diff --git a/po/re.sonny.Commit.pot b/po/re.sonny.Commit.pot
new file mode 100644
index 0000000..8c065cd
--- /dev/null
+++ b/po/re.sonny.Commit.pot
@@ -0,0 +1,219 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR , YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-08-11 11:59+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. TRANSLATORS: Don't translate
+#: data/re.sonny.Commit.desktop:4 src/window.ui:18
+msgid "Commit"
+msgstr ""
+
+#: data/re.sonny.Commit.desktop:5 data/re.sonny.Commit.appdata.xml:10
+#: src/about.js:9
+msgid "Commit message editor"
+msgstr ""
+
+#. TRANSLATORS: Don't translate
+#: data/re.sonny.Commit.desktop:13
+msgid "git;mercurial;hg;scm;"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:6
+msgid "Sonny Piers"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:12
+msgid ""
+"Commit is an editor that helps you write better Git and Mercurial commit "
+"messages."
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:16
+msgid ""
+"After installing make sure to launch the application and follow the "
+"instructions."
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:20
+msgid "Features:"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:22
+msgid ""
+"Highlights overflow of title when it exceeds 50 characters (customizable)"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:26
+msgid "Inserts blank line between title and description"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:27
+msgid "Spell checking"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:28
+msgid "Comments are readonly and excluded from \"Select All\""
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:29
+msgid "Displays project folder and branch in window header"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:30
+msgid ""
+"Dark theme support: the overflow highlight is adjusted according to your "
+"theme"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:34
+msgid ""
+"Supports git commit messages, merge messages, tag messages, add -p messages, "
+"and rebase -i messages"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:38
+msgid "Supports Mercurial commit messages"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:39
+msgid "Shows a welcome window when launched from desktop"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:49
+msgid "Commit main window"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:55
+msgid "Commit main window - dark mode"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:61
+msgid "Commit welcome window"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:67
+msgid "Commit welcome window - dark mode"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:75
+msgid "Add a Preferences window"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:76
+msgid "Set default title length hint to 50 characters"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:77
+msgid "Fix reading commits with special characters"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:78
+msgid "Fix git rebase not recognized"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:79
+msgid "Make windows bottom corners rounded"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:80
+msgid "Add 6px margin to editor"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:86
+msgid ""
+"⚠️ Action required. After updating, please launch the application and follow "
+"the instructions."
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:91
+msgid "Show a welcome window when launched from desktop"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:92
+msgid "Add support for Mercurial"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:93
+msgid "Remove filesystem permission"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:99
+msgid "Initial release. Forked from Gnomit 2.0."
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:101
+msgid "Support \"#\" in commit message"
+msgstr ""
+
+#: data/re.sonny.Commit.appdata.xml:102
+msgid "Properly recognize executable path"
+msgstr ""
+
+#: data/re.sonny.Commit.gschema.xml:7 src/preferences.ui:19
+#: src/preferences.ui:28
+msgid "Message title length hint"
+msgstr ""
+
+#. TRANSLATORS: eg. 'Translator Name ' or 'Translator Name '
+#: src/about.js:19
+msgid "translator-credits"
+msgstr ""
+
+#: src/window.ui:21
+msgid "Cancel"
+msgstr ""
+
+#: src/preferences.ui:6 src/welcome.ui:207
+msgid "Preferences"
+msgstr ""
+
+#: src/welcome.ui:58
+msgid ""
+"To set Commit as default editor for Git run the following command in Terminal"
+msgstr ""
+
+#: src/welcome.ui:90 src/welcome.ui:172
+msgid "Copy to Clipboard"
+msgstr ""
+
+#: src/welcome.ui:104 src/welcome.ui:181
+msgid "Documentation"
+msgstr ""
+
+#: src/welcome.ui:108
+msgid ""
+"https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_editor"
+msgstr ""
+
+#. TRANSLATORS: Don't translate hgrc
+#: src/welcome.ui:139
+msgid ""
+"To set Commit as default editor for Mercurial, set the following in your "
+"hgrc"
+msgstr ""
+
+#: src/welcome.ui:185
+msgid "https://www.mercurial-scm.org/wiki/editor"
+msgstr ""
+
+#: src/welcome.ui:214
+msgid "About Commit"
+msgstr ""
+
+#: src/welcome.ui:221
+msgid "Quit"
+msgstr ""
diff --git a/re.sonny.Commit b/re.sonny.Commit
index 98e4d1e..d973c3f 100755
--- a/re.sonny.Commit
+++ b/re.sonny.Commit
@@ -34,6 +34,7 @@ import("./src/main.js")
loop.quit();
main([programInvocationName, ...ARGV], {
version: "dev",
+ datadir: '.'
});
})
.catch(logError);
diff --git a/src/about.js b/src/about.js
index 5f6f57c..3bf628d 100644
--- a/src/about.js
+++ b/src/about.js
@@ -1,18 +1,22 @@
import Gtk from "gi://Gtk";
+import { gettext as _ } from 'gettext';
export default function About({ application, version }) {
// https://gjs-docs.gnome.org/gtk30~3.24.8/gtk.aboutdialog
const dialog = new Gtk.AboutDialog({
+ application,
authors: ["Sonny Piers https://sonny.re", "Aral Balkan https://ar.al/"],
- comments: "Commit message editor",
+ comments: _("Commit message editor"),
copyright:
- "Copyright 2020-2021 Sonny Piers\nCopyright 2018-2020 Aral balkan",
+ "© 2020-2021 Sonny Piers\n© 2018-2020 Aral balkan",
license_type: Gtk.License.GPL_3_0,
version,
website: "https://github.com/sonnyp/Commit",
transient_for: application.get_active_window(),
- // modal: true,
+ modal: true,
logo_icon_name: "re.sonny.Commit",
+ // TRANSLATORS: eg. 'Translator Name ' or 'Translator Name '
+ translator_credits: _('translator-credits')
});
dialog.add_credit_section("Contributors", [
// Add yourself as
diff --git a/src/main.js b/src/main.js
index 6d1f4ac..1c235a5 100644
--- a/src/main.js
+++ b/src/main.js
@@ -3,13 +3,17 @@ import "./setup.js";
import Gio from "gi://Gio";
import GLib from "gi://GLib";
import { programInvocationName } from "system";
+import { bindtextdomain, textdomain } from "gettext";
import Application from "./application.js";
GLib.set_prgname("re.sonny.Commit");
GLib.set_application_name("Commit");
-export default function main(argv, { version }) {
+export default function main(argv, { version, datadir }) {
+ bindtextdomain("re.sonny.Commit", GLib.build_filenamev([datadir, "locale"]));
+ textdomain("re.sonny.Commit");
+
const application = new Application({ version });
if (__DEV__) {
diff --git a/src/preferences.ui b/src/preferences.ui
index 9549a18..a600649 100644
--- a/src/preferences.ui
+++ b/src/preferences.ui
@@ -3,6 +3,7 @@