Skip to content

Command Palette: Add language names for the entirety of ISO 639 language codes #28

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 4 additions & 27 deletions command_palette.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ mp.register_event('log-message', function(e)
end)

local uosc_available = false
package.path = mp.command_native({ "expand-path", "~~/script-modules/?.lua;" }) .. package.path
local module_dir = mp.command_native({ "expand-path", "~~/script-modules/" })
package.path = module_dir .. '?.lua;' .. package.path
local languages = file_exists(module_dir .. 'language_table.lua') and require('language_table')

local em = require "extended-menu"
local menu = em:new(o)
Expand Down Expand Up @@ -351,32 +353,7 @@ local function fix_codec(value)
end

local function get_language(lng)
if lng == nil or lng == "" then
return lng
end

if lng == "ara" then lng = "Arabic" end
if lng == "ben" then lng = "Bangla" end
if lng == "bng" then lng = "Bangla" end
if lng == "chi" then lng = "Chinese" end
if lng == "zho" then lng = "Chinese" end
if lng == "eng" then lng = "English" end
if lng == "fre" then lng = "French" end
if lng == "fra" then lng = "French" end
if lng == "ger" then lng = "German" end
if lng == "deu" then lng = "German" end
if lng == "hin" then lng = "Hindi" end
if lng == "ita" then lng = "Italian" end
if lng == "jpn" then lng = "Japanese" end
if lng == "kor" then lng = "Korean" end
if lng == "msa" then lng = "Malay" end
if lng == "por" then lng = "Portuguese" end
if lng == "pan" then lng = "Punjabi" end
if lng == "rus" then lng = "Russian" end
if lng == "spa" then lng = "Spanish" end
if lng == "und" then lng = "Undetermined" end

return lng
return (languages and languages[lng] or lng)
end

local function format_track(track)
Expand Down
Loading