Skip to content

Commit

Permalink
add gettext template and ru translation
Browse files Browse the repository at this point in the history
  • Loading branch information
LBCrion committed Dec 31, 2024
2 parents 48d1959 + 1d94eb0 commit ad539bd
Show file tree
Hide file tree
Showing 16 changed files with 444 additions and 63 deletions.
4 changes: 2 additions & 2 deletions config/alsa-module.widget
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ layout {
button {
value = $XAlsaIcon
trigger = "alsa"
tooltip = "Volume: " + Str(XAlsaVolume,0) + "%" +
If(XAlsaMuted," (muted)","")
tooltip = GT("Volume") + ": " + Str(XAlsaVolume,0) + "%" +
If(XAlsaMuted," (" + GT("muted") + ")","")
style = If(Ident(alsa),"module","hidden")
action[Ctrl+LeftClick] = AlsaCmd "playback-mute toggle"
action[RightClick] = PopUp "XAlsaWindow"
Expand Down
2 changes: 1 addition & 1 deletion config/alsa.widget
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ layout {
style = "module"
button {
value = $AlsaIcon
tooltip = "Volume: " + Str(AlsaVolume,0) + "%" + If(AlsaMuted," (muted)","")
tooltip = GT("Volume") + ": " + Str(AlsaVolume,0) + "%" + If(AlsaMuted," (" + GT("muted") + ")","")
style = If(Ident($AlsaVolume),"module","hidden")
trigger = "alsactl"
action[LeftClick] = Exec "amixer sset Master toggle\n"
Expand Down
6 changes: 3 additions & 3 deletions config/battery-svg.widget
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ layout {
action[0] = PipeRead If(!Ident(BSDCtl),XBatteryInit,"")
value = $XBatterySvg
style = If(!Ident($XBatteryState) & !Ident(BSDCtl),"hidden","module")
tooltip = Str(XBatteryLevel) + "%" + If(XBatteryTime, " " +
Str(XBatteryTime/60 - XBatteryTime%60/60) + "h" +
Str(XBatteryTime%60) + "m", "")
tooltip = GT("Battery") + ": " + Str(XBatteryLevel) + "%" + If(XBatteryTime, " " +
Str(XBatteryTime/60 - XBatteryTime%60/60) + GT("h") +
Str(XBatteryTime%60) + GT("m"), "")
interval = 1000
}
}
2 changes: 1 addition & 1 deletion config/bluez-popup.widget
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Function("XBluezUpdate") {
"loc(1,0,2,1)" +
"} " +
"label '" + BluezGet("Path") +"_status' {" +
"value = '" + If(BluezState("Connecting")," Connecting ...","") + "' " +
"value = '" + If(BluezState("Connecting")," " + GT("Connecting") + " ...","") + "' " +
"style = 'XBluezStatus' " +
"interval = 0 " +
"loc(2,1,1,1)" +
Expand Down
19 changes: 10 additions & 9 deletions config/bluez.widget
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module("bluez")

TriggerAction "bluez_updated", Function "XBluezUpdate"
TriggerAction "bluez_removed", Function "XBluezRemove"
TriggerAction "bluez_scan", SetValue "XBluezScanButton", "Scanning ..."
TriggerAction "bluez_scan_complete", SetValue "XBluezScanButton", "Scan"
TriggerAction "bluez_scan", SetValue "XBluezScanButton", GT("Scanning") + " ..."
TriggerAction "bluez_scan_complete", SetValue "XBluezScanButton", GT("Scan")

set XBluezTmpl = "
grid 'XBluezGrid@BLUEZ_PAIRED@' {
Expand Down Expand Up @@ -39,10 +39,10 @@ grid 'XBluezGrid@BLUEZ_PAIRED@' {
}"

Menu("XBluezItemMenu") {
item("Connect", BluezConnect Extract(WidgetId(),"(.*)_grid") );
item("Disconnect", BluezDisConnect Extract(WidgetId(),"(.*)_grid") );
item("Pair", BluezPair Extract(WidgetId(),"(.*)_grid") );
item("Remove", BluezRemove Extract(WidgetId(),"(.*)_grid") );
item(GT("Connect"), BluezConnect Extract(WidgetId(),"(.*)_grid") );
item(GT("Disconnect"), BluezDisConnect Extract(WidgetId(),"(.*)_grid") );
item(GT("Pair"), BluezPair Extract(WidgetId(),"(.*)_grid") );
item(GT("Remove"), BluezRemove Extract(WidgetId(),"(.*)_grid") );
}

Function("XBluezUpdate") {
Expand Down Expand Up @@ -91,21 +91,21 @@ PopUp "XBluezWindow" {
}
style = "XBluezFrame"
label {
value = "Paired devices"
value = GT("Paired devices")
style = "XBluezSeparator"
}
grid "XBluezGridPaired" {
style = "XBluezSection"
}
label {
value = "Available devices"
value = GT("Available devices")
style = "XBluezSeparator"
}
grid "XBluezGridAvail" {
style = "XBluezSection"
}
label "XBluezScanButton" {
value = "Scan"
value = GT("Scan")
style = "XBluezScan"
action = BluezScan
}
Expand All @@ -119,6 +119,7 @@ layout {
style = "module"
value = "bluetooth"
action = Function "XBluezPop"
tooltip = "Bluetooth"
}
}

Expand Down
38 changes: 19 additions & 19 deletions config/cal.widget
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ Set XCalMOff = (Val(Map(Str(XCalMonth),
"0"))+If(XCalMonth>2 & XCalYearIsLeap,1,0))%7

Set XCalDate = Map(Str(XCalMonth),
"1", "January",
"2", "February",
"3", "March",
"4", "April",
"5", "May",
"6", "June",
"7", "July",
"8", "August",
"9", "September",
"10", "October",
"11", "November",
"12", "December",
"1", GT("January"),
"2", GT("February"),
"3", GT("March"),
"4", GT("April"),
"5", GT("May"),
"6", GT("June"),
"7", GT("July"),
"8", GT("August"),
"9", GT("September"),
"10", GT("October"),
"11", GT("November"),
"12", GT("December"),
"Huh?") + " " + Str(XCalYear)

Function("XCalPopUp") {
Expand Down Expand Up @@ -170,37 +170,37 @@ Popup("XCal") {
loc(1,4)
style = 'cal_grid'
label {
value = "Mo"
value = GT("Mo")
style = "cal_cell_current"
loc(0,0)
}
label {
value = "Tu"
value = GT("Tu")
style = "cal_cell_current"
loc(1,0)
}
label {
value = "We"
value = GT("We")
style = "cal_cell_current"
loc(2,0)
}
label {
value = "Th"
value = GT("Th")
style = "cal_cell_current"
loc(3,0)
}
label {
value = "Fr"
value = GT("Fr")
style = "cal_cell_current"
loc(4,0)
}
label {
value = "Sa"
value = GT("Sa")
style = "cal_cell_current"
loc(5,0)
}
label {
value = "Su"
value = GT("Su")
style = "cal_cell_current"
loc(6,0)
}
Expand Down
2 changes: 1 addition & 1 deletion config/memory.widget
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout {
interval = 1000
style = If(XMemPresent,"memory","hidden")
value = XMemUtilization
tooltip = "Memory: " + Str(XMemUtilization*100) + "%"
tooltip = GT("Memory") + ": " + Str(XMemUtilization*100) + "%"
action = Exec $Term + " -e top -o %MEM"
}
}
2 changes: 1 addition & 1 deletion config/ncenter.widget
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Function("XNotificationRemove") {
PopUp "XNotificationWindow" {
style = "notification_popup"
label {
value = "Notification Center"
value = GT("Notification Center")
style = "notification_header"
loc(1,1,2,1)
}
Expand Down
2 changes: 1 addition & 1 deletion config/showdesktop.widget
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ layout {
button {
value = "user-desktop"
style = "showdesktop"
tooltip = "Show Desktop"
tooltip = GT("Show Desktop")
action = Function "target", "ShowDesktop"
}
taskbar "target" {
Expand Down
2 changes: 1 addition & 1 deletion config/startmenu.widget
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ layout {
value = "open-menu"
style = "startmenu"
action = Menu "app_menu_system"
tooltip = "Application menu"
tooltip = GT("Application menu")
}
}
20 changes: 10 additions & 10 deletions config/volume.widget
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Menu('XVolumeSinkMenu') {
}"

Menu('XVolumeDeviceMenu') {
Item("Set As Default Device",
Item(GT("Set As Default Device"),
{ VolumeCtl 'sink-set-default-device ' + Extract(WidgetId(), '(.*)_name') } )
}

Expand All @@ -43,7 +43,7 @@ grid 'volume_section_@DEVICE_IFACE@' {
image '@DEVICE_ID@_expand' {
value = 'pan-end'
style = 'volume_control_expander'
tooltip = 'expand/collapse channels'
tooltip = GT('expand/collapse channels')
action = Function 'XVolumeToggleChannels'
loc(2,1,1,1)
}
Expand All @@ -61,15 +61,15 @@ grid 'volume_section_@DEVICE_IFACE@' {
'checkbox-checked', 'checkbox')
style = If('@DEVICE_IFACE@' = 'sink' & Volume('sink-count')>1,
'volume_default', 'hidden')
tooltip = 'set as default @DEVICE_IFACE@'
tooltip = GT('set as default') + ' @DEVICE_IFACE@'
trigger = 'volume'
action = VolumeCtl '@DEVICE_IFACE@-set-default @DEVICE_ID@'
}
image '@DEVICE_ID@_menu' {
value = 'open-menu'
style = If('@DEVICE_IFACE@' = 'client' & Volume('sink-count')>1,
'volume_client_menu', 'hidden')
tooltip = 'route to sink'
tooltip = GT('route to sink')
action = Menu 'XVolumeSinkMenu'
trigger = 'volume'
}
Expand Down Expand Up @@ -152,15 +152,15 @@ TriggerAction "volume-conf-removed", Function "XVolumeChannelRemove"
PopUp "XVolumeWindow" {
style = "volume_popup"
label {
value = "sinks"
value = GT("sinks")
style = If(Volume("sink-count")>0, "volume_separator", "hidden")
trigger = "volume"
}
grid "volume_section_sink" {
style = "volume_section"
}
label {
value = "clients"
value = GT("clients")
style = If(Volume("client-count")>0, "volume_separator", "hidden")
trigger = "volume"
}
Expand All @@ -179,11 +179,11 @@ layout {
0, $XVolumeLowIcon,
$XVolumeMutedIcon))
trigger = "volume"
tooltip = "Volume: " + Str(Volume("sink-volume"),0) + "%" +
tooltip = GT("Volume") + ": " + Str(Volume("sink-volume"),0) + "%" +
If(Volume("sink-mute")," (muted)","") +
"\nForm: " + VolumeInfo("sink-form") +
"\nPort: " + VolumeInfo("sink-port") +
"\nMonitor: " + VolumeInfo("sink-monitor")
"\n" + GT("Form") + ": " + VolumeInfo("sink-form") +
"\n" + GT("Port") + ": " + VolumeInfo("sink-port") +
"\n" + GT("Monitor") + ": " + VolumeInfo("sink-monitor")
style = If(Ident(volume),"module","hidden")
action[RightClick] = VolumeCtl "sink-mute toggle"
action[MiddleClick] = Exec $XPulseAction
Expand Down
23 changes: 14 additions & 9 deletions config/wifi.widget
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module("wifi-iwd")

TriggerAction "wifi_updated", Function "XWifiUpdate"
TriggerAction "wifi_removed", Function "XWifiRemove"
TriggerAction "wifi_scan", SetValue "XWifiScanButton", "Scanning ..."
TriggerAction "wifi_scan_complete", SetValue "XWifiScanButton", "Scan"
TriggerAction "wifi_scan", SetValue "XWifiScanButton", GT("Scanning") + " ..."
TriggerAction "wifi_scan_complete", SetValue "XWifiScanButton", GT("Scan")

define XWifiIcon = "network-wireless-signal-" +
Lookup(Val(WifiGet("Strength")),
Expand Down Expand Up @@ -61,9 +61,9 @@ Function("XWifiConnect") {
}

Menu("XWifiItemMenu") {
item("Connect", Function "XWifiConnect" );
item("Disconnect", WifiDisconnect Extract(WidgetId(),"(.*)_grid") );
item("Forget", WifiForget Extract(WidgetId(),"(.*)_grid") );
item(GT("Connect"), Function "XWifiConnect" );
item(GT("Disconnect"), WifiDisconnect Extract(WidgetId(),"(.*)_grid") );
item(GT("Forget"), WifiForget Extract(WidgetId(),"(.*)_grid") );
}

PopUp "XWifiWindow" {
Expand All @@ -75,21 +75,21 @@ PopUp "XWifiWindow" {
}
style = "XWifiFrame"
label {
value = "Known networks"
value = GT("Known networks")
style = "XWifiSeparator"
}
grid "XWifiGridKnown" {
style = "XWifiSection"
}
label {
value = "Other networks"
value = GT("Other networks")
style = "XWifiSeparator"
}
grid "XWifiGridOther" {
style = "XWifiSection"
}
label "XWifiScanButton" {
value = "Scan"
value = GT("Scan")
style = "XWifiScan"
action = WifiScan
}
Expand Down Expand Up @@ -142,7 +142,7 @@ image#XWifiIconConnected {
}

image#XWifiIconConnected {
color: red;
color: green;
}

label#XWifiHeader {
Expand Down Expand Up @@ -193,3 +193,8 @@ label#wifi_dialog_title {
margin: 10px;
}

#wifi_button_ok,
#wifi_user_entry,
#wifi_passphrase_entry {
background-color: @theme_bg_color;
}
12 changes: 8 additions & 4 deletions config/winops.widget
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ function("ToggleMaximize") {
}

menu("winops") {
item("focus", Focus );
item("close", Close );
item("(un)minimize", Function "ToggleMinimize" );
item("(un)maximize", Function "ToggleMaximize" );
# item(" focus%gtk-find", Focus );
# item(" close%window-close-symbolic", Close );
# item(" (un)minimize%window-minimize-symbolic", Function "ToggleMinimize" );
# item(" (un)maximize%window-maximize-symbolic", Function "ToggleMaximize" );
item(" "+GT("focus")+"%gtk-find", Focus );
item(" "+GT("close")+"%window-close-symbolic", Close );
item(" "+GT("(un)minimize")+"%window-minimize-symbolic", Function "ToggleMinimize" );
item(" "+GT("(un)maximize")+"%window-maximize-symbolic", Function "ToggleMaximize" );
}
3 changes: 2 additions & 1 deletion doc/sfwbar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ Operation Description
``>`` greater than
``>=`` greater than or equal
``<`` less than
``>=`` less than or equal
``<=`` less than or equal
``=`` equal
``Val`` convert a string into a number, the argument is a string or a
string expression to convert.
Expand Down Expand Up @@ -868,6 +868,7 @@ Operation Description
function will return DefaultString.
``ReplaceAll`` Perform multiple substring replacements in a string,
``ReplaceAll(string, old1, new1, ... )``
``GT`` gettext substring i.e. ``GT("msgid" [,"domain"])``
============== ===================================================================

In addition the following query functions are supported
Expand Down
Loading

0 comments on commit ad539bd

Please sign in to comment.