Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization completion - forcing reload of menu translations #267

Open
maurizioandreotti opened this issue Oct 25, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@maurizioandreotti
Copy link
Contributor

maurizioandreotti commented Oct 25, 2023

Reporting here as a reminder the piece of code for forcing the reload of the menu labels from .pot files

Before moving on to other stuff, as I spent some time to came to find a solution to complete the menu translation I'd like to see it here, at least commented, thanks.

I am referring to this code:

       #Reapply gettext configuration to have UI labels translated
        gettext.bindtextdomain('D-RATS', "locale")
        gettext.textdomain('D-RATS')
        _ = gettext.gettext

        self._application = application
        self._window = self._wtree.get_object("mainwindow")

        # Retrieve other translatable objects and set their text
        self.logger.info(" Forcing UI labels translation:")

        label_from_builder = wtree.get_object("mnu_tools")
        label_from_builder.set_label(_("Tools"))
        label_from_builder = wtree.get_object("main_menu_importmsg")
        label_from_builder.set_label(_("Import Message"))
        label_from_builder = wtree.get_object("main_menu_exportmsg")
        label_from_builder.set_label(_("Export Message"))
        label_from_builder = wtree.get_object("main_menu_msgtemplates") 

        label_from_builder.set_label(_("Message Templates"))
        label_from_builder = wtree.get_object("main_menu_ping")
        label_from_builder.set_label(_("Ping Station"))
        label_from_builder = wtree.get_object("main_menu_conninet")
        label_from_builder.set_label(_("Connected to Internet"))
        label_from_builder = wtree.get_object("menuitem3")
        label_from_builder.set_label(_("_View"))

        label_from_builder = wtree.get_object("menuitem4")
        label_from_builder.set_label(_("_Help"))
        label_from_builder = wtree.get_object("main_menu_debuglog")
        label_from_builder.set_label(_("Show debug log"))
        label_from_builder = wtree.get_object("main_menu_about")
        label_from_builder.set_label(_("About"))

        label_from_builder = wtree.get_object("tab_label_msg")
        #label_from_builder.set_text(_("Messages"))

        #Event Log Tab
        label_from_builder = wtree.get_object("label6")
        label_from_builder.set_label(_("Show event type:"))
        label_from_builder = wtree.get_object("label7")
        label_from_builder.set_label(_("Containing text:"))

        #------------
@wb8tyw
Copy link
Contributor

wb8tyw commented Oct 25, 2023

I thought that was in the last merge, but I did notice that it may not be working in a quick test.

The current algorithm has a list of widget IDs to look up.
For each widget, the current text is looked up, and then it is translated and the text on the label updated.

Where it fails is:

  • when the widget does not have an initial text, which I had to fix on a few widgets.
  • Wrong widget ID for the text was being looked up.
  • Translation missing from the compiled message catalog, possibly because if it missing / disabled in the po file.

@wb8tyw wb8tyw added the bug Something isn't working label Oct 25, 2023
@maurizioandreotti
Copy link
Contributor Author

maurizioandreotti commented Nov 14, 2023

Just rechecked and the italian translation apperar in 50% of the labels (in red italian, in yellow "untranslated english" )
image

Also tools should be "strumenti",...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants