fix(prefs): translations not working, drop gresource use #89

Merged
kiyui merged 3 commits from fix-i18n into main 8 months ago
  1. 4
      meson.build
  2. 2
      po/ms.po
  3. 2
      po/night-light-slider.timur@linux.com.pot
  4. 12
      src/meson.build
  5. 1
      src/metadata.json.in
  6. 6
      src/org.gnome.shell.extensions.nightlightslider.data.gresource.xml
  7. 7
      src/prefs.js
  8. 2
      src/prefs.ui

4
meson.build

@ -1,5 +1,5 @@
project('night-light-slider.timur@linux.com',
version: '21',
version: '22',
license: 'GPL2+',
meson_version: '>= 0.50.0')
@ -26,7 +26,7 @@ custom_target('extension.zip',
command: [
'gnome-extensions', 'pack', prefixdir/extensiondir,
'--extra-source', 'convenience.js',
'--extra-source', gse_prefix + '.data.gresource',
'--extra-source', 'prefs.ui',
'--schema', prefixdir/schemadir/gse_prefix + '.gschema.xml',
'--podir', meson.current_source_dir()/'po',
'--gettext-domain', gettext_domain,

2
po/ms.po

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: night-light-slider.timur@linux.com\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-27 15:28+0800\n"
"POT-Creation-Date: 2021-04-11 00:51+0800\n"
"PO-Revision-Date: 2020-11-15 21:19+0800\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"

2
po/night-light-slider.timur@linux.com.pot

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: night-light-slider.timur@linux.com\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-27 15:28+0800\n"
"POT-Creation-Date: 2021-04-11 00:51+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

12
src/meson.build

@ -1,17 +1,8 @@
# Compile GResource objects
gresource_data = gnome.compile_resources(
gse_prefix + '.data',
gse_prefix + '.data.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: extensiondir
)
# Collect sources
gse_sources = files([
'convenience.js',
'extension.js',
'prefs.js',
'prefs.ui',
])
# Create metadata file
@ -20,7 +11,6 @@ gse_conf.set('uuid', gse_uuid)
gse_conf.set('version', meson.project_version())
gse_conf.set('settings_schema', gse_prefix)
gse_conf.set('gettext_domain', gettext_domain)
gse_conf.set('gresource_data', gse_prefix + '.data.gresource')
metadata_json = configure_file(
input: 'metadata.json.in',
output: 'metadata.json',

1
src/metadata.json.in

@ -3,7 +3,6 @@
"version": @version@,
"settings-schema": "@settings_schema@",
"gettext-domain": "@gettext_domain@",
"gresource-data": "@gresource_data@",
"name": "Night Light Slider",
"description": "A GNOME extension to manage the built-in night light temperature",
"shell-version": ["40.0"],

6
src/org.gnome.shell.extensions.nightlightslider.data.gresource.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/extensions/nightlightslider">
<file>prefs.ui</file>
</gresource>
</gresources>

7
src/prefs.js

@ -23,17 +23,12 @@ const {GObject, Gio, Gtk} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
// Register resources
const resource = Me.metadata['gresource-data'];
const resourceFile = Me.dir.get_child(resource);
Gio.resources_register(Gio.Resource.load(resourceFile.get_path()));
// GSettings schema
const COLOR_SCHEMA = 'org.gnome.settings-daemon.plugins.color';
var NightLightExtensionPrefs = GObject.registerClass({
GTypeName: 'NightLightExtensionPrefs',
Template: 'resource:///org/gnome/shell/extensions/nightlightslider/prefs.ui',
Template: Me.dir.get_child('prefs.ui').get_uri(),
InternalChildren: [
/* Night Light status infobar */
'infobar_status', 'btn_enable_night_light',

2
src/prefs.ui

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<interface domain="night-light-slider.timur@linux.com">
<template class="NightLightExtensionPrefs" parent="GtkBox">
<property name="orientation">vertical</property>
<child>

Loading…
Cancel
Save