From 9a491179e30feb8beb9ceca8b1fde985d42465e7 Mon Sep 17 00:00:00 2001 From: Francois Andriot Date: Sun, 19 May 2013 16:12:30 +0200 Subject: Fix media name translations in halbackend --- tdeioslave/media/mediamanager/halbackend.cpp | 12 +++++++++++- tdeioslave/media/mediamanager/halbackend.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'tdeioslave/media/mediamanager') diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp index a31b632c8..9dbe18d8e 100644 --- a/tdeioslave/media/mediamanager/halbackend.cpp +++ b/tdeioslave/media/mediamanager/halbackend.cpp @@ -545,7 +545,17 @@ void HALBackend::setVolumeProperties(Medium* medium) char* name = libhal_volume_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy); TQString volume_name = TQString::fromUtf8(name); TQString media_name = volume_name; - medium->setLabel(media_name); + /* media_name contains something like "501M Removable Media" or "Blank CD-R" + The former needs special handling for correct translation + */ + if (media_name.find(TQRegExp("^[0-9]+\\.?[0-9]*[KMGT] (Removable )?Media$")) > -1) { + TQString pattern = media_name.section(" ", 1); + media_name.replace(pattern, i18n(pattern.ascii())); + medium->setLabel(media_name); + } else { + medium->setLabel(i18n(media_name.ascii())); + } + free(name); TQString mimeType; diff --git a/tdeioslave/media/mediamanager/halbackend.h b/tdeioslave/media/mediamanager/halbackend.h index 8c8bbfce6..8dde45580 100644 --- a/tdeioslave/media/mediamanager/halbackend.h +++ b/tdeioslave/media/mediamanager/halbackend.h @@ -34,6 +34,7 @@ #include #include #include +#include #include -- cgit v1.2.1