1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 08:10:05 +02:00

Translate the special metadata tags in the edit dialog

This commit is contained in:
Paul Licameli 2018-01-08 23:13:51 -05:00
parent d59592f862
commit 44df6455aa

View File

@ -722,7 +722,7 @@ static wxArrayString names()
return theArray.Get(); return theArray.Get();
} }
static struct static const struct
{ {
wxString label; wxString label;
wxString name; wxString name;
@ -779,22 +779,6 @@ TagsEditor::TagsEditor(wxWindow * parent,
{ {
SetName(GetTitle()); SetName(GetTitle());
labelmap[0].label = LABEL_ARTIST;
labelmap[1].label = LABEL_TITLE;
labelmap[2].label = LABEL_ALBUM;
labelmap[3].label = LABEL_TRACK;
labelmap[4].label = LABEL_YEAR;
labelmap[5].label = LABEL_GENRE;
labelmap[6].label = LABEL_COMMENTS;
labelmap[0].name = TAG_ARTIST;
labelmap[1].name = TAG_TITLE;
labelmap[2].name = TAG_ALBUM;
labelmap[3].name = TAG_TRACK;
labelmap[4].name = TAG_YEAR;
labelmap[5].name = TAG_GENRE;
labelmap[6].name = TAG_COMMENTS;
mGrid = NULL; mGrid = NULL;
// Make a local copy of the passed in tags // Make a local copy of the passed in tags
@ -954,25 +938,25 @@ bool TagsEditor::TransferDataFromWindow()
continue; continue;
} }
if (n.CmpNoCase(LABEL_ARTIST) == 0) { if (n.CmpNoCase(wxGetTranslation(LABEL_ARTIST)) == 0) {
n = TAG_ARTIST; n = TAG_ARTIST;
} }
else if (n.CmpNoCase(LABEL_TITLE) == 0) { else if (n.CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
n = TAG_TITLE; n = TAG_TITLE;
} }
else if (n.CmpNoCase(LABEL_ALBUM) == 0) { else if (n.CmpNoCase(wxGetTranslation(LABEL_ALBUM)) == 0) {
n = TAG_ALBUM; n = TAG_ALBUM;
} }
else if (n.CmpNoCase(LABEL_TRACK) == 0) { else if (n.CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
n = TAG_TRACK; n = TAG_TRACK;
} }
else if (n.CmpNoCase(LABEL_YEAR) == 0) { else if (n.CmpNoCase(wxGetTranslation(LABEL_YEAR)) == 0) {
n = TAG_YEAR; n = TAG_YEAR;
} }
else if (n.CmpNoCase(LABEL_GENRE) == 0) { else if (n.CmpNoCase(wxGetTranslation(LABEL_GENRE)) == 0) {
n = TAG_GENRE; n = TAG_GENRE;
} }
else if (n.CmpNoCase(LABEL_COMMENTS) == 0) { else if (n.CmpNoCase(wxGetTranslation(LABEL_COMMENTS)) == 0) {
n = TAG_COMMENTS; n = TAG_COMMENTS;
} }
@ -1000,14 +984,16 @@ bool TagsEditor::TransferDataToWindow()
mGrid->AppendRows(); mGrid->AppendRows();
mGrid->SetReadOnly(i, 0); mGrid->SetReadOnly(i, 0);
mGrid->SetCellValue(i, 0, labelmap[i].label); mGrid->SetCellValue(i, 0, wxGetTranslation( labelmap[i].label ) );
mGrid->SetCellValue(i, 1, mLocal.GetTag(labelmap[i].name)); mGrid->SetCellValue(i, 1, mLocal.GetTag(labelmap[i].name));
if (!mEditTitle && mGrid->GetCellValue(i, 0).CmpNoCase(LABEL_TITLE) == 0) { if (!mEditTitle &&
mGrid->GetCellValue(i, 0).CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
mGrid->SetReadOnly(i, 1); mGrid->SetReadOnly(i, 1);
} }
if (!mEditTrack && mGrid->GetCellValue(i, 0).CmpNoCase(LABEL_TRACK) == 0) { if (!mEditTrack &&
mGrid->GetCellValue(i, 0).CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
mGrid->SetReadOnly(i, 1); mGrid->SetReadOnly(i, 1);
} }
@ -1328,10 +1314,13 @@ void TagsEditor::OnRemove(wxCommandEvent & WXUNUSED(event))
{ {
size_t row = mGrid->GetGridCursorRow(); size_t row = mGrid->GetGridCursorRow();
if (!mEditTitle && mGrid->GetCellValue(row, 0).CmpNoCase(LABEL_TITLE) == 0) { if (!mEditTitle &&
mGrid->GetCellValue(row, 0).CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
return; return;
} }
else if (!mEditTrack && mGrid->GetCellValue(row, 0).CmpNoCase(LABEL_TRACK) == 0) { else if (!mEditTrack &&
mGrid->GetCellValue(row, 0)
.CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
return; return;
} }
else if (row < STATICCNT) { else if (row < STATICCNT) {
@ -1405,7 +1394,7 @@ void TagsEditor::SetEditors()
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
wxString label = mGrid->GetCellValue(i, 0); wxString label = mGrid->GetCellValue(i, 0);
if (label.CmpNoCase(LABEL_GENRE) == 0) { if (label.CmpNoCase(wxGetTranslation(LABEL_GENRE)) == 0) {
// This use of GetDefaultEditorForType does not require DecRef. // This use of GetDefaultEditorForType does not require DecRef.
mGrid->SetCellEditor(i, 1, mGrid->GetDefaultEditorForType(wxT("Combo"))); mGrid->SetCellEditor(i, 1, mGrid->GetDefaultEditorForType(wxT("Combo")));
} }