Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BREAKING CHANGE) Fix the output of menubar.utils.parse_desktop_file().Actions to be locallized #3710

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/menubar/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,26 @@ function utils.parse_desktop_file(file)
program[key] = getter(keyfile, key)
end

-- By default, only the identifier of each action is added to `program`.
-- This will replace those actions with a (localized) table holding the
-- "actual" action data, including its Exec and Icon.
-- See https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#extra-actions
if program.Actions then
local corrected_actions = {}
local cur_action

for _, action in pairs(program.Actions) do
cur_action = "Desktop Action "..action
corrected_actions[action] = {}

for _, key in pairs(keyfile:get_keys(cur_action)) do
corrected_actions[action][key] = keyfile:get_locale_string(cur_action, key)
end
end

program.Actions = corrected_actions
end

-- In case the (required) 'Name' entry was not found
if not program.Name or program.Name == '' then return nil end

Expand Down