On local/yoda-main: yoda: version git + i18n tweaks
This commit is contained in:
commit
e822ecd564
4 changed files with 37 additions and 0 deletions
|
|
@ -2,7 +2,33 @@ use std::path::PathBuf;
|
|||
use std::{env, fs};
|
||||
use xdgen::{App, Context, FluentString};
|
||||
|
||||
fn get_cosmic_version() -> String {
|
||||
// Try to get version from git describe
|
||||
if let Ok(output) = std::process::Command::new("git")
|
||||
.args(["describe", "--tags", "--always", "--dirty"])
|
||||
.output()
|
||||
{
|
||||
if output.status.success() {
|
||||
let version = String::from_utf8_lossy(&output.stdout)
|
||||
.trim()
|
||||
.to_string();
|
||||
if !version.is_empty() && version != "unknown" {
|
||||
return format!("COSMIC {}", version);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fallback to cargo package version
|
||||
format!("COSMIC {}", env::var("CARGO_PKG_VERSION").unwrap_or_else(|_| "unknown".to_string()))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Print the version for debugging
|
||||
let version = get_cosmic_version();
|
||||
println!("cargo:warning=COSMIC version: {}", version);
|
||||
|
||||
// Set as a compile-time constant
|
||||
println!("cargo:rustc-env=COSMIC_VERSION={}", version);
|
||||
|
||||
let ctx = Context::new("../i18n", env::var("CARGO_PKG_NAME").unwrap()).unwrap();
|
||||
|
||||
[
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ fn os() -> Section<crate::pages::Message> {
|
|||
os = fl!("about-os", "os");
|
||||
os_arch = fl!("about-os", "os-architecture");
|
||||
kernel = fl!("about-os", "kernel");
|
||||
cosmic_version = fl!("about-os", "cosmic-version");
|
||||
desktop = fl!("about-os", "desktop-environment");
|
||||
windowing_system = fl!("about-os", "windowing-system");
|
||||
});
|
||||
|
|
@ -272,6 +273,13 @@ fn os() -> Section<crate::pages::Message> {
|
|||
settings::flex_item(&*desc[kernel], text::body(&page.info.kernel_version))
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.add(
|
||||
settings::flex_item(
|
||||
&*desc[cosmic_version],
|
||||
text::body(&page.info.cosmic_version),
|
||||
)
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.add(
|
||||
settings::flex_item(
|
||||
&*desc[desktop],
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use std::process::Command;
|
|||
#[must_use]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Info {
|
||||
pub cosmic_version: String,
|
||||
pub desktop_environment: String,
|
||||
pub device_name: String,
|
||||
pub disk_capacity: String,
|
||||
|
|
@ -144,6 +145,7 @@ impl Info {
|
|||
|
||||
pub async fn load() -> Info {
|
||||
let mut info = Info {
|
||||
cosmic_version: env!("COSMIC_VERSION").to_string(),
|
||||
os_architecture: architecture(),
|
||||
kernel_version: kernel_version(),
|
||||
hardware_model: hardware_model(),
|
||||
|
|
|
|||
1
i18n/en/cosmic_settings.ftl
vendored
1
i18n/en/cosmic_settings.ftl
vendored
|
|
@ -1012,6 +1012,7 @@ about-os = Operating system
|
|||
.os = Operating system
|
||||
.os-architecture = Operating system architecture
|
||||
.kernel = Kernel version
|
||||
.cosmic-version = COSMIC version
|
||||
.desktop-environment = Desktop environment
|
||||
.windowing-system = Windowing system
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue