summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media
diff options
context:
space:
mode:
authorFrancois Andriot <[email protected]>2013-05-19 16:12:30 +0200
committerSlávek Banko <[email protected]>2013-05-19 16:12:30 +0200
commit9a491179e30feb8beb9ceca8b1fde985d42465e7 (patch)
treea9fde507e99517a594adeb519fc223f005f9b229 /tdeioslave/media
parent718f6ae321b507dbb5bca737a1d1d486b2b41dc5 (diff)
downloadtdebase-9a491179e30feb8beb9ceca8b1fde985d42465e7.tar.gz
tdebase-9a491179e30feb8beb9ceca8b1fde985d42465e7.zip
Fix media name translations in halbackend
Diffstat (limited to 'tdeioslave/media')
-rw-r--r--tdeioslave/media/mediamanager/halbackend.cpp12
-rw-r--r--tdeioslave/media/mediamanager/halbackend.h1
2 files changed, 12 insertions, 1 deletions
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 <tqobject.h>
#include <tqstringlist.h>
#include <tqstring.h>
+#include <tqregexp.h>
#include <config.h>