Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic locale results in blank page for unimplemented language #104

Closed
j123b567 opened this issue Mar 24, 2021 · 2 comments
Closed

Automatic locale results in blank page for unimplemented language #104

j123b567 opened this issue Mar 24, 2021 · 2 comments

Comments

@j123b567
Copy link

When the default locale is automatic, but the client locale is not implemented (e.g. "cs"), client script fails and no page is displayed.

Deeper investigation:
oui-ui-core/vue/src/App.vue calls rpc function oui.load_locales

For unknown locale, oui-httpd/files/rpc/oui.lua:load_locales returns empty Lua object {}

This object is later identified as an object and not as an array by oui-httpd/src/lua2json.c:lua_test_array, because it is empty.

RPC then returns JSON result {} instead of []

In oui-ui-core/vue/src/App.vue, on result, method forEach is called, which does not exists for object type, but exists for array type. This causes Uncaught (in promise) TypeError: t.forEach is not a function javascript exception and client side javascript completely terminates.

I would like to fix it myself, but I don't know the best place to do it.
Doing the similar trick like mpx/lua-cjson@3b1429f would be nice but my knowledge of Lua is limited to create a PR. Other solutions are probably easier, but ugly (test special case of {} in Vue, etc.)

@zhaojh329
Copy link
Owner

This is the tricky question of whether to turn to "{ }" or "[ ]" for an empty Lua Table.

@zhaojh329
Copy link
Owner

1a8197c

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

No branches or pull requests

2 participants