

function SetSubtitle(label, isDayLabel )
    local widget = nil
    
    if isDayLabel == 1 then
        widget =  Widget("LabelTextArea")
    else
        widget =  Widget("SubtitleTextArea")
    end
    
    local fontSize = tonumber(Config["subtitles_font_size"])
    widget:SetTextHeight(fontSize)
     
    if label~="" then
         s.sys_cutscene_sound = label
         Audio:Play(label, false, false, 2, 0, false )
    end
   
    local text = L10n:ExpandString(label)
    widget:SetText(text)
    
    if label == ""  then
       widget:SetVisible(false) 
    else
       widget:SetVisible(true)  
    end
end

function ShowSubtitles(label)
    Widget("VideoSubtitles"):SetVisible(false) 
    Widget("VideoSubtitles"):SetVisible(true) 
    SetSubtitle(label)
    Widget("LabelTextArea"):SetVisible(false)
    Widget("LabelTextArea"):SetText("")     
end

function HideSubtitles(label)
    SetSubtitle(label)
    Widget("VideoSubtitles"):SetVisible(false) 
    Widget("LabelTextArea"):SetVisible(false)
    Widget("LabelTextArea"):SetText("") 
    if  s.sys_cutscene_sound~=0  then
        Audio:Stop(s.sys_cutscene_sound, 1)
        s.sys_cutscene_sound = 0
    end
    
    
end

UI:AddWidget("subtitles.layout")


--ShowLabel("daylabel0101")
--  SetLabel(label)
