summaryrefslogtreecommitdiff
path: root/raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js')
-rw-r--r--raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js b/raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js
new file mode 100644
index 0000000..af18232
--- /dev/null
+++ b/raveos-gnome-theme/theme-data/extensions/installed/ShutdownTimer@deminder/modules/translation.js
@@ -0,0 +1,51 @@
+// SPDX-FileCopyrightText: 2023 Deminder <tremminder@gmail.com>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import GLib from 'gi://GLib';
+
+/**
+ * The import paths for translations differ for `extension.js` and `prefs.js`.
+ * https://gjs.guide/extensions/upgrading/gnome-shell-45.html#esm
+ *
+ * This module provides shared access to translations.
+ * It is assumed that the gettext-domain is already bound.
+ */
+const domain = 'ShutdownTimer';
+
+/**
+ * Translate `str` using the extension's gettext domain
+ *
+ * @param {string} str - the string to translated
+ *
+ * @returns {string} the translated string
+ */
+export function gettext(str) {
+ return GLib.dgettext(domain, str);
+}
+
+/**
+ * Translate `str` and choose plural form using the extension's
+ * gettext domain
+ *
+ * @param {string} str - the string to translate
+ * @param {string} strPlural - the plural form of the string
+ * @param {number} n - the quantity for which translation is needed
+ *
+ * @returns {string} the translated string
+ */
+export function ngettext(str, strPlural, n) {
+ return GLib.dngettext(domain, str, strPlural, n);
+}
+
+/**
+ * Translate `str` in the context of `context` using the extension's
+ * gettext domain
+ *
+ * @param {string} context - context to disambiguate `str`
+ * @param {string} str - the string to translate
+ *
+ * @returns {string} the translated string
+ */
+export function pgettext(context, str) {
+ return GLib.dpgettext2(domain, context, str);
+}