Skip to content

Fix translation key of changeComponentHint used in ModbusApiProps#3128

Merged
sfeilmeier merged 1 commit intoOpenEMS:developfrom
girasolenergy:fix/translationkey
May 26, 2025
Merged

Fix translation key of changeComponentHint used in ModbusApiProps#3128
sfeilmeier merged 1 commit intoOpenEMS:developfrom
girasolenergy:fix/translationkey

Conversation

@anees-ps
Copy link
Copy Markdown
Contributor

The Key used in ModbusApiProps for translation of message: <a class=\"warning\">Note</a>: When inserting a component, the Modbus table also changes! is App.Api.Modbus.changeComponentHint

https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.core/src/io/openems/edge/app/api/ModbusApiProps.java#L51

I encountered this discrepancy while running unit tests — the testEnglishTranslation under TestTranslations failed with the following message:

java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key App.Api.Modbus.changeComponentHint at java.base/java.util.ResourceBundle.getObject(ResourceBundle.java:567) at java.base/java.util.ResourceBundle.getString(ResourceBundle.java:523) at io.openems.edge.core.appmanager.TranslationUtil.getNullableTranslation(TranslationUtil.java:119) at io.openems.edge.core.appmanager.TranslationUtil$DebugTranslator.getTranslation(TranslationUtil.java:45) at io.openems.edge.core.appmanager.TranslationUtil.getTranslation(TranslationUtil.java:85)

Interestingly, I didn’t observe this failure in the openems-fork repository. However, it appears that the key is mismatched in the translation_en.properties file. I believe the correct key (App.Api.Modbus.changeComponentHint) should be updated there to resolve the issue.

@sfeilmeier
Copy link
Copy Markdown
Contributor

@fabian94533 Can you please review this?

@sfeilmeier sfeilmeier requested a review from fabian94533 May 16, 2025 06:28
@fabian94533
Copy link
Copy Markdown
Contributor

Hi @anees-ps . You are right. The english translation key should actually be App.Api.ModbusTcp.changeComponentHint . I have actually never encountered this Exception. I guess this is because I mainly use OpenEMS in german. Thank you for highlighting this issue.

Copy link
Copy Markdown
Contributor

@sfeilmeier sfeilmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I will add a separate PR that fixes the JUnit test that should have detected this error before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants