diff --git a/.github/release-nest-v3 b/.github/release-nest-v3
index 56a6051..d8263ee 100644
--- a/.github/release-nest-v3
+++ b/.github/release-nest-v3
@@ -1 +1 @@
-1
\ No newline at end of file
+2
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1de5659
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+target
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 46675bf..e780258 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ install:
mkdir -p $(DESTDIR)/usr/share/
mkdir -p $(DESTDIR)/usr/lib/pika/pika-welcome/scripts/
cp -rvf data/scripts/*.sh $(DESTDIR)/usr/lib/pika/pika-welcome/scripts/
+ cp -rvf locales /usr/lib/pika/pika-welcome/locales
chmod 755 $(DESTDIR)/usr/lib/pika/pika-welcome/scripts/*.sh
cp data/com.github.pikaos-linux.pikawelcome.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas/
mkdir -p $(DESTDIR)/usr/share/applications
diff --git a/data/config/contribute.json b/data/config/contribute.json
index cc19424..cdc278f 100644
--- a/data/config/contribute.json
+++ b/data/config/contribute.json
@@ -2,11 +2,11 @@
"contribute": [
{
"id": 0,
- "title": "contribute-github-title",
- "subtitle": "contribute-github-subtitle",
- "icon": "pika-github",
+ "title": "contribute-gitea-title",
+ "subtitle": "contribute-gitea-subtitle",
+ "icon": "pika-gitea",
"button": "launch-label",
- "command": "xdg-open https://github.com/PikaOS-Linux"
+ "command": "xdg-open https://git.pika-os.com"
},
{
"id": 0,
@@ -14,7 +14,7 @@
"subtitle": "translate-weblate-subtitle",
"icon": "pika-weblate",
"button": "launch-label",
- "command": "xdg-open https://hosted.weblate.org/projects/pikaos/"
+ "command": "xdg-open https://weblate.pika-os.com"
}
]
}
\ No newline at end of file
diff --git a/data/config/look_and_feel.json b/data/config/look_and_feel.json
index 1e0f7bd..5b00d78 100644
--- a/data/config/look_and_feel.json
+++ b/data/config/look_and_feel.json
@@ -15,7 +15,7 @@
"subtitle": "open-pika-gnome-layouts-subtitle",
"icon": "pika-desktop",
"button": "launch-label",
- "onlyin": "pika",
+ "onlyin": "gnome",
"command": "/usr/bin/pika-gnome-layouts"
},
{
@@ -24,7 +24,7 @@
"subtitle": "open-gnome-tweaks-subtitle",
"icon": "pika-applications-graphics",
"button": "launch-label",
- "onlyin": "pika",
+ "onlyin": "gnome",
"command": "/usr/bin/gnome-tweaks"
},
{
@@ -33,7 +33,7 @@
"subtitle": "open-gnome-extensions-subtitle",
"icon": "pika-application-x-addon",
"button": "launch-label",
- "onlyin": "pika",
+ "onlyin": "gnome",
"command": "/usr/bin/extension-manager"
}
]
diff --git a/data/config/troubleshoot.json b/data/config/troubleshoot.json
index ec258f0..a2964ea 100644
--- a/data/config/troubleshoot.json
+++ b/data/config/troubleshoot.json
@@ -6,7 +6,7 @@
"subtitle": "open-pika-wiki-title-subtitle",
"icon": "pika-emblem-important",
"button": "launch-label",
- "command": "zenity --error --text 'Coming Soon :('"
+ "command": "xdg-open https://wiki.pika-os.com"
}
]
}
\ No newline at end of file
diff --git a/data/icons/hicolor/64x64/apps/pika-gitea.svg b/data/icons/hicolor/64x64/apps/pika-gitea.svg
new file mode 100644
index 0000000..671cf68
--- /dev/null
+++ b/data/icons/hicolor/64x64/apps/pika-gitea.svg
@@ -0,0 +1,8 @@
+
+
diff --git a/data/scripts/software-manager.sh b/data/scripts/software-manager.sh
index 5e44f1f..6a909fe 100755
--- a/data/scripts/software-manager.sh
+++ b/data/scripts/software-manager.sh
@@ -7,4 +7,4 @@ then
plasma-discover "$@"
else
zenity --error --text "$XDG_SESSION_DESKTOP does have a registered software-manager"
-fi
\ No newline at end of file
+fi
diff --git a/data/scripts/update-manager.sh b/data/scripts/update-manager.sh
index 5e44f1f..dfc486f 100755
--- a/data/scripts/update-manager.sh
+++ b/data/scripts/update-manager.sh
@@ -1,10 +1,8 @@
#!/bin/bash
-if echo $XDG_SESSION_DESKTOP | grep -i -E 'gnome|pika|ubuntu'
+
+if [ -f /usr/bin/pikman-update-manager ]
then
- gnome-software "$@"
-elif echo $XDG_SESSION_DESKTOP | grep -i -E 'plasma|kde'
-then
- plasma-discover "$@"
+ pikman-update-manager
else
- zenity --error --text "$XDG_SESSION_DESKTOP does have a registered software-manager"
-fi
\ No newline at end of file
+ /usr/lib/pika/pika-welcome/scripts/software-manager.sh
+fi
diff --git a/debian/changelog b/debian/changelog
index 50d9f0d..26c3906 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-pika-welcome (5.0.0-101pika1) pika; urgency=low
+pika-welcome (5.0.0-101pika2) pika; urgency=low
* Port to PikaOS 4
diff --git a/debian/rules b/debian/rules
index 3a06d71..15a9340 100755
--- a/debian/rules
+++ b/debian/rules
@@ -30,6 +30,7 @@ override_dh_auto_install:
mkdir -p debian/pika-welcome/usr/share/
mkdir -p debian/pika-welcome/usr/lib/pika/pika-welcome/scripts/
cp -rvf data/scripts/*.sh debian/pika-welcome/usr/lib/pika/pika-welcome/scripts/
+ cp -rvf locales /usr/lib/pika/pika-welcome/locales
chmod 755 debian/pika-welcome/usr/lib/pika/pika-welcome/scripts/*.sh
cp data/com.github.pikaos-linux.pikawelcome.gschema.xml debian/pika-welcome/usr/share/glib-2.0/schemas/
mkdir -p debian/pika-welcome/usr/share/applications
diff --git a/locales/bg_BG.json b/locales/bg_BG.json
index 5e416bb..46645cd 100644
--- a/locales/bg_BG.json
+++ b/locales/bg_BG.json
@@ -56,8 +56,8 @@
"open-gnome-tweaks-subtitle": "Отвори Gnome-tweaks.",
"open-gnome-extensions-title": "Добавяне на разширения към вашия работен плот",
"open-gnome-extensions-subtitle": "Отворете мениджъра за разширения на Gnome.",
- "contribute-github-title": "Посетете нашето Github хранилище",
- "contribute-github-subtitle": "Допринасяйте за кода или отваряйте заявки за проблеми в PikaOS Github.",
+ "contribute-gitea-title": "Посетете нашето Github хранилище",
+ "contribute-gitea-subtitle": "Допринасяйте за кода или отваряйте заявки за проблеми в PikaOS Github.",
"translate-weblate-title": "Посетете нашата Weblate страница",
"translate-weblate-subtitle": "Преведете приложенията ни на вашия език.",
"join-discord-title": "Присъединете се към нашия официален Discord",
diff --git a/locales/de_DE.json b/locales/de_DE.json
index 9c67d99..3680e75 100644
--- a/locales/de_DE.json
+++ b/locales/de_DE.json
@@ -56,8 +56,8 @@
"open-gnome-tweaks-subtitle": "Öffne Gnome-tweaks.",
"open-gnome-extensions-title": "Füge deinem Desktop Erweiterungen hinzu",
"open-gnome-extensions-subtitle": "Öffne den Gnome Erweiterungsmanager.",
- "contribute-github-title": "Besuche unser Github Repository",
- "contribute-github-subtitle": "Trage Code bei, öffne ein Problem oder erstelle eine Pull Anfrage an das PikaOS Github",
+ "contribute-gitea-title": "Besuche unser Github Repository",
+ "contribute-gitea-subtitle": "Trage Code bei, öffne ein Problem oder erstelle eine Pull Anfrage an das PikaOS Github",
"translate-weblate-title": "Besuche unsere Weblate-Seite",
"translate-weblate-subtitle": "Übersetze unsere Anwendungen in deine Sprache.",
"join-discord-title": "Tritt unserem offiziellen Discord bei",
diff --git a/locales/en_US.json b/locales/en_US.json
index f0b848a..1169721 100644
--- a/locales/en_US.json
+++ b/locales/en_US.json
@@ -56,8 +56,8 @@
"open-gnome-tweaks-subtitle": "Open gnome-tweaks.",
"open-gnome-extensions-title": "Add Extensions to your desktop",
"open-gnome-extensions-subtitle": "Open Gnome extension manager.",
- "contribute-github-title": "Visit Our Github Repository",
- "contribute-github-subtitle": "Contribute code or open issues and pull request to PikaOS Github.",
+ "contribute-gitea-title": "Visit Our Github Repository",
+ "contribute-gitea-subtitle": "Contribute code or open issues and pull request to PikaOS Github.",
"translate-weblate-title": "Visit Our Weblate Page",
"translate-weblate-subtitle": "Translate our Applications to your language.",
"join-discord-title": "Join Our Official Discord",
diff --git a/locales/fr_FR.json b/locales/fr_FR.json
index bb20574..01a4aca 100644
--- a/locales/fr_FR.json
+++ b/locales/fr_FR.json
@@ -56,8 +56,8 @@
"open-gnome-tweaks-subtitle": "",
"open-gnome-extensions-title": "",
"open-gnome-extensions-subtitle": "",
- "contribute-github-title": "",
- "contribute-github-subtitle": "",
+ "contribute-gitea-title": "",
+ "contribute-gitea-subtitle": "",
"translate-weblate-title": "",
"translate-weblate-subtitle": "",
"join-discord-title": "",
diff --git a/locales/nl_NL.json b/locales/nl_NL.json
index b4386b1..154c98f 100644
--- a/locales/nl_NL.json
+++ b/locales/nl_NL.json
@@ -56,8 +56,8 @@
"open-gnome-tweaks-subtitle": "",
"open-gnome-extensions-title": "",
"open-gnome-extensions-subtitle": "",
- "contribute-github-title": "",
- "contribute-github-subtitle": "",
+ "contribute-gitea-title": "",
+ "contribute-gitea-subtitle": "",
"translate-weblate-title": "",
"translate-weblate-subtitle": "",
"join-discord-title": "",
diff --git a/locales/tr_TR.json b/locales/tr_TR.json
index dfa6304..7e3c16e 100644
--- a/locales/tr_TR.json
+++ b/locales/tr_TR.json
@@ -56,8 +56,8 @@
"open-gnome-tweaks-subtitle": "gnome-tweaks'ı aç",
"open-gnome-extensions-title": "Masaüstünüze eklentiler ekleyin",
"open-gnome-extensions-subtitle": "Gnome eklenti yöneticisini aç",
- "contribute-github-title": "Github depomuzu ziyaret edin",
- "contribute-github-subtitle": "PikaOS Github kodların katkı yapın veya sorunlar ve pull talebi açın.",
+ "contribute-gitea-title": "Github depomuzu ziyaret edin",
+ "contribute-gitea-subtitle": "PikaOS Github kodların katkı yapın veya sorunlar ve pull talebi açın.",
"translate-weblate-title": "Weblate sayfamızı ziyaret edin",
"translate-weblate-subtitle": "Uygulamalarımızı dilinize çevirin.",
"join-discord-title": "Resmî Discord sunucumuza katılın",
diff --git a/src/main.rs b/src/main.rs
index bf8ebfe..b9c5383 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,9 +21,44 @@ mod save_window_size;
mod welcome_content_page;
// Init translations for current crate.
+use rust_i18n::Backend;
+use std::collections::HashMap;
+use std::fs;
+
+pub struct I18nBackend {
+ trs: HashMap>,
+}
+impl I18nBackend {
+ fn new() -> Self {
+ let mut trs = HashMap::new();
+ let locales_dir = fs::read_dir("/usr/lib/pika/pika-welcome/locales").expect("No translation files found");
+ for locale_file in locales_dir {
+ let locale_file_path = locale_file.expect("couldn't change dir entry to path").path();
+ let locale = String::from(locale_file_path.file_name().unwrap().to_str().unwrap().trim_end_matches(".json"));
+ let locale_data = fs::read_to_string(locale_file_path).expect(format!("invalid json for {}", locale).as_str());
+ let locale_json = serde_json::from_str::>(&locale_data).unwrap();
+ trs.insert(locale.to_string(), locale_json);
+ }
+
+ return Self {
+ trs
+ };
+ }
+}
+
+impl Backend for I18nBackend {
+ fn available_locales(&self) -> Vec<&str> {
+ return self.trs.keys().map(|k| k.as_str()).collect();
+ }
+
+ fn translate(&self, locale: &str, key: &str) -> Option<&str> {
+ return self.trs.get(locale)?.get(key).map(|k| k.as_str());
+ }
+}
+
#[macro_use]
extern crate rust_i18n;
-i18n!("locales", fallback = "en_US");
+i18n!(fallback = "en_US", backend = I18nBackend::new());
/// main function
fn main() {