Skip to content
This repository
Browse code

Merge pull request #2782 from ace20022/subs_kai_toast

[GUI/Player] Proper subtitle lang-name string for kai toast
  • Loading branch information...
commit 629b5c491c89e9e6757a2c88d00e50c2c0650ba1 2 parents 2ccc82c + 9b57e2c
Joakim Plate authored May 25, 2013

Showing 1 changed file with 15 additions and 6 deletions. Show diff stats Hide diff stats

  1. 21  xbmc/video/PlayerController.cpp
21  xbmc/video/PlayerController.cpp
@@ -35,6 +35,7 @@
35 35
 #include "cores/VideoRenderers/RenderManager.h"
36 36
 #endif
37 37
 #include "Application.h"
  38
+#include "utils/LangCodeExpander.h"
38 39
 
39 40
 CPlayerController::CPlayerController()
40 41
 {
@@ -64,9 +65,13 @@ bool CPlayerController::OnAction(const CAction &action)
64 65
       {
65 66
         SPlayerSubtitleStreamInfo info;
66 67
         g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
67  
-        sub = info.name;
68  
-        if (sub != info.language)
69  
-          sub.Format("%s [%s]", sub.c_str(), info.language.c_str());
  68
+        if (!g_LangCodeExpander.Lookup(lang, info.language))
  69
+          lang = g_localizeStrings.Get(13205); // Unknown
  70
+
  71
+        if (info.name.length() == 0)
  72
+          sub = lang;
  73
+        else
  74
+          sub.Format("%s - %s", lang.c_str(), info.name.c_str());
70 75
       }
71 76
       else
72 77
         sub = g_localizeStrings.Get(1223);
@@ -105,9 +110,13 @@ bool CPlayerController::OnAction(const CAction &action)
105 110
       {
106 111
         SPlayerSubtitleStreamInfo info;
107 112
         g_application.m_pPlayer->GetSubtitleStreamInfo(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream, info);
108  
-        sub = info.name;
109  
-        if (sub != info.language)
110  
-          sub.Format("%s [%s]", sub.c_str(), info.language.c_str());
  113
+        if (!g_LangCodeExpander.Lookup(lang, info.language))
  114
+          lang = g_localizeStrings.Get(13205); // Unknown
  115
+
  116
+        if (info.name.length() == 0)
  117
+          sub = lang;
  118
+        else
  119
+          sub.Format("%s - %s", lang.c_str(), info.name.c_str());
111 120
       }
112 121
       else
113 122
         sub = g_localizeStrings.Get(1223);

0 notes on commit 629b5c4

Please sign in to comment.
Something went wrong with that request. Please try again.