gparted r935 - in trunk: . include src
- From: gedakc svn gnome org
- To: svn-commits-list gnome org
- Subject: gparted r935 - in trunk: . include src
- Date: Thu, 16 Oct 2008 19:58:14 +0000 (UTC)
Author: gedakc
Date: Thu Oct 16 19:58:14 2008
New Revision: 935
URL: http://svn.gnome.org/viewvc/gparted?rev=935&view=rev
Log:
Created function get_lang() to retrieve language locale
Modified:
trunk/ChangeLog
trunk/include/Utils.h
trunk/src/Utils.cc
Modified: trunk/include/Utils.h
==============================================================================
--- trunk/include/Utils.h (original)
+++ trunk/include/Utils.h Thu Oct 16 19:58:14 2008
@@ -141,6 +141,7 @@
static Glib::ustring delete_mtoolsrc_file( const char file_name[] ) ;
static Glib::ustring trim( const Glib::ustring & src, const Glib::ustring & c = " \t\r\n" ) ;
static Glib::ustring cleanup_cursor( const Glib::ustring & text ) ;
+ static Glib::ustring get_lang() ;
};
Modified: trunk/src/Utils.cc
==============================================================================
--- trunk/src/Utils.cc (original)
+++ trunk/src/Utils.cc Thu Oct 16 19:58:14 2008
@@ -20,6 +20,7 @@
#include <sstream>
#include <iomanip>
#include <regex.h>
+#include <locale.h>
namespace GParted
{
@@ -355,5 +356,17 @@
return str;
}
+Glib::ustring Utils::get_lang()
+{
+ //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 ) ;
+ Glib::ustring sought = "_" ;
+ Glib::ustring replacement = "-" ;
+ lang = Utils::regexp_label( lang .c_str(), "^([^.]*)") ;
+ lang .replace( lang .find(sought), sought .size(), replacement ) ;
+ return lang ;
+}
+
} //GParted..
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]