Code::Blocks

User forums => Using Code::Blocks => Topic started by: Anbang24 on December 25, 2019, 01:38:33 am

Title: "Find broken files in project" positioned under menu "Plugins"
Post by: Anbang24 on December 25, 2019, 01:38:33 am
When the language of Code::Blocks is set as English, there are many plugins under main menu "Plugins(L)", shown as (A) in the attached picture.

But when the language is set as Chinese, then most of the plugins are still under main menu "插件(L) ("Plugins(L)" in English), however, the plugin "Find broken files in project" is not in this menu, but under another separated menu "插件" ("Plugin" in English).  Shown as (B) and (C) in the attached picture.

If we set the language to Russian, then most of the plugins are under the Russian menu "модель", the plugin "Find broken files in project" is under another separated menu "Plugins".  Shown as (D) and (E) in the attached picture.

Please check this problem.
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: stahta01 on December 25, 2019, 05:54:18 am
Which Code::Blocks version/SVN?

Tim S.
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: stahta01 on December 25, 2019, 06:10:22 am
Does anyone know is translation magic work on script files like "plugin_find_broken_files.script"?

Tim S.
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: Anbang24 on December 25, 2019, 06:19:55 am
Which Code::Blocks version/SVN?

Tim S.

Code::Blocks 17.12, build 30 Dec 2017.

It is the latest version from the "Download binary" webpage: http://www.codeblocks.org/downloads/26
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: Anbang24 on December 25, 2019, 06:41:14 am
Does anyone know is translation magic work on script files like "plugin_find_broken_files.script"?

Tim S.

I opened "plugin_find_broken_files.script" in **\CodeBlocks\share\CodeBlocks\scripts\ , and found that there is such a function:

    // create menubar items
    function GetMenu()
    {
        local entries = ::wxArrayString();
        entries.Add(_("Plugins") + _T("/0:-") + _("Find broken files in project"), 1);
        return entries;
    }

Obviously, here lies the problem: it tries to add a menuentry under the menu named "Plugins".
In order to eliminate the problem, I should make a translation here.

However, this is not a good solution. Because I found another magic:
Open C::B (whatever the version or language), click "Plugins > Manage plugins", select one plugin in "Installed plugins" list, then click "Disable", the menu "plugins" will refresh, and "Find broken files in project" disappeared! (It will return back when restart C::B).

In my opinion, the plugin "Find broken files in project" shouldn't add itself to the menu by a startup script. It should be managed as same as other plugins!

Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: stahta01 on December 25, 2019, 09:07:55 am
In my opinion, the plugin "Find broken files in project" shouldn't add itself to the menu by a startup script. It should be managed as same as other plugins!

I disagree!

It is the only script "plugin"; it can not be handled like the c++ code plugins.

Tim S.
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: Anbang24 on December 25, 2019, 01:40:19 pm
I disagree!
It is the only script "plugin"; it can not be handled like the c++ code plugins.

I understand your opinion. However, how could we solve the problem?
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: stahta01 on December 25, 2019, 02:48:39 pm
I disagree!
It is the only script "plugin"; it can not be handled like the c++ code plugins.

I understand your opinion. However, how could we solve the problem?

I have no idea; you will need to wait for a CB Developer; likely need to be one that understand CB scripting enough to decide how much of the fix needs done in C++ and how much in CB scripting.

I see a clear way to fix the menu name; but, I see no way to fix menu item name.

menu name: "Plugins"
menu item name: "Find broken files in project"

Tim S.
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: gd_on on December 25, 2019, 08:07:55 pm
Apparently, in this script, the line you mention is the only one that may be translated: strings beginning with _(
So, what happen if you simply replace the two _( by two  _T(  Of course, it will not be translated, but it could also work as expected ....
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: stahta01 on December 25, 2019, 08:15:05 pm
Apparently, in this script, the line you mention is the only one that may be translated: strings beginning with _(
So, what happen if you simply replace the two _( by two  _T(  Of course, it will not be translated, but it could also work as expected ....

The problem is more likely that line is NOT being translated already.

Tim S.
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: gd_on on December 26, 2019, 11:21:34 am
Oups, sorry.
Nevertheless, I have tried a few things in this script. Translation can work.
The problem, may be, comes from the menu "Plugins" :
Here, in the script, it is identified by simply "Plugins". And it's only there, it is identified like that.
In the translation file, I find "&Plugins" (used in 1 xrc file)  or even "P&lugins" (used in 5 files: 4 cpp and 1 xrc). It's not the same string. Which one should be used in the script ? ... needs some more investigations...
Have a nice Christmas  ;)
Gd_on

PS : @Anbang24 : Could you try a nightly ? I I remember well, someone tried to use or work on some of the menu strings without the ampersand character (the &) or morelss independantly of its position. But may be it was not still implemented in official 17.12 version. And of course, this implementation has an effect on translations !!!
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: Anbang24 on December 27, 2019, 12:20:07 am
PS : @Anbang24 : Could you try a nightly ? I remember well, someone tried to use or work on some of the menu strings without the ampersand character (the &) or morelss independantly of its position. But may be it was not still implemented in official 17.12 version. And of course, this implementation has an effect on translations !!!

I downloaded the "15 December 2019 build (11927)" and tried. Yes, it works! The script plugin "Find broken files in project" appears under the translated menu "Plugin". That's OK! The problem solved!
Title: Re: "Find broken files in project" positioned under menu "Plugins"
Post by: gd_on on December 27, 2019, 12:15:19 pm
Cool  ;D
I think with C::B version 17.12, it should have been OK if in the script you replace   entries.Add(_("Plugins")... by   entries.Add(_("P&lugins")...
But it's not necessary with nightlies and certainly also in the future new version 20.xx.

gd_on