local L = GetLocale()

Merfin.GetContext = function(contextTable, var)
    if not contextTable then return nil end

    -- Fallback to enUS if current locale not found
    local data = contextTable[L] or contextTable['enUS']
    if not data then return nil end

    -- If it's a string, return string
    if type(data) == 'string' then
        return data
    end

    -- If it's a table
    if type(data) == 'table' then
        if var then
            -- If table is dictionary and var exists
            if data[var] ~= nil then
                return data[var]
            end
        end
        -- Return the whole table if var not provided or not found
        return data
    end

    return nil
end