NEWS
Is it an `admin.adapter` issue, or an error in my code?
-
I am currently writing my first adapter for ioBroker and have run into a problem I cannot seem to solve. It concerns displaying a message that is i18n-compliant (consistent with everything else in the adapter). The attached image illustrates the issue: when the "TEST CONNECTION" button is pressed, the adapter performs the task and confirms it with a message in the bottom-left corner. The problem is that the message ID is displayed instead of the actual translated text associated with it.

In the browser console (F12 key), I can see that the translated text appears.

Invoking a window within the onMessage(obj) method looks like this (file main.js):
// Send response in callback if required if (obj.callback) { this.sendTo(obj.from, obj.command, { result: 'tab_db_connected' }, obj.callback);The definition in the jsonConfig.json file looks like this:
"_dbTestDB": { "type": "sendTo", "result": { "tab_db_connected" : "tab_db_test_connected" }, },And the key for translation (pl.json):
{ "tab_db_test_connected" : "Połączenie udane!", }What am I doing wrong that the text isn't displaying?
-
-
-
@bluefox
Could you help please.
I'm not sure if the retuern value will be translated at all. If not, this might be worth considering at admin / jsonconfig.@bluefox
Could you help please.
I'm not sure if the retuern value will be translated at all. If not, this might be worth considering at admin / jsonconfig.It seems to me that it doesn't explain anything.
I changed the call:if (obj.callback) { const errorMsg = I18n.t('tab_db_test_connected'); this.sendTo(obj.from, obj.command, { result: errorMsg }, obj.callback); }And, of course, the translated text appeared. In my opinion, the entry below should automatically generate a translation. But as for what’s more convenient—well, you probably know that better than I do ;).
"result": { "tab_db_connected" : "tab_db_test_connected" }, -
@bluefox
Could you help please.
I'm not sure if the retuern value will be translated at all. If not, this might be worth considering at admin / jsonconfig.It seems to me that it doesn't explain anything.
I changed the call:if (obj.callback) { const errorMsg = I18n.t('tab_db_test_connected'); this.sendTo(obj.from, obj.command, { result: errorMsg }, obj.callback); }And, of course, the translated text appeared. In my opinion, the entry below should automatically generate a translation. But as for what’s more convenient—well, you probably know that better than I do ;).
"result": { "tab_db_connected" : "tab_db_test_connected" },@bluefox
Could you help please.
I'm not sure if the retuern value will be translated at all. If not, this might be worth considering at admin / jsonconfig.It seems to me that it doesn't explain anything.
I changed the call:if (obj.callback) { const errorMsg = I18n.t('tab_db_test_connected'); this.sendTo(obj.from, obj.command, { result: errorMsg }, obj.callback); }And, of course, the translated text appeared. In my opinion, the entry below should automatically generate a translation. But as for what’s more convenient—well, you probably know that better than I do ;).
"result": { "tab_db_connected" : "tab_db_test_connected" },Please feel free to open a issue / feature request at admin
-
@bluefox
Could you help please.
I'm not sure if the retuern value will be translated at all. If not, this might be worth considering at admin / jsonconfig.It seems to me that it doesn't explain anything.
I changed the call:if (obj.callback) { const errorMsg = I18n.t('tab_db_test_connected'); this.sendTo(obj.from, obj.command, { result: errorMsg }, obj.callback); }And, of course, the translated text appeared. In my opinion, the entry below should automatically generate a translation. But as for what’s more convenient—well, you probably know that better than I do ;).
"result": { "tab_db_connected" : "tab_db_test_connected" },Please feel free to open a issue / feature request at admin
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden