Bug 64800 - Some menu item labels are gone (e.g, html_report, compile_jsr223, schematic_view, import_curl) once switching to non-English and back to English
Summary: Some menu item labels are gone (e.g, html_report, compile_jsr223, schematic_v...
Status: CLOSED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.3
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.4
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2020-10-11 14:15 UTC by Woonsan Ko
Modified: 2020-10-18 13:38 UTC (History)
2 users (show)



Attachments
Labels of some tools menu items are gone when switching to French (71.15 KB, image/png)
2020-10-11 14:15 UTC, Woonsan Ko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Woonsan Ko 2020-10-11 14:15:35 UTC
Created attachment 37493 [details]
Labels of some tools menu items are gone when switching to French

* Reproduction Path
- Run JMeter 5.3.
- In English (by default), you can see the "Generate HTML Report", "Compile JSR223 Test Elements", "Generate Schematic View (alpha)" and "Import from cURL" menu items under the "Tools" menu.
- Switch to a non-English language through "Options / Choose Language / ..." menu item. e.g, "French".
- Check the "Tools" menu ("Outils" in French) again.
- Now some of the menu items underneath are not showing the translated messages; instead it shows "[res_key] html_report", "[res_key=compile_jsr223]", "[res_key=schematic_view]" and "[res_key] import_curl". (See attachment.)
- Strangely, even if you switch back to English ("Options / Choisir une langue / Anglais"), the four menu items under the "Tools" no more shows the proper English translation messages.
Comment 1 Woonsan Ko 2020-10-11 14:16:39 UTC
Discovered while testing https://bz.apache.org/bugzilla/show_bug.cgi?id=64787.
Will try to find the root cause...
Comment 2 Woonsan Ko 2020-10-11 16:44:10 UTC
Fixes suggested and ready for review in PR: https://github.com/apache/jmeter/pull/631

---

The root cause:

- `HtmlReportAction.getMenuItemsAtLocation(MENU_LOCATION)` reads the translated label using the key, "generate_report_ui.html_report_menu", while its component name is "html_report".
  `CompileJSR223TestElements.getMenuItemsAtLocation(MENU_LOCATION)` uses "compile_menu" while its name is "compile_jsr223".
  `SchematicView.getMenuItemsAtLocation(MENU_LOCATION)` uses "schematic_view_menu" while its name is "schematic_view".
  `ParseCurlCommandAction.getMenuItemsAtLocation(MENU_LOCATION)` uses "curl_import_menu" while its name is "import_curl".

- `JMeterMenuBar.updateMenuElement(MenuElement)` seems to reset the label by resolving the translated label by using the component name, "html_report", as the key (L738-) for example.
  I assume that it was designed originally to use the action component name as the menu item label resource key. 

- So, it was caused by the fact that each phase - (a) initial menu label resolution and (b) resetting the menu label on language switching in JMeterMenuBar - uses different keys for those menu item components.

---

Based on my assumption ("...designed originally to use the action component name as the menu item label resource key"), the PR suggests to use the action component name as the keys consistently.
Comment 4 Woonsan Ko 2020-10-18 13:38:03 UTC
Thank you!