Author: kirilla Date: 2011-03-22 23:09:35 +0100 (Tue, 22 Mar 2011) New Revision: 41085 Changeset: https://dev.haiku-os.org/changeset/41085 Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp Log: Enable localization of Tracker add-on names and shortcuts, with the canonical name and shortcut as fallback. Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2011-03-22 20:38:13 UTC (rev 41084) +++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2011-03-22 22:09:35 UTC (rev 41085) @@ -166,15 +166,26 @@ static void StripShortcut(const Model *model, char *result, uint32 &shortcut) { - strcpy(result, model->Name()); + // model name (possibly localized) for the menu item label + strlcpy(result, model->Name(), B_FILE_NAME_LENGTH); - // check if there is a shortcut + // check if there is a shortcut in the model name uint32 length = strlen(result); - shortcut = '\0'; - if (result[length - 2] == '-') { + if (result[length - 2] == '-' && length > 2) { shortcut = result[length - 1]; result[length - 2] = '\0'; + return; } + + // check if there is a shortcut in the filename + char* refName = model->EntryRef()->name; + length = strlen(refName); + if (refName[length - 2] == '-' && length > 2) { + shortcut = refName[length - 1]; + return; + } + + shortcut = '\0'; }