Weiter zum Inhalt
  • Home
  • Aktuell
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Hell
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dunkel
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. English
  3. Development
  4. Is it an `admin.adapter` issue, or an error in my code?

NEWS

  • iobroker.click: Visualisierungen und Vorlagen für ioBroker
    BluefoxB
    Bluefox
    16
    2
    957

  • Monatsrückblick Oktober 2026 ist online!
    BluefoxB
    Bluefox
    11
    1
    515

  • Mitmachen: Sprich „ioBroker“ ein – für ein lokales Aktivierungswort
    BluefoxB
    Bluefox
    6
    1
    650

Is it an `admin.adapter` issue, or an error in my code?

Geplant Angeheftet Gesperrt Verschoben Development
7 Beiträge 4 Kommentatoren 269 Aufrufe 3 Beobachtet
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • M
    M
    mguc
    schrieb am zuletzt editiert von mguc
    #1

    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.
    problem1.png
    In the browser console (F12 key), I can see that the translated text appears.
    problem2.png

    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?

    1 Antwort Letzte Antwort
    0
    • arteckA
      arteckA
      arteck
      Developer Most Active
      schrieb am zuletzt editiert von
      #2

      dobre pytanie :-)

      zigbee hab ich, zwave auch, nuc's genauso und HA auch

      1 Antwort Letzte Antwort
      0
      • mcm1957M
        mcm1957M
        mcm1957
        Developer Most Active
        schrieb am zuletzt editiert von
        #3

        @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.

        Entwicklung u Betreuung: envertech-pv, hoymiles-ms, ns-client, pid, snmp Adapter;
        Support Repositoryverwaltung.

        Wer 'nen Kaffee spendieren will: https://paypal.me

        LESEN - gute Forenbeitrage

        M 1 Antwort Letzte Antwort
        0
        • mcm1957M mcm1957

          @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.

          M
          M
          mguc
          schrieb am zuletzt editiert von mguc
          #4

          @mcm1957 napisał:

          @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"
            },
          
          mcm1957M 1 Antwort Letzte Antwort
          0
          • M mguc

            @mcm1957 napisał:

            @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"
              },
            
            mcm1957M
            mcm1957M
            mcm1957
            Developer Most Active
            schrieb am zuletzt editiert von
            #5

            @mguc said:

            @mcm1957 napisał:

            @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

            Entwicklung u Betreuung: envertech-pv, hoymiles-ms, ns-client, pid, snmp Adapter;
            Support Repositoryverwaltung.

            Wer 'nen Kaffee spendieren will: https://paypal.me

            LESEN - gute Forenbeitrage

            M 1 Antwort Letzte Antwort
            0
            • mcm1957M mcm1957

              @mguc said:

              @mcm1957 napisał:

              @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

              M
              M
              mguc
              schrieb am zuletzt editiert von
              #6

              @mcm1957 Okay, added.
              https://github.com/ioBroker/ioBroker.admin/issues/3766

              BluefoxB 1 Antwort Letzte Antwort
              1
              • M mguc

                @mcm1957 Okay, added.
                https://github.com/ioBroker/ioBroker.admin/issues/3766

                BluefoxB
                BluefoxB
                Bluefox
                schrieb zuletzt editiert von
                #7

                @mguc Thanks for the issue. Your config was correct, it was a bug in the sendTo component of jsonConfig. It showed the translated text from result ("Połączenie udane!", you can see it in your console) and then a second message with the raw key, and that one replaced the first in the snackbar.

                It's fixed in admin 8.3.18 (json-config 10.1.26), see #3766. You have 8.3.15, so please update admin and then you can go back to

                this.sendTo(obj.from, obj.command, { result: 'tab_db_connected' }, obj.callback);
                

                with your result mapping in jsonConfig. Values in result that are not in the mapping are now translated too, the same as error.

                1 Antwort Letzte Antwort
                0

                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
                Antworten
                • In einem neuen Thema antworten
                Anmelden zum Antworten
                • Älteste zuerst
                • Neuste zuerst
                • Meiste Stimmen


                Support us

                ioBroker
                Community Adapters
                Donate

                442

                Online

                33.2k

                Benutzer

                84.4k

                Themen

                1.4m

                Beiträge
                Community
                Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                ioBroker Community 2014-2026
                logo
                • Anmelden

                • Du hast noch kein Konto? Registrieren

                • Anmelden oder registrieren, um zu suchen
                • Erster Beitrag
                  Letzter Beitrag
                0
                • Home
                • Aktuell
                • Ungelesen 0
                • Kategorien
                • Unreplied
                • Beliebt
                • GitHub
                • Docu
                • Hilfe