gparted r940 - in trunk: . src



Author: gedakc
Date: Fri Oct 24 15:48:25 2008
New Revision: 940
URL: http://svn.gnome.org/viewvc/gparted?rev=940&view=rev

Log:
Increased robustness of get_lang() function

Modified:
   trunk/ChangeLog
   trunk/src/Utils.cc

Modified: trunk/src/Utils.cc
==============================================================================
--- trunk/src/Utils.cc	(original)
+++ trunk/src/Utils.cc	Fri Oct 24 15:48:25 2008
@@ -361,10 +361,15 @@
 	//Extract base language from string that may look like "en_CA.UTF-8"
 	//  and return in the form "en-CA"
 	Glib::ustring lang = setlocale( LC_CTYPE, NULL ) ;
+
+	//Strip off anything after the period "." or at sign "@"
+	lang = Utils::regexp_label( lang .c_str(), "^([^  ]*)") ;
+
+	//Convert the underscore "_" to a hyphen "-"
 	Glib::ustring sought = "_" ;
 	Glib::ustring replacement = "-" ;
-	lang = Utils::regexp_label( lang .c_str(), "^([^.]*)") ;
 	lang .replace( lang .find(sought), sought .size(), replacement ) ;
+
 	return lang ;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]