ioBroker / create-adapter

Command line utility to create customized ioBroker adapters
MIT License
50 stars 23 forks source link

uk translation causing errors in admin sites (GenericApp.js:119 Uncaught TypeError: Cannot convert undefined or null to object) #1095

Open stevenengland opened 8 months ago

stevenengland commented 8 months ago

Hi there,

a newly created adapter using npx @iobroker/create-adapter@latest with

    "adminUi": "react",
    "tabReact": "yes",

creates adapter files using uk translations in admin/src/app.tsx and admin/src/tab-app.tsx

Currently this will cause a mismatch when the translations from GenericApp, which do not contain the uk entry, are mapped against each other. grafik

The error thrown is then GenericApp.js:119 Uncaught TypeError: Cannot convert undefined or null to object.

AlCalzone commented 8 months ago

We'll need to replace @iobroker/adapter-react with @iobroker/adapter-react-v5 and possibly modify the templates a bit if something needs changing. Would you be willing to help with that? Knowing what exactly needs to be changed where would be good.

stevenengland commented 8 months ago

Hi @AlCalzone ,

I would like to help but I am not quite sure how to do so best because I do not know a lot about the differences between the adapter-react and adapter-react-v5 version :)

If uk shall be supported: Then maybe all that is to do is to add the key uk in the adapter-react version here: https://github.com/ioBroker/adapter-react/blob/259cd1f2a7ee5b19067d1ab2582ea05ea64d3575/src/GenericApp.js#L116

If uk shall NOT be supported right now, the uk entry should be removed in these files (my actual workaround to get the adapter admin working):

stevenengland commented 8 months ago

Indeed adapter-react-v5 has the uk entry already in the list of languages. But I really have no clue if switching to v5 has some other implications. Therefore I am too new to the topic :)

stevenengland commented 8 months ago

Oh, now I think I know, what you mean @AlCalzone There is quite a huge list that needs to be tackled to switch to v5, at least this is what the developers say... https://github.com/ioBroker/adapter-react-v5/?tab=readme-ov-file#migration-from-adapter-react-to-adapter-react-v5

You mean that?