diff --git a/include/Dialog_Progress.h b/include/Dialog_Progress.h index cfc1364f..b4606cf6 100644 --- a/include/Dialog_Progress.h +++ b/include/Dialog_Progress.h @@ -27,6 +27,9 @@ #include +//compose library, dedicated to the translators :P +#include "../compose/ucompose.hpp" + class Dialog_Progress : public Gtk::Dialog { public: diff --git a/include/Operation.h b/include/Operation.h index e67f7903..274326c3 100644 --- a/include/Operation.h +++ b/include/Operation.h @@ -65,7 +65,6 @@ private: void Show_Error( const Glib::ustring & message ) ; Partition partition_original; //the original situation - char c_buf[ 1024 ] ; //used by sprintf, which is needed for i18n }; } //GParted diff --git a/include/Partition.h b/include/Partition.h index 8ec7dcca..451a6bad 100644 --- a/include/Partition.h +++ b/include/Partition.h @@ -30,6 +30,9 @@ #include #include +//compose library, dedicated to the translators :P +#include "../compose/ucompose.hpp" + #define MEGABYTE 2048 //try it: 2048 * 512 / 1024 /1024 == 1 :P namespace GParted diff --git a/include/Win_GParted.h b/include/Win_GParted.h index 63ee37f0..da7a2916 100644 --- a/include/Win_GParted.h +++ b/include/Win_GParted.h @@ -168,8 +168,7 @@ private: GParted::Device *temp_device; std::vector str_devices, filesystems; - char c_buf[ 1024 ] ; //used by sprintf, which is needed for i18n - + //stuff for progress overview Dialog_Progress *dialog_progress; Glib::Thread *thread_operations; diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc index 19fe04e0..f2c02d53 100644 --- a/src/Dialog_Base_Partition.cc +++ b/src/Dialog_Base_Partition.cc @@ -51,7 +51,7 @@ Dialog_Base_Partition::Dialog_Base_Partition( ) vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK ); //add spinbutton_before - label_temp = manage( new Gtk::Label( (Glib::ustring) _( "Free Space Preceding") + " (MB) :\t" ) ) ; + label_temp = manage( new Gtk::Label( (Glib::ustring) _( "Free Space Preceding (MB) :") + " \t" ) ) ; table_resize.attach( *label_temp, 0,1,0,1,Gtk::SHRINK); spinbutton_before .set_numeric( true ); @@ -59,7 +59,7 @@ Dialog_Base_Partition::Dialog_Base_Partition( ) table_resize.attach( spinbutton_before, 1,2,0,1,Gtk::FILL); //add spinbutton_size - label_temp = manage( new Gtk::Label( (Glib::ustring) _( "New Size") + " (MB) :" ) ) ; + label_temp = manage( new Gtk::Label( _( "New Size (MB) :") ) ) ; label_temp ->set_alignment( Gtk::ALIGN_LEFT ); table_resize.attach( *label_temp, 0,1,1,2 ); @@ -68,7 +68,7 @@ Dialog_Base_Partition::Dialog_Base_Partition( ) table_resize.attach( spinbutton_size, 1,2,1,2,Gtk::FILL); //add spinbutton_after - label_temp = manage( new Gtk::Label( (Glib::ustring) _( "Free Space Following") + " (MB) :" ) ) ; + label_temp = manage( new Gtk::Label( _( "Free Space Following (MB) :") ) ) ; label_temp ->set_alignment( Gtk::ALIGN_LEFT ); table_resize.attach( *label_temp, 0,1,2,3 ) ; diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc index 29dfea8e..fb48757e 100644 --- a/src/Dialog_Partition_Copy.cc +++ b/src/Dialog_Partition_Copy.cc @@ -30,8 +30,7 @@ void Dialog_Partition_Copy::Set_Data( Partition & selected_partition, Partition { GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely - /*TO TRANSLATORS: dialogtitle, looks like Paste /dev/hda3 */ - this ->set_title( (Glib::ustring) _( "Paste" ) + " " + copied_partition .partition ) ; + this ->set_title( String::ucompose( _("Paste %1"), copied_partition .partition ) ) ; //set partition color frame_resizer_base ->set_rgb_partition_color( copied_partition .color ) ; @@ -66,8 +65,8 @@ void Dialog_Partition_Copy::Set_Data( Partition & selected_partition, Partition spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB() ) ; //set contents of label_minmax - os << _("Minimum Size") << ": " << copied_partition .Get_Length_MB() +1 ; - os << " MB\t\t" << _( "Maximum Size" ) << ": " << Sector_To_MB( total_length ) << " MB" ; + os << String::ucompose( _("Minimum Size: %1 MB"), copied_partition .Get_Length_MB() +1 ) << "\t\t" ; + os << String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ; label_minmax.set_text( os.str() ) ; os.str("") ; //set global selected_partition (see Dialog_Base_Partition::Get_New_Partition ) diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc index 1011fb33..c235c393 100644 --- a/src/Dialog_Partition_Info.cc +++ b/src/Dialog_Partition_Info.cc @@ -27,7 +27,7 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) this->set_resizable( false ); /*TO TRANSLATORS: dialogtitle, looks like Information about /dev/hda3 */ - this->set_title( (Glib::ustring) _( "Information about") + " " + partition.partition ); + this->set_title( String::ucompose( _( "Information about %1"), partition.partition ) ); init_drawingarea() ; @@ -42,7 +42,7 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) image = manage( new Gtk::Image( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON ) ); label = manage( new Gtk::Label( ) ) ; - label ->set_markup( " " + (Glib::ustring) _( "Libparted message" ) + ": " ) ; + label ->set_markup( " " + (Glib::ustring) _( "Libparted message:" ) + " " ) ; hbox = manage( new Gtk::HBox() ); hbox ->pack_start( *image, Gtk::PACK_SHRINK ) ; @@ -137,27 +137,27 @@ void Dialog_Partition_Info::Display_Info() label = manage( new Gtk::Label( "" ) ) ; - label ->set_text( label ->get_text() + (Glib::ustring) _( "Filesystem" ) + ":\n" ) ; os << partition.filesystem << "\n"; - label ->set_text( label ->get_text() + (Glib::ustring) _( "Size" ) + ":\n" ) ; os << this -> partition .Get_Length_MB() << " MB\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Filesystem:" ) + "\n" ) ; os << partition.filesystem << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Size:" ) + "\n" ) ; os << String::ucompose( _("%1 MB"), this -> partition .Get_Length_MB() ) << "\n"; if ( partition.sectors_used != -1 ) { - label ->set_text( label ->get_text() + (Glib::ustring) _( "Used" ) + ":\n" ) ; - label ->set_text( label ->get_text() + (Glib::ustring) _( "Unused" ) + ":\n" ) ; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Used:" ) + "\n" ) ; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Unused:" ) + "\n" ) ; - os << this ->partition .Get_Used_MB() << " MB\n"; - os << this ->partition .Get_Unused_MB() << " MB\n" ; - + os << String::ucompose( _("%1 MB"), this -> partition .Get_Used_MB() ) << "\n"; + os << String::ucompose( _("%1 MB"), this -> partition .Get_Unused_MB() ) << "\n"; + int percent_used =(int) ( (double) partition.Get_Used_MB() / partition .Get_Length_MB() *100 +0.5 ) ; os_percent << "\n\n( " << percent_used << "% )\n( " << 100 - percent_used << "% )\n\n\n"; } - label ->set_text( label ->get_text() + (Glib::ustring) _( "Flags" ) + ":\n\n" ) ; os << partition .flags << "\n\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _( "Flags:" ) + "\n\n" ) ; os << partition .flags << "\n\n"; if ( partition.type != GParted::UNALLOCATED && partition .partition.substr( 0, 3 ) != "New" ) { - label ->set_text( label ->get_text() + (Glib::ustring) _("Path" ) + ":\n" ) ; os << partition.partition << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _("Path:" ) + "\n" ) ; os << partition.partition << "\n"; //get realpath char real_path[4096] ; @@ -166,12 +166,12 @@ void Dialog_Partition_Info::Display_Info() //only show realpath if it's diffent from the short path... if ( partition.partition != real_path ) { - label ->set_text( label ->get_text() + (Glib::ustring) _("Real Path" ) + ":\n" ) ; + label ->set_text( label ->get_text() + (Glib::ustring) _("Real Path:" ) + "\n" ) ; os << (Glib::ustring) real_path << "\n"; os_percent << "\n" ; } - label ->set_text( label ->get_text() + (Glib::ustring) _("Status" ) + ":\n" ) ; + label ->set_text( label ->get_text() + (Glib::ustring) _("Status:" ) + "\n" ) ; if ( partition.busy ) Find_Status() ; else if ( partition.type == GParted::EXTENDED ) @@ -187,9 +187,9 @@ void Dialog_Partition_Info::Display_Info() label ->set_text( label ->get_text() + "\n" ) ; os << "\n"; //splitter :P - label ->set_text( label ->get_text() + (Glib::ustring) _("First Sector" ) + ":\n" ) ; os << partition.sector_start << "\n"; - label ->set_text( label ->get_text() + (Glib::ustring) _("Last Sector" ) + ":\n" ) ; os << partition.sector_end << "\n"; - label ->set_text( label ->get_text() + (Glib::ustring) _("Total Sectors" ) + ":\n" ) ; os << partition.sector_end - partition.sector_start << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _("First Sector:" ) + "\n" ) ; os << partition.sector_start << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _("Last Sector:" ) + "\n" ) ; os << partition.sector_end << "\n"; + label ->set_text( label ->get_text() + (Glib::ustring) _("Total Sectors:" ) + "\n" ) ; os << partition.sector_end - partition.sector_start << "\n"; label ->set_text( label ->get_text() + "" ) ; label ->set_use_markup( true ) ; @@ -236,8 +236,8 @@ void Dialog_Partition_Info::Find_Status() if ( partition_real_path == real_path ) { mountpoint = line.substr( line.find( ' ' ) +1, line .length() ) ; - /*TO TRANSLATORS: used as: mounted on */ - os << _("Mounted on") << " " << mountpoint .substr( 0, mountpoint .find( ' ' ) ) << "\n"; + + os << String::ucompose( _("Mounted on %1"), mountpoint .substr( 0, mountpoint .find( ' ' ) ) ) << "\n"; break ; } @@ -248,8 +248,7 @@ void Dialog_Partition_Info::Find_Status() //sometimes rootdevices are not listed as paths. I'll take a guess and just enter / here...( we'll look into this when complaints start coming in :P ) if ( mountpoint.empty() ) - os << _("Mounted on") << " /\n"; - + os << String::ucompose( _("Mounted on %1"), "/") << "\n"; } Dialog_Partition_Info::~Dialog_Partition_Info() diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc index 6968db9d..81a63f50 100644 --- a/src/Dialog_Partition_New.cc +++ b/src/Dialog_Partition_New.cc @@ -49,7 +49,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten hbox_main .pack_start( table_create, Gtk::PACK_SHRINK ); /*TO TRANSLATORS: used as label for a list of choices. Create as: */ - label_type.set_text( (Glib::ustring) _("Create as") + ":\t" ); + label_type.set_text( (Glib::ustring) _("Create as:") + "\t" ); table_create.attach( label_type, 0,1,0,1,Gtk::SHRINK); //fill partitiontype menu @@ -76,7 +76,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten table_create.attach( optionmenu_type, 1,2,0,1,Gtk::FILL); //filesystems to choose from - label_filesystem.set_text( (Glib::ustring) _("Filesystem") + ":\t" ); + label_filesystem.set_text( (Glib::ustring) _("Filesystem:") + "\t" ); table_create.attach( label_filesystem, 0,1,1,2,Gtk::SHRINK); Build_Filesystems_Menu() ; @@ -106,8 +106,8 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten GRIP = false ; //set contents of label_minmax - os << _("Minimum Size") << ": " << 1 << " MB\t\t"; - os << _("Maximum Size") << ": " << TOTAL_MB << " MB" ; + os << String::ucompose( _("Minimum Size: %1 MB"), 1 ) << "\t\t" ; + os << String::ucompose( _("Maximum Size: %1 MB"), TOTAL_MB ) ; label_minmax.set_text( os.str() ) ; os.str("") ; this ->show_all_children() ; @@ -193,8 +193,8 @@ void Dialog_Partition_New::optionmenu_changed( bool type ) spinbutton_after .set_range( 0, TOTAL_MB - MIN ) ; //set contents of label_minmax - os << _("Minimum Size") << ": " << MIN << " MB\t\t"; - os << _("Maximum Size") << ": " << MAX << " MB" ; + os << String::ucompose( _("Minimum Size: %1 MB"), MIN ) << "\t\t" ; + os << String::ucompose( _("Maximum Size: %1 MB"), MAX ) ; label_minmax.set_text( os.str() ) ; os.str("") ; } diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc index bf67e071..0d5a97fd 100644 --- a/src/Dialog_Partition_Resize_Move.cc +++ b/src/Dialog_Partition_Resize_Move.cc @@ -65,16 +65,14 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector set_title( (Glib::ustring) _("Resize") + " " + selected_partition .partition ) ; + this ->set_title( String::ucompose( _("Resize %1"), selected_partition .partition) ) ; this ->fixed_start = true; frame_resizer_base ->set_fixed_start( true ) ; spinbutton_before .set_sensitive( false ) ; } else { - /*TO TRANSLATORS: dialogtitle. used as Resize/Move /dev/hda1 */ - this ->set_title( (Glib::ustring) _("Resize/Move") + " " + selected_partition .partition ) ; + this ->set_title( String::ucompose( _("Resize/Move %1"), selected_partition .partition ) ) ; frame_resizer_base ->set_fixed_start( false ) ; } @@ -139,8 +137,8 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector set_alignment( Gtk::ALIGN_LEFT ); os << "" << _( "Applying pending operations" ) << "\n\n" ; - os << _("All listed operations are applied to disk.") ; + os << _("Applying all listed operations.") ; os << "\n"; os << _("Clicking Cancel will prevent the next operations from being applied.") ; os << "\n"; @@ -51,8 +51,7 @@ Dialog_Progress::Dialog_Progress( int count_operations, const Glib::ustring & fi label_all_operations.set_markup( "\n" + (Glib::ustring) _( "Completed Operations" ) + ":"); this->get_vbox() ->pack_start( label_all_operations, Gtk::PACK_SHRINK ); - sprintf( c_buf, _("%d of %d operations complete"), 0, count_operations ) ; - progressbar_all.set_text( c_buf ) ; + progressbar_all.set_text( String::ucompose( _("%1 of %2 operations completed"), 0, count_operations ) ) ; this->get_vbox() ->pack_start( progressbar_all, Gtk::PACK_SHRINK ); @@ -71,8 +70,7 @@ void Dialog_Progress::Set_Next_Operation( ) { progressbar_all.set_fraction( progressbar_all.get_fraction() + fraction ); - sprintf( c_buf, _("%d of %d operations complete"), ++current_operation_number, count_operations ) ; - progressbar_all.set_text( c_buf ) ; + progressbar_all.set_text( String::ucompose( _("%1 of %2 operations completed"), ++current_operation_number, count_operations ) ) ; label_current.set_markup( "" + current_operation + "" ) ; progressbar_current.set_fraction( 0 ); @@ -84,9 +82,7 @@ void Dialog_Progress::Set_Progress_Current_Operation( ) progressbar_current.set_fraction( fraction_current ); if ( time_left > 59 && time_left < 120 ) - sprintf( c_buf, _("about %d minute and %d seconds left"), time_left/60, time_left % 60 ) ; + progressbar_current.set_text( String::ucompose( _("about %1 minute and %2 seconds left"), time_left/60, time_left % 60 ) ) ; else - sprintf( c_buf, _("about %d minutes and %d seconds left"), time_left/60, time_left % 60 ) ; - - progressbar_current.set_text( c_buf ) ; + progressbar_current.set_text( String::ucompose( _("about %1 minutes and %2 seconds left"), time_left/60, time_left % 60 ) ) ; } diff --git a/src/Operation.cc b/src/Operation.cc index c5d35839..871e6146 100644 --- a/src/Operation.cc +++ b/src/Operation.cc @@ -42,61 +42,56 @@ Glib::ustring Operation::Get_String() switch ( operationtype ) { - case DELETE : - if (partition_original.type == GParted::LOGICAL) - /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */ - sprintf( c_buf, _("Delete %s (%s, %ld MB) from %s"), "Logical Partition", partition_original.filesystem.c_str(), partition_original .Get_Length_MB(), device ->Get_Path().c_str() ) ; - else - sprintf( c_buf, _("Delete %s (%s, %ld MB) from %s"), partition_original.partition .c_str(), partition_original.filesystem.c_str(), partition_original .Get_Length_MB(), device ->Get_Path().c_str() ) ; - os << c_buf ; - break; + case DELETE : if (partition_original.type == GParted::LOGICAL) + /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */ + os << String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), _("Logical Partition") , partition_original .filesystem, partition_original .Get_Length_MB(), device ->Get_Path() ) ; + else + /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */ + os << String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), partition_original .partition, partition_original .filesystem, partition_original .Get_Length_MB(), device ->Get_Path() ) ; + + break; case CREATE : switch( partition_new.type ) - { - case GParted::PRIMARY : temp = "Primary"; break; - case GParted::LOGICAL : temp = "Logical"; break; - case GParted::EXTENDED : temp = "Extended"; break; - default : break; - } - /*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */ - sprintf( c_buf, _("Create %s Partition #%d (%s, %ld MB) on %s"), temp .c_str(), partition_new.partition_number, partition_new.filesystem .c_str() , partition_new .Get_Length_MB(), device ->Get_Path() .c_str() ) ; - os << c_buf ; - break; - case RESIZE_MOVE : //if startsector has changed >= 1 MB we consider it a move - diff = Abs( partition_new .sector_start - partition_original .sector_start ) ; + { + case GParted::PRIMARY : temp = "Primary"; break; + case GParted::LOGICAL : temp = "Logical"; break; + case GParted::EXTENDED : temp = "Extended"; break; + default : break; + } + /*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */ + os << String::ucompose( _("Create %1 Partition #%2 (%3, %4 MB) on %5"), temp , partition_new.partition_number, partition_new.filesystem , partition_new .Get_Length_MB(), device ->Get_Path() ) ; + break; + case RESIZE_MOVE : //if startsector has changed >= 1 MB we consider it a move + diff = Abs( partition_new .sector_start - partition_original .sector_start ) ; - if ( diff >= MEGABYTE ) - { - if ( partition_new .sector_start > partition_original .sector_start ) - sprintf( c_buf, _("Move %s up by %ld MB "), partition_new.partition .c_str(), Sector_To_MB( diff ) ) ; - else - sprintf( c_buf, _("Move %s down by %ld MB "), partition_new.partition .c_str(), Sector_To_MB( diff ) ) ; - - os << c_buf ; - } + if ( diff >= MEGABYTE ) + { + if ( partition_new .sector_start > partition_original .sector_start ) + os << String::ucompose( _("Move %1 forward by %2 MB "), partition_new.partition, Sector_To_MB( diff ) ) ; + else + os << String::ucompose( _("Move %1 backward by %2 MB "), partition_new.partition, Sector_To_MB( diff ) ) ; + } - //check if size has changed ( we only consider changes >= 1 MB ) - diff = Abs( (partition_original .sector_end - partition_original .sector_start) - (partition_new .sector_end - partition_new .sector_start) ) ; + //check if size has changed ( we only consider changes >= 1 MB ) + diff = Abs( (partition_original .sector_end - partition_original .sector_start) - (partition_new .sector_end - partition_new .sector_start) ) ; - if ( diff >= MEGABYTE ) - { - if ( os.str() == "" ) - sprintf( c_buf, _("Resize %s from %ld MB to %ld MB"), partition_new.partition .c_str(), partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ; - else - sprintf( c_buf, _("and Resize from %ld MB to %ld MB"), partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ; + if ( diff >= MEGABYTE ) + { + if ( os.str() == "" ) + os << String::ucompose( _("Resize %1 from %2 MB to %3 MB"), partition_new.partition, partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ; + else + os << String::ucompose( _("and Resize %1 from %2 MB to %3 MB"), partition_new.partition, partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ; + //os << c_buf ; + } + if ( os.str() == "" ) + os << _("Sorry, changes are too small to make sense"); - os << c_buf ; - } - if ( os.str() == "" ) - os << _("Sorry, changes are too small to make sense"); - break; + break; case CONVERT : /*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */ - sprintf( c_buf, _("Convert %s from %s to %s"), partition_original .partition .c_str(), partition_original .filesystem .c_str() , partition_new .filesystem .c_str() ) ; - os << c_buf ; - break; - case COPY : /*TO TRANSLATORS: looks like Copy /dev/hda4 from /dev/hda to /dev/hdd (start at 2500 MB) */ - sprintf( c_buf, _("Copy %s to %s (start at %ld MB)"), partition_new .partition .c_str(), device ->Get_Path() .c_str(), Sector_To_MB( partition_new .sector_start ) ) ; - os << c_buf ; - break ; + os << String::ucompose( _( "Convert %1 from %2 to %3"), partition_original .partition, partition_original .filesystem, partition_new .filesystem ) ; + break; + case COPY : /*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */ + os << String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), partition_new .partition, device ->Get_Path(), Sector_To_MB( partition_new .sector_start ) ) ; + break ; } return os.str(); @@ -124,31 +119,31 @@ void Operation::Apply_To_Disk( PedTimer * timer ) switch ( operationtype ) { - case DELETE : result = device ->Delete_Partition( partition_original ) ; - if ( ! result ) - Show_Error( (Glib::ustring) _("Error while deleting") + " " + partition_original.partition ) ; - - break; + case DELETE : result = device ->Delete_Partition( partition_original ) ; + if ( ! result ) + Show_Error( String::ucompose( _("Error while deleting %1"), partition_original.partition ) ) ; + + break; case CREATE : result = device ->Create_Partition_With_Filesystem( partition_new, timer ) ; - if ( ! result ) - Show_Error( (Glib::ustring) _("Error while creating") + " " + partition_new.partition ) ; + if ( ! result ) + Show_Error( String::ucompose( _("Error while creating %1"), partition_new.partition ) ); - break; - case RESIZE_MOVE : result = device ->Move_Resize_Partition( partition_original, partition_new, timer ) ; - if ( ! result ) - Show_Error( (Glib::ustring) _("Error while resizing/moving") + " " + partition_new.partition ) ; + break; + case RESIZE_MOVE : result = device ->Move_Resize_Partition( partition_original, partition_new, timer ) ; + if ( ! result ) + Show_Error( String::ucompose( _("Error while resizing/moving %1"), partition_new.partition ) ) ; - break; + break; case CONVERT : result = device ->Set_Partition_Filesystem( partition_new, timer ) ; - if ( ! result ) - Show_Error( (Glib::ustring) _("Error while converting filesystem of") + " " + partition_new.partition ) ; + if ( ! result ) + Show_Error( String::ucompose( _("Error while converting filesystem of %1"), partition_new.partition ) ) ; - break; + break; case COPY : result = device ->Copy_Partition( source_device, partition_new, timer ) ; - if ( ! result ) - Show_Error( (Glib::ustring) _("Error while copying") + " " + partition_new .partition ) ; + if ( ! result ) + Show_Error( String::ucompose( _("Error while copying %1"), partition_new .partition ) ) ; - break; + break; } } diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 68a77d40..572f1f86 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -152,6 +152,7 @@ void Win_GParted::init_popupmenu() menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::PASTE, sigc::mem_fun(*this, &Win_GParted::activate_paste) ) ); menu_popup.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); image = manage( new Gtk::Image( Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU ) ); + /*TO TRANSLATORS: menuitem which holds a submenu with filesystems.. */ menu_popup.items().push_back( Gtk::Menu_Helpers::ImageMenuElem( _("_Convert to"), *image, menu_convert ) ) ; menu_popup.items().push_back( Gtk::Menu_Helpers::SeparatorElem() ); menu_popup.items().push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::DIALOG_INFO, sigc::mem_fun(*this, &Win_GParted::activate_info) ) ); @@ -206,11 +207,11 @@ void Win_GParted::init_device_info() table = manage( new Gtk::Table() ) ; table ->set_col_spacings(10 ) ; label = manage( new Gtk::Label() ) ; - os << " " << _("Model") << ":\n " << _("Size") << ":\n " << _("Path") << ":\n " ; + os << " " << _("Model:") << "\n " << _("Size:") << "\n " << _("Path:") << "\n " ; //only show realpath if it's different from the short path...(hereby i assume if one device has a realpath, they all have. i guess this makes sense) if ( devices[ current_device ] ->Get_Path() != devices[ current_device ] ->Get_RealPath() ) - os << _("Real Path") << ":\n " ; + os << _("Real Path:") << "\n " ; os << "" ; label ->set_markup( os.str() ) ; os.str("") ; @@ -224,7 +225,7 @@ void Win_GParted::init_device_info() table = manage( new Gtk::Table() ) ; table ->set_col_spacings(10 ) ; label = manage( new Gtk::Label() ) ; - os << " " << _("DiskType") << ":\n " << _("Heads") << ":\n " << _("Sectors/Track") << ":\n " << _("Cylinders") << ":\n "<< _("Total Sectors") << ":\n "; + os << " " << _("DiskType:") << "\n " << _("Heads:") << "\n " << _("Sectors/Track:") << "\n " << _("Cylinders:") << "\n "<< _("Total Sectors:") << "\n "; os << "" ; label ->set_markup( os.str() ) ; os.str("") ; table ->attach( *label, 0,1,0,1,Gtk::SHRINK); @@ -236,7 +237,7 @@ void Win_GParted::init_device_info() //add the vbox to the expander expander_device_info.add( *vbox ); expander_device_info.set_use_markup( true ); - expander_device_info.set_label( "" + (Glib::ustring) _( "Harddisk Information" ) + ":" ); + expander_device_info.set_label( "" + (Glib::ustring) _( "Harddisk Information:" ) + "" ); //and add the expander to vbox_info vbox_info.set_spacing( 5 ); @@ -432,25 +433,26 @@ void Win_GParted::Refresh_Visual( ) switch ( operations[t].operationtype ) { case GParted::DELETE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU); - break; - case GParted::CREATE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU); - break; + break; + case GParted::CREATE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU); + break; case GParted::RESIZE_MOVE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU); - break; - case GParted::CONVERT : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU); - break; - case GParted::COPY : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU); - break; + break; + case GParted::CONVERT : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU); + break; + case GParted::COPY : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU); + break; } } //set new statusbartext statusbar .pop() ; - os << operations.size() << " " ; - operations.size() != 1 ? os << _( "operations pending" ) : os << _( "operation pending" ) ; - statusbar .push( os.str() );os.str(""); - + if ( operations.size() != 1 ) + statusbar .push( String::ucompose( _("%1 operations pending"), operations.size() ) .c_str() ); + else + statusbar .push( _( "1 operation pending" ) ); + if ( ! operations.size() ) { allow_undo( false ); @@ -467,16 +469,16 @@ void Win_GParted::Refresh_Visual( ) switch ( partitions[t].type ) { - case GParted::PRIMARY : primary_count++; - break; - case GParted::EXTENDED : any_extended = true; - primary_count++; - break; - case GParted::LOGICAL : any_logic = true; - if ( partitions[t].busy && partitions[t].partition_number > highest_logic_busy ) - highest_logic_busy = partitions[t].partition_number ; - break; - default : break; + case GParted::PRIMARY : primary_count++; + break; + case GParted::EXTENDED : any_extended = true; + primary_count++; + break; + case GParted::LOGICAL : any_logic = true; + if ( partitions[t].busy && partitions[t].partition_number > highest_logic_busy ) + highest_logic_busy = partitions[t].partition_number ; + break; + default : break; } } @@ -506,8 +508,12 @@ bool Win_GParted::Quit_Check_Operations() if ( operations.size() ) { os << "" + (Glib::ustring) _( "Quit GParted?" ) + "\n\n" ; - os << operations.size() << " "; - operations.size() == 1 ? os << "operation is currently pending..." : os << "operations are currently pending..." ; + // os << operations.size() << " "; + // operations.size() == 1 ? os << "operation is currently pending..." : os << "operations are currently pending..." ; + if ( operations .size() != 1 ) + os << String::ucompose( _("%1 operations are currently pending."), operations .size() ) ; + else + os << _("1 operation is currently pending."); Gtk::MessageDialog dialog( *this, os.str() , true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);os.str(""); dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE ); @@ -775,9 +781,10 @@ void Win_GParted::activate_paste() if ( ! selected_partition.inside_extended && primary_count >= 4 ) { os << "" ; - os << _( "It's not possible to create more then four primary partitions") << "\n\n" ; - os << _( "If you want more then four partitions you should create an extended partition. Such an partition can contain at least 24 other partitions.") ; - + os << String::ucompose( _("It is not possible to create more then %1 primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ; + os << "\n\n" ; + os << _( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ; + Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("") ; dialog.run(); return; @@ -801,9 +808,9 @@ void Win_GParted::activate_new() if ( ! selected_partition.inside_extended && primary_count >= devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) { os << "" ; - sprintf( c_buf, _("It is not possible to create more then %d primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ; - os << c_buf << "\n\n" ; - os << _( "If you want more partitions you should first create an extended partition. Such an partition can contain other partitions.") ; + os << String::ucompose( _("It is not possible to create more then %1 primary partitions"), devices[ current_device ] ->Get_Max_Amount_Of_Primary_Partitions() ) ; + os << "\n\n" ; + os << _( "If you want more partitions you should first create an extended partition. Such a partition can contain other partitions.") ; Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str("") ; dialog.run(); @@ -831,17 +838,20 @@ void Win_GParted::activate_delete() //it seems best to check for this and prohibit deletion with some explanation to the user. if ( selected_partition.type == GParted::LOGICAL && selected_partition .partition.substr( 0, 3 ) != "New" && selected_partition.partition_number < highest_logic_busy ) { - os << " " << selected_partition.partition_number ; - Gtk::MessageDialog dialog( *this, "" + (Glib::ustring) _( "Unable to delete partition!") + "\n\n" + (Glib::ustring) _( "Please unmount any logical partitions having a number higher than") + os.str() ,true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);os.str(""); - dialog.run() ; return; + os << "" << _( "Unable to delete partition!") << "\n\n" ; + os << String::ucompose( _("Please unmount any logical partitions having a number higher than %1"), selected_partition.partition_number ) ; + Gtk::MessageDialog dialog( *this, os .str(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); os.str(""); + dialog.run() ; + return; } - os << "" + (Glib::ustring) _( "Are you sure you want to delete" ) + " " + selected_partition.partition + " ?" ; + os << "" << String::ucompose( _( "Are you sure you want to delete %1 ?"), selected_partition.partition ) << "" ; if ( selected_partition .partition == copied_partition .partition ) - os << "\n\n" + (Glib::ustring) _( "After deletion this partition is no longer available for copying.") ; + os << "\n\n" << _( "After deletion this partition is no longer available for copying.") ; Gtk::MessageDialog dialog( *this, os.str() ,true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); os.str(""); - dialog.set_title( _("Delete") + (Glib::ustring)" " + selected_partition.partition + " (" + selected_partition.filesystem + ")" ); + /*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) */ + dialog .set_title( String::ucompose( _("Delete %1 (%2, %3 MB)"), selected_partition .partition, selected_partition .filesystem, selected_partition .Get_Length_MB() ) ); dialog.add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); dialog.add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK ); @@ -902,7 +912,12 @@ void Win_GParted::activate_info() void Win_GParted::activate_convert( const Glib::ustring & new_fs ) { //standard warning.. - Gtk::MessageDialog dialog( *this, "" + (Glib::ustring) _( "Are you sure you want to convert this filesystem to") + " " + new_fs + " ?\n\n" + (Glib::ustring) _( "This operation will destroy all data on") + " " + selected_partition .partition ,true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true); + os << "" ; + os << String::ucompose( _("Are you sure you want to convert this filesystem to %1 ?"), new_fs ) << "\n\n" ; + os << String::ucompose( _("This operation will destroy all data on %1"), selected_partition .partition ) ; + + Gtk::MessageDialog dialog( *this, os.str(), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true); os.str(""); + dialog. add_button( Gtk::Stock::CONVERT, Gtk::RESPONSE_OK ) ; dialog. show_all_children() ; @@ -1012,6 +1027,7 @@ void Win_GParted::activate_apply() if ( devicenames .size() ) { os << "" ; + /*TO TRANSLATORS: after the colon (:) a list of devices will be shown */ os << _("The kernel was unable to re-read the partition table on :") << "\n"; for (unsigned int t=0; t