source: unity-greeter/trunk/fuentes/debian/patches/llx-language-selector.patch @ 948

Last change on this file since 948 was 948, checked in by hectorgh, 5 years ago

added language selection

File size: 5.3 KB
  • debian/patches/series

    diff -uNar ./debian/patches/series /tmp/kk/unity-mod/debian/patches/series
    old new  
    1 llx-language-selector.patch
  • debian/rules

    diff -uNar ./debian/rules /tmp/kk/unity-mod/debian/rules
    old new  
    33LDFLAGS+=-Wl,--as-needed
    44
    55%:
    6         dh $@ --with autoreconf --with quilt --fail-missing
     6        dh $@ --with autoreconf --fail-missing
    77
    88override_dh_autoreconf:
    99        NOCONFIGURE=1 dh_autoreconf ./autogen.sh
  • po/ca@valencia.po

    diff -uNar ./po/ca@valencia.po /tmp/kk/unity-mod/po/ca@valencia.po
    old new  
    230230
    231231#~ msgid "_Back"
    232232#~ msgstr "_Enrere"
     233
     234msgid "Language selection"
     235msgstr "Selecció d'idioma"
     236
     237msgid "User defined (Language Support)"
     238msgstr "Definit per l'usuari (Suport d'idioma)"
     239
     240msgid "English"
     241msgstr "Anglés"
     242
     243msgid "Spanish"
     244msgstr "Espanyol"
     245
     246msgid "Valencian"
     247msgstr "Valencià"
     248
  • po/es.po

    diff -uNar ./po/es.po /tmp/kk/unity-mod/po/es.po
    old new  
    243243
    244244#~ msgid "Favorite Color (blue):"
    245245#~ msgstr "Color favorito (azul):"
     246
     247msgid "Language selection"
     248msgstr "Selección de idioma"
     249
     250msgid "User defined (Language Support)"
     251msgstr "Definido por el usuario (Soporte de idiomas)"
     252
     253msgid "Spanish"
     254msgstr "Español"
     255
     256msgid "Valencian"
     257msgstr "Valenciano"
     258
     259msgid "English"
     260msgstr "Inglés"
     261
  • src/menubar.vala

    diff -uNar ./src/menubar.vala /tmp/kk/unity-mod/src/menubar.vala
    old new  
    7070    public Gtk.Window? keyboard_window { get; private set; default = null; }
    7171    public Gtk.AccelGroup? accel_group { get; construct; }
    7272
     73    public string user_language{get; private set; default = "";}
     74
    7375    private static const int HEIGHT = 24;
    7476
    7577    public MenuBar (Background bg, Gtk.AccelGroup ag)
     
    237239        return a11y_item;
    238240    }
    239241
     242
     243
     244 private Gtk.Widget make_language_selector ()
     245    {
     246        var selector_item = new Gtk.MenuItem ();
     247        var hbox = new Gtk.HBox (false, 3);
     248        hbox.show ();
     249        selector_item.add (hbox);
     250        var label= new Gtk.Label(_("Language selection"));
     251        label.show();
     252        hbox.add(label);
     253        selector_item.show ();
     254           
     255        selector_item.submenu = new Gtk.Menu ();
     256        Gtk.RadioMenuItem? default_item = null;
     257        Gtk.RadioMenuItem? last_item = null;
     258       
     259        var selected = new Gtk.RadioMenuItem.with_label (last_item == null ? null : last_item.get_group (), _("User defined (Language Support)"));
     260        selected.show ();
     261        selector_item.submenu.append (selected);       
     262        last_item = selected;
     263       
     264        selected = new Gtk.RadioMenuItem.with_label (last_item == null ? null : last_item.get_group (), _("Spanish"));
     265        selected.show ();
     266        selector_item.submenu.append (selected);       
     267        last_item = selected;
     268        selected.toggled.connect (spanish_toggled_cb);
     269
     270        selected = new Gtk.RadioMenuItem.with_label (last_item == null ? null : last_item.get_group (), _("Valencian"));
     271        selected.show ();
     272        selector_item.submenu.append (selected);       
     273        last_item = selected;
     274        selected.toggled.connect (valencian_toggled_cb);
     275       
     276        selected = new Gtk.RadioMenuItem.with_label (last_item == null ? null : last_item.get_group (), _("English"));
     277        selected.show ();
     278        selector_item.submenu.append (selected);       
     279        last_item = selected;   
     280        selected.toggled.connect (english_toggled_cb);
     281
     282        return selector_item;
     283    }   
     284   
     285    private void spanish_toggled_cb(Gtk.CheckMenuItem item)
     286    {
     287            if(!item.active)
     288                return;
     289            user_language="es_ES";
     290    }
     291   
     292    private void valencian_toggled_cb(Gtk.CheckMenuItem item)
     293    {
     294            if(!item.active)
     295                return;
     296            user_language="ca_ES@valencia";
     297    }
     298   
     299    private void english_toggled_cb(Gtk.CheckMenuItem item)
     300    {
     301            if(!item.active)
     302                return;
     303            user_language="en";
     304    }   
     305   
     306 
     307
     308
    240309    private Indicator.Object? load_indicator_file (string indicator_name)
    241310    {
    242311        string dir = Config.INDICATOR_FILE_DIR;
     
    288357    {
    289358        if (indicator_name == "ug-accessibility")
    290359        {
     360            var language_selector=make_language_selector();
     361            insert (language_selector, (int) get_children ().length () - 1);
     362       
    291363            var a11y_item = make_a11y_indicator ();
    292364            insert (a11y_item, (int) get_children ().length () - 1);
    293365        }
  • src/unity-greeter.vala

    diff -uNar ./src/unity-greeter.vala /tmp/kk/unity-mod/src/unity-greeter.vala
    old new  
    210210        var result = false;
    211211        try
    212212        {
     213            try
     214            {
     215                if (main_window.menubar.user_language!="")
     216                    greeter.set_language(main_window.menubar.user_language);   
     217            }
     218            catch (Error llx)
     219            {
     220                //nothing to do
     221            }
     222
    213223            result = LightDM.greeter_start_session_sync (greeter, session);
    214224        }
    215225        catch (Error e)
Note: See TracBrowser for help on using the repository browser.