Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 18
Posts: 18   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 2291 times and has 17 replies Next Thread
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

Translation of plug-in menu items is not handled in HomePane class, they won’t change in the user interface.

Would this ever be possible?
Wondering if it wasn't too complicated to program, I looked at HomePane class and discovered that the translation of plug-in menu items has been supported since day 1! I completely forgot that I programmed that.
Your code might not work because you don't use the expected class loader in ResourceBundle.getBundle call. But I'm not sure and hope you'll find by comparing your code to the one in the new version 1.1 of ExportTOSH3F plug-in where I programmed this feature.

It would be nice if the program could check if the menu name matches one of the predefined menu names in English language, and, if so, put the new entry in the proper main menu regardless of the current language.
I programmed this feature and it will be available in the next version.
The handling of the Tools menu will wait.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Mar 4, 2024, 5:53:03 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 436
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

I programmed this feature and it will be available in the next version.
The handling of the Tools menu will wait.

Awesome, thank you!
[Mar 5, 2024, 5:39:49 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member




Joined: May 28, 2015
Post Count: 607
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

Your code might not work because you don't use the expected class loader in ResourceBundle.getBundle call. But I'm not sure and hope you'll find by comparing your code to the one in the new version 1.1 of ExportTOSH3F plug-in where I programmed this feature.
This has been working since version 2.7 of the plug-in.

The handling of the Tools menu will wait.
I still used the expected class loader in the ResourceBundle.getBundle call in anticipation of future plug-in menu handling.
----------------------------------------
EnkoNyito
[Mar 10, 2024, 3:47:11 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9381
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

I thought you first spoke about menu items and wanted them to be updated when preferences language is modified (in French, we rarely make the difference between "menus" and "menu items" and call all them "menus").
But actually, you would like that menus are updated too after a language change. This is a more difficult context to handle because there could be some conflicts between plug-ins when they appear in the same menu, and this is problably why I didn't program anything for that.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Mar 11, 2024, 2:29:47 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
dorin
Advanced Member
Member's Avatar

Romania
Joined: Apr 24, 2014
Post Count: 588
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

Probably I'm not quite the right person to give advises here but...
1. Thanks Emmanuel for the new ExportTOSH3F plugin.
I've adapted to two of my plugins which use some of the already existent menus and works very good(for me) even under v.7.2.
That's means:
1.1 The plugins load under the defined menu entry without the needs of other translations in AplicationPlugin or package file in all languages.
1.2 When switch the language the plugin name and the corresponding texts inside are updated without a restart.
1.3 Until now I don't seen a reason to re-code something for this purpose.

2. That encouraged me to define (for me and my plugins) a template:
2.1 Put in the PluginAction all the things I don't want to be touched by the translators: menu entry, icon and toolbar;
2.2 Add the LanguageChangeListener class provided by Emmanuel;
2.3 Put the AplicationPlugin.properties file in the root of the plugin only with the necessary entry to plugin to work. It wont be translated.
2.4 Under the default plugin package make a new package named "locales"
2.5 In this package(folder) put all the localized files with a chooses name+(plugin acronim)+locale symbol(_fr, _it, _ru ...).properties;
Mine looks like: pakageSHU_it.properties or pakageDE_de.properties.
2.6 Pay attention to set the correct path to this in plugin class.

3. For the rest of the plugins which use "Tools" as menu entry I'm still thinking.
Probably I will test if TOOLS_MENU.Name exist and, if not, I will use "Tools" for all the languages. I'll see.

4. In this context my wishes:
4.1 I prefer to have an unitary translation for the "Tools" inside of HomePane class to be used by the plugins(who thinks so).
4.2 The option to add sub menu(or contextual menu) to an exiting one or to a new one.
(If it wasn't programed already long time ago and I don't found it yet) sad
----------------------------------------
A computer program does what you tell it to do, not what you want it to do. Murphy's Law (Greer's Third Law)
When all else fails, read the instructions.Murphy's Law
[Apr 4, 2024, 8:27:48 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Waldemar.Hersacher
Member



Germany
Joined: Jan 6, 2024
Post Count: 36
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

Do we really need to define the translations for the country? I think we don't need to differentiate e. g. between DE_de, AT_de and CH_de.

BTW: which country is SHU? I didn't find it in the ISO 3166-1 list of countries.
----------------------------------------
MSI GP60, Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy, SH3D 7.4 with Photo-video rendering 2.8
[Apr 4, 2024, 8:58:14 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Advanced Member




Joined: May 18, 2021
Post Count: 243
Status: Online
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

Waldemar.Hersacher

en_GB != en_US != en_CA != en_AU and so on.

Yes, we need countries! Mostly because Americans can't spell. They also don't have a sense of humour... tongue
[Apr 5, 2024, 1:00:43 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
dorin
Advanced Member
Member's Avatar

Romania
Joined: Apr 24, 2014
Post Count: 588
Status: Offline
Reply to this Post  Reply with Quote 
Re: Dynamic translation of a plug-in

Probably I wasn't explicitly enough.
The main localization file (en):
pakageSHU.properties or pakageDE.properties
-for German (de) :
pakageSHU_de.properties or pakageDE_de.properties
-for Chinese (zh_CN):
pakageSHU_zh_CN.properties or pakageDE_zh_CN.properties
As I've write in the post +(plugin acronym)+:
-SHU mean SelectHideUtility
-DE mean DistributeElevation
-packageSHU name could be whatever you want but it need to be the same for all 18 or more files followed by the country code(_fr, _it, _de etc)
-I've choose this form to distinguished between the same file on different plugins.
In this way a translator could send me multiple files for different plugins at once.

I will publish soon the new version of Distribute Elevation plugin which I intend to use as template.
BTW I've discovered few days ago I've already used the FURNITURE_MENU.Name in this plugin in 2020 but I've forgot.

Sorry for the disturbance!
----------------------------------------
A computer program does what you tell it to do, not what you want it to do. Murphy's Law (Greer's Third Law)
When all else fails, read the instructions.Murphy's Law
[Apr 5, 2024, 7:21:05 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 18   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

  Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads  
© Copyright 2024 Space Mushrooms - All rights reserved