Add runtime locales, update urls, update scripts
Some checks failed
PikaOS Package Build & Release (amd64-v3) / build (push) Failing after 2m27s
Some checks failed
PikaOS Package Build & Release (amd64-v3) / build (push) Failing after 2m27s
This commit is contained in:
parent
fb120f99ba
commit
3631846bb2
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
||||
1
|
||||
2
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
target
|
1
Makefile
1
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
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
8
data/icons/hicolor/64x64/apps/pika-gitea.svg
Normal file
8
data/icons/hicolor/64x64/apps/pika-gitea.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64px" height="64px" viewBox="0 0 64 64" version="1.1">
|
||||
<g id="surface1">
|
||||
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 39.589844 48.421875 L 26.898438 42.320312 C 25.648438 41.71875 25.109375 40.199219 25.71875 38.941406 L 31.820312 26.25 C 32.421875 25 33.941406 24.460938 35.199219 25.070312 C 36.921875 25.898438 37.910156 26.371094 37.910156 26.371094 L 37.898438 15.449219 L 39.570312 15.441406 L 39.578125 27.148438 C 39.578125 27.148438 45.320312 29.570312 47.890625 31.160156 C 48.261719 31.390625 48.910156 31.839844 49.179688 32.601562 C 49.390625 33.210938 49.378906 33.910156 49.078125 34.53125 L 42.980469 47.21875 C 42.359375 48.488281 40.839844 49.03125 39.589844 48.421875 Z M 39.589844 48.421875 "/>
|
||||
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(37.647059%,60%,14.901961%);fill-opacity:1;" d="M 62.269531 14.980469 C 61.859375 14.570312 61.308594 14.578125 61.308594 14.578125 C 61.308594 14.578125 49.589844 15.238281 43.519531 15.378906 C 42.191406 15.410156 40.871094 15.441406 39.558594 15.449219 C 39.558594 19.359375 39.558594 23.269531 39.558594 27.171875 C 39.011719 26.910156 38.449219 26.640625 37.898438 26.378906 C 37.898438 22.738281 37.890625 15.460938 37.890625 15.460938 C 34.988281 15.5 28.96875 15.238281 28.96875 15.238281 C 28.96875 15.238281 14.828125 14.53125 13.289062 14.390625 C 12.308594 14.328125 11.039062 14.179688 9.390625 14.539062 C 8.519531 14.71875 6.039062 15.28125 4.011719 17.230469 C -0.488281 21.238281 0.660156 27.621094 0.800781 28.578125 C 0.96875 29.75 1.488281 33 3.96875 35.828125 C 8.550781 41.441406 18.410156 41.308594 18.410156 41.308594 C 18.410156 41.308594 19.621094 44.199219 21.46875 46.859375 C 23.96875 50.171875 26.539062 52.75 29.039062 53.058594 C 35.339844 53.058594 47.929688 53.050781 47.929688 53.050781 C 47.929688 53.050781 49.128906 53.058594 50.761719 52.019531 C 52.160156 51.171875 53.410156 49.679688 53.410156 49.679688 C 53.410156 49.679688 54.699219 48.300781 56.5 45.148438 C 57.050781 44.179688 57.511719 43.238281 57.910156 42.351562 C 57.910156 42.351562 63.429688 30.640625 63.429688 19.238281 C 63.320312 15.789062 62.46875 15.179688 62.269531 14.980469 Z M 12.558594 35.390625 C 9.96875 34.539062 8.871094 33.519531 8.871094 33.519531 C 8.871094 33.519531 6.960938 32.179688 6 29.539062 C 4.351562 25.121094 5.859375 22.421875 5.859375 22.421875 C 5.859375 22.421875 6.699219 20.171875 9.710938 19.421875 C 11.089844 19.050781 12.808594 19.109375 12.808594 19.109375 C 12.808594 19.109375 13.519531 25.050781 14.378906 28.53125 C 15.101562 31.449219 16.859375 36.300781 16.859375 36.300781 C 16.859375 36.300781 14.25 35.988281 12.558594 35.390625 Z M 42.589844 46.148438 C 42.589844 46.148438 41.980469 47.601562 40.628906 47.691406 C 40.050781 47.730469 39.601562 47.570312 39.601562 47.570312 C 39.601562 47.570312 39.570312 47.558594 39.070312 47.359375 L 27.78125 41.859375 C 27.78125 41.859375 26.691406 41.289062 26.5 40.300781 C 26.28125 39.488281 26.769531 38.488281 26.769531 38.488281 L 32.199219 27.300781 C 32.199219 27.300781 32.679688 26.328125 33.421875 26 C 33.480469 25.96875 33.648438 25.898438 33.871094 25.851562 C 34.679688 25.640625 35.671875 26.128906 35.671875 26.128906 L 46.738281 31.5 C 46.738281 31.5 48 32.070312 48.269531 33.121094 C 48.460938 33.859375 48.21875 34.519531 48.089844 34.839844 C 47.460938 36.378906 42.589844 46.148438 42.589844 46.148438 Z M 42.589844 46.148438 "/>
|
||||
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(37.647059%,60%,14.901961%);fill-opacity:1;" d="M 32.679688 38.011719 C 31.859375 38.019531 31.140625 38.589844 30.949219 39.390625 C 30.761719 40.191406 31.148438 41.019531 31.859375 41.390625 C 32.628906 41.789062 33.609375 41.570312 34.128906 40.851562 C 34.640625 40.140625 34.558594 39.160156 33.949219 38.539062 L 36.351562 33.628906 C 36.5 33.640625 36.71875 33.648438 36.96875 33.578125 C 37.378906 33.488281 37.679688 33.21875 37.679688 33.21875 C 38.101562 33.398438 38.539062 33.601562 39 33.828125 C 39.480469 34.070312 39.929688 34.320312 40.339844 34.558594 C 40.429688 34.609375 40.519531 34.671875 40.621094 34.75 C 40.78125 34.878906 40.960938 35.058594 41.089844 35.300781 C 41.28125 35.851562 40.898438 36.789062 40.898438 36.789062 C 40.671875 37.550781 39.058594 40.851562 39.058594 40.851562 C 38.25 40.828125 37.53125 41.351562 37.289062 42.101562 C 37.03125 42.910156 37.398438 43.828125 38.179688 44.230469 C 38.960938 44.628906 39.921875 44.398438 40.429688 43.699219 C 40.929688 43.019531 40.890625 42.070312 40.320312 41.441406 C 40.511719 41.070312 40.691406 40.699219 40.878906 40.308594 C 41.378906 39.269531 42.230469 37.269531 42.230469 37.269531 C 42.320312 37.101562 42.800781 36.238281 42.5 35.140625 C 42.25 34 41.238281 33.46875 41.238281 33.46875 C 40.019531 32.679688 38.320312 31.949219 38.320312 31.949219 C 38.320312 31.949219 38.320312 31.539062 38.210938 31.238281 C 38.101562 30.929688 37.929688 30.730469 37.820312 30.609375 C 38.289062 29.640625 38.761719 28.679688 39.230469 27.710938 C 38.820312 27.511719 38.421875 27.308594 38.011719 27.101562 C 37.53125 28.078125 37.039062 29.070312 36.558594 30.050781 C 35.890625 30.039062 35.269531 30.398438 34.949219 30.988281 C 34.609375 31.621094 34.679688 32.398438 35.140625 32.96875 C 34.320312 34.648438 33.5 36.328125 32.679688 38.011719 Z M 32.679688 38.011719 "/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.4 KiB |
@ -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"
|
||||
/usr/lib/pika/pika-welcome/scripts/software-manager.sh
|
||||
fi
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -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
|
||||
|
||||
|
1
debian/rules
vendored
1
debian/rules
vendored
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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": "",
|
||||
|
@ -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": "",
|
||||
|
@ -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",
|
||||
|
37
src/main.rs
37
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<String, HashMap<String, String>>,
|
||||
}
|
||||
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::<HashMap<String, String>>(&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() {
|
||||
|
Loading…
Reference in New Issue
Block a user