🌐 ags(i18n): translate control-center pages
This commit is contained in:
@@ -3,12 +3,13 @@ import { Gtk, Widget } from "astal/gtk3";
|
||||
import AstalBluetooth from "gi://AstalBluetooth";
|
||||
import { Page, PageButton } from "./Page";
|
||||
import { Separator, SeparatorProps } from "../../Separator";
|
||||
import { tr } from "../../../i18n/intl";
|
||||
|
||||
|
||||
export const BluetoothPage: (() => Page) = () => new Page({
|
||||
id: "bluetooth",
|
||||
title: "Bluetooth",
|
||||
description: "Manage your Bluetooth devices and add new ones.",
|
||||
title: tr("control_center.pages.bluetooth.title"),
|
||||
description: tr("control_center.pages.bluetooth.description"),
|
||||
className: "bluetooth",
|
||||
headerButtons: [
|
||||
new Widget.Button({
|
||||
@@ -16,7 +17,9 @@ export const BluetoothPage: (() => Page) = () => new Page({
|
||||
label: bind(AstalBluetooth.get_default().adapter, "discovering").as((discovering) =>
|
||||
!discovering ? '' : ''),
|
||||
tooltipText: bind(AstalBluetooth.get_default().adapter, "discovering").as((discovering) =>
|
||||
!discovering ? "Start discovering" : "Stop discovery"),
|
||||
!discovering ?
|
||||
tr("control_center.pages.bluetooth.start_discovering")
|
||||
: tr("control_center.pages.bluetooth.stop_discovering")),
|
||||
onClick: () => {
|
||||
if(AstalBluetooth.get_default().adapter.discovering) {
|
||||
stopBluetoothDevicesWatch();
|
||||
@@ -36,7 +39,7 @@ export const BluetoothPage: (() => Page) = () => new Page({
|
||||
children: bind(AstalBluetooth.get_default(), "adapters").as((adapters) => [
|
||||
new Widget.Label({
|
||||
className: "sub-header",
|
||||
label: "Adapters"
|
||||
label: tr("control_center.pages.bluetooth.adapters")
|
||||
} as Widget.LabelProps),
|
||||
...adapters.map(adapter =>
|
||||
PageButton({
|
||||
@@ -64,7 +67,7 @@ export const BluetoothPage: (() => Page) = () => new Page({
|
||||
return [
|
||||
new Widget.Label({
|
||||
className: "sub-header",
|
||||
label: "Paired Devices",
|
||||
label: tr("control_center.pages.bluetooth.paired_devices"),
|
||||
xalign: 0,
|
||||
} as Widget.LabelProps),
|
||||
...connectedDevices.map((dev: AstalBluetooth.Device) => DeviceWidget(dev))
|
||||
@@ -82,7 +85,7 @@ export const BluetoothPage: (() => Page) = () => new Page({
|
||||
return [
|
||||
new Widget.Label({
|
||||
className: "sub-header",
|
||||
label: "Others",
|
||||
label: tr("control_center.pages.bluetooth.new_devices"),
|
||||
xalign: 0
|
||||
} as Widget.LabelProps),
|
||||
...discoveredDevices.map((dev: AstalBluetooth.Device) => DeviceWidget(dev))
|
||||
@@ -96,7 +99,7 @@ export const BluetoothPage: (() => Page) = () => new Page({
|
||||
} as SeparatorProps),
|
||||
new Widget.Button({
|
||||
className: "more",
|
||||
label: "More settings",
|
||||
label: tr("control_center.pages.more_settings"),
|
||||
setup: (self) => self.set_alignment(0, 0.5)
|
||||
} as Widget.ButtonProps)
|
||||
]
|
||||
|
||||
@@ -4,12 +4,13 @@ import { Gtk, Widget } from "astal/gtk3";
|
||||
import AstalWp from "gi://AstalWp";
|
||||
import { getAppIcon } from "../../../scripts/apps";
|
||||
import { Wireplumber } from "../../../scripts/volume";
|
||||
import { tr } from "../../../i18n/intl";
|
||||
|
||||
export function PageMixer(): Page {
|
||||
return new Page({
|
||||
id: "mixer",
|
||||
title: "Mixer",
|
||||
description: "Control per-application volume!",
|
||||
title: tr("control_center.pages.mixer.title"),
|
||||
description: tr("control_center.pages.mixer.description"),
|
||||
children: bind(Wireplumber.getWireplumber(), "endpoints").as((endpoints) => [
|
||||
...endpoints.filter((ep) => ep.mediaClass === AstalWp.MediaClass.AUDIO_STREAM ||
|
||||
ep.mediaClass === AstalWp.MediaClass.VIDEO_STREAM).map((ep) =>
|
||||
|
||||
@@ -6,10 +6,11 @@ import NM from "gi://NM";
|
||||
import { Separator, SeparatorProps } from "../../Separator";
|
||||
import { Windows } from "../../../windows";
|
||||
import AstalHyprland from "gi://AstalHyprland?version=0.1";
|
||||
import { tr } from "../../../i18n/intl";
|
||||
|
||||
export const PageNetwork: (() => Page) = () => new Page({
|
||||
id: "network",
|
||||
title: "Network",
|
||||
title: tr("control_center.pages.network.title"),
|
||||
className: "network",
|
||||
headerButtons: [
|
||||
new Widget.Button({
|
||||
@@ -33,7 +34,7 @@ export const PageNetwork: (() => Page) = () => new Page({
|
||||
|
||||
return [
|
||||
new Widget.Label({
|
||||
label: "Devices",
|
||||
label: tr("devices"),
|
||||
xalign: 0,
|
||||
className: "sub-header",
|
||||
} as Widget.LabelProps),
|
||||
@@ -43,7 +44,8 @@ export const PageNetwork: (() => Page) = () => new Page({
|
||||
deviceType === NM.DeviceType.WIFI ?
|
||||
"network-wireless-symbolic"
|
||||
: "network-wired-symbolic"),
|
||||
title: bind(dev, "interface").as(iface => iface ?? "Interface"),
|
||||
title: bind(dev, "interface").as(iface => iface ??
|
||||
tr("control_center.pages.network.interface")),
|
||||
extraButtons: [
|
||||
new Widget.Button({
|
||||
image: new Widget.Icon({
|
||||
@@ -83,7 +85,7 @@ export const PageNetwork: (() => Page) = () => new Page({
|
||||
new Widget.Label({
|
||||
className: "ssid",
|
||||
halign: Gtk.Align.START,
|
||||
label: ap.ssid.toArray().toString()
|
||||
label: ap.ssid.get_data()?.toString() ?? "Wi-Fi"
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "status",
|
||||
@@ -98,7 +100,7 @@ export const PageNetwork: (() => Page) = () => new Page({
|
||||
size: .2
|
||||
} as SeparatorProps),
|
||||
new Widget.Button({
|
||||
label: "More settings",
|
||||
label: tr("control_center.pages.more_settings"),
|
||||
setup: (self) => self.set_alignment(0, 0.5),
|
||||
onClick: () => {
|
||||
Windows.close("control-center");
|
||||
|
||||
@@ -3,16 +3,17 @@ import { Page, PageProps } from "./Page";
|
||||
import { bind } from "astal";
|
||||
import { NightLight } from "../../../scripts/nightlight";
|
||||
import { addSliderMarksFromMinMax } from "../../../scripts/widget-utils";
|
||||
import { tr } from "../../../i18n/intl";
|
||||
|
||||
export const PageNightLight: (() => Page) = () => new Page({
|
||||
id: "night-light",
|
||||
title: "Night Light",
|
||||
description: "Control night light and gamma filters",
|
||||
title: tr("control_center.pages.night_light.title"),
|
||||
description: tr("control_center.pages.night_light.description"),
|
||||
className: "night-light",
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "sub-header",
|
||||
label: "Temperature (blue-light filter)",
|
||||
label: tr("control_center.pages.night_light.temperature"),
|
||||
xalign: 0
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Slider({
|
||||
@@ -30,7 +31,7 @@ export const PageNightLight: (() => Page) = () => new Page({
|
||||
} as Widget.SliderProps),
|
||||
new Widget.Label({
|
||||
className: "sub-header",
|
||||
label: "Gamma (light filter)",
|
||||
label: tr("control_center.pages.night_light.gamma"),
|
||||
css: "margin-top: 6px;",
|
||||
xalign: 0
|
||||
} as Widget.LabelProps),
|
||||
|
||||
@@ -15,18 +15,18 @@ export const TileNetwork = () => new Widget.Box({
|
||||
(primary: AstalNetwork.Primary, wired: AstalNetwork.Wired, wifi: AstalNetwork.Wifi) => {
|
||||
if(primary === AstalNetwork.Primary.WIFI) {
|
||||
return Tile({
|
||||
title: tr("control_center.tiles.network.wireless") || "Wireless",
|
||||
title: tr("control_center.tiles.network.wireless"),
|
||||
description: Variable.derive(
|
||||
[ bind(wifi, "ssid"), bind(wifi, "internet") ],
|
||||
(ssid: string, internet: AstalNetwork.Internet) =>
|
||||
ssid ? ssid : (() => {
|
||||
switch(internet) {
|
||||
case AstalNetwork.Internet.CONNECTED:
|
||||
return tr("control_center.tiles.network.connected") || "Connected";
|
||||
return tr("connected");
|
||||
case AstalNetwork.Internet.DISCONNECTED:
|
||||
return tr("control_center.tiles.network.disconnected") || "Disconnected";
|
||||
return tr("disconnected");
|
||||
case AstalNetwork.Internet.CONNECTING:
|
||||
return tr("control_center.tiles.network.connecting") + "..." || "Connecting...";
|
||||
return tr("connecting") + "...";
|
||||
}
|
||||
})()
|
||||
)(),
|
||||
@@ -44,11 +44,11 @@ export const TileNetwork = () => new Widget.Box({
|
||||
description: bind(wired, "internet").as((internet: AstalNetwork.Internet) => {
|
||||
switch(internet) {
|
||||
case AstalNetwork.Internet.CONNECTED:
|
||||
return tr("control_center.tiles.network.connected") || "Connected";
|
||||
return tr("connected");
|
||||
case AstalNetwork.Internet.DISCONNECTED:
|
||||
return tr("control_center.tiles.network.disconnected") || "Disconnected";
|
||||
return tr("disconnected");
|
||||
case AstalNetwork.Internet.CONNECTING:
|
||||
return tr("control_center.tiles.network.connecting") + "..." || "Connecting...";
|
||||
return tr("connecting") + "...";
|
||||
}
|
||||
}),
|
||||
onToggledOn: () => execAsync("nmcli n on"),
|
||||
@@ -73,8 +73,8 @@ export const TileNetwork = () => new Widget.Box({
|
||||
}
|
||||
|
||||
return Tile({
|
||||
title: tr("control_center.tiles.network.network") || "Network",
|
||||
description: tr("control_center.tiles.network.disconnected") || "Disconnected",
|
||||
title: tr("control_center.tiles.network.network"),
|
||||
description: tr("disconnected"),
|
||||
onToggledOn: () => execAsync("nmcli n on"),
|
||||
onToggledOff: () => execAsync("nmcli n off"),
|
||||
onClickMore: () => TilesPages?.toggle(PageNetwork()),
|
||||
|
||||
Reference in New Issue
Block a user