Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Missed translation of text from *.glade files using gtk::Builder #413

Closed
emkoder opened this issue Dec 7, 2016 · 9 comments
Closed

Missed translation of text from *.glade files using gtk::Builder #413

emkoder opened this issue Dec 7, 2016 · 9 comments

Comments

@emkoder
Copy link
Contributor

emkoder commented Dec 7, 2016

Sorry, I'm not very familiar with the GTK, but it seems that there is no support for text translation using gettext and gtk::Builder. I think this method from GTK documentation related to the problem, and it is not implemented yet.
At the moment, I need to manually re-set the text for the elements made in the Glade, wrapping it in gettext call (from gettext-rs crate) in my Rust code. Perhaps there is another way or this feature will appear in future?

@GuillaumeGomez
Copy link
Member

@EPashkin: The function isn't in the .gir definition?

@EPashkin
Copy link
Member

EPashkin commented Dec 7, 2016

It present, but not in manual builder.rs

@GuillaumeGomez
Copy link
Member

Want to add it or should I? Or maybe do you want to do it @fludardes?

@EPashkin
Copy link
Member

EPashkin commented Dec 7, 2016

@GuillaumeGomez, I currently don't have idea how to test this.
@fludardes, can you check this code? Need add to src/builder.rs of gtk

    pub fn set_translation_domain(&self, domain: Option<&str>) {
        unsafe {
            ffi::gtk_builder_set_translation_domain(self.to_glib_none().0, domain.to_glib_none().0);
        }
    }

    pub fn get_translation_domain(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gtk_builder_get_translation_domain(self.to_glib_none().0))
        }
    }

EDIT: make domain optional

@emkoder
Copy link
Contributor Author

emkoder commented Dec 7, 2016

@EPashkin, Thanks a lot! It works!

@EPashkin
Copy link
Member

EPashkin commented Dec 7, 2016

@fludardes, can you make PR?

@emkoder
Copy link
Contributor Author

emkoder commented Dec 7, 2016

@EPashkin, I'm rather new to git and GitHub, it will take some time. If you agree, I'll try.

@EPashkin
Copy link
Member

EPashkin commented Dec 7, 2016

NP, we can wait
Anyway currently your CI checks (travis and appveyor) in bad state so approving PR can also take some time.

@emkoder
Copy link
Contributor Author

emkoder commented Dec 7, 2016

Done.

alex179ohm pushed a commit to alex179ohm/gtk that referenced this issue Oct 21, 2019
Fix generation of anonymous unions and structs-in-unions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants