Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

The translatable labels are now stored in .po files instead of the ad…

…don.xml
  • Loading branch information...
commit 7eb66519818630e6ced771950d9b2e5951cd0fc6 1 parent 78bfdb6
Fice authored
View
2  xbmc/GUIContextMenuManager.h
@@ -26,7 +26,7 @@
*
*/
#include "IGUIContextItem.h"
-#include "boost/shared_ptr.hpp"
+#include <boost/shared_ptr.hpp>
#include <list>
#include <boost/noncopyable.hpp>
View
2  xbmc/IGUIContextItem.h
@@ -39,7 +39,7 @@ class IGUIContextItem
bool isMsgID(const unsigned int Id) {
return getMsgID()==Id;
}
- virtual CStdString getLabel() const =0;
+ virtual CStdString getLabel() =0;
virtual bool isVisible(const CFileItemPtr item) const=0;
virtual ~IGUIContextItem() {}
bool operator()(const CFileItemPtr item) {
View
19 xbmc/addons/ContextItemAddon.cpp
@@ -25,6 +25,7 @@
#include "interfaces/python/XBPython.h"
#endif
#include <boost/lexical_cast.hpp>
+#include <stdexcept>
using namespace std;
@@ -37,11 +38,23 @@ CContextItemAddon::CContextItemAddon(const cp_extension_t *ext)
m_id = CAddonMgr::Get().GetMsgIdForContextAddon(ID());
- m_label = CAddonMgr::Get().GetTranslatedString(ext->configuration, "label");
- if(m_label.empty())
+ CStdString labelStr = CAddonMgr::Get().GetExtValue(ext->configuration, "@label");
+ if(labelStr.empty())
{
m_label = Name();
CLog::Log(LOGDEBUG, "ADDON: %s - failed to load label attribute, falling back to addon name %s.", ID().c_str(), Name().c_str());
+ } else {
+ if(StringUtils::IsNaturalNumber(labelStr)) {
+ int id = boost::lexical_cast<int>(labelStr);
+ m_label = GetString(id);
+ if(m_label.empty()) {
+ CLog::Log(LOGDEBUG, "ADDON: %s - label id %i not found using addon name %s", ID().c_str(), id, Name().c_str());
+ m_label = Name();
+ }
+ } else {
+ m_label = labelStr;
+ }
+
}
CStdString visible = CAddonMgr::Get().GetExtValue(ext->configuration, "@visible");
@@ -75,7 +88,7 @@ CContextItemAddon::~CContextItemAddon()
//after this item is destroyed (e.g. use shared_ptr/weak_ptr!)
}
-CStdString CContextItemAddon::getLabel() const
+CStdString CContextItemAddon::getLabel()
{
return m_label;
}
View
4 xbmc/addons/ContextItemAddon.h
@@ -35,14 +35,14 @@ namespace ADDON
virtual ~CContextItemAddon();
virtual unsigned int getMsgID() const { return m_id; }
- virtual CStdString getLabel() const;
+ virtual CStdString getLabel();
virtual bool isVisible(const CFileItemPtr item) const;
protected:
virtual bool execute(const CFileItemPtr itemPath);
- unsigned int m_VisibleId;
unsigned int m_id;
+ unsigned int m_VisibleId;
CStdString m_label;
bool m_bTrueOnNullId;
};
View
4 xbmc/dialogs/GUIDialogContextMenu.cpp
@@ -73,7 +73,9 @@ void CContextButtons::Add(unsigned int button, int label)
std::pair<unsigned int, CStdString> ConvertFromContextItem::operator()(ContextItemPtr& input)
{
- return std::pair<unsigned int, CStdString>(input->getMsgID(), input->getLabel());
+ CStdString label = input->getLabel();
+ unsigned int id= input->getMsgID();
+ return std::pair<unsigned int, CStdString>(id, label);
}
CGUIDialogContextMenu::CGUIDialogContextMenu(void)
Please sign in to comment.
Something went wrong with that request. Please try again.