Skip to content

Conversation

@McGiverGim
Copy link
Member

This adds a select in the options menu to let the user select the prefered language for the app.

The language is hot changed, but with some problems in the actual code:

  • It changes all the statics texts
  • The texts generated in a .js file (like selects, for example), remains with the older language.
  • The texts changed in a .js (like the connect and disconnect text button) return to the original value.
  • When refreshing a tab or restarting the app, the texts are translated correctly.

All the problems are easily solvable. When adding an element to a select, or changing the content of a button, we need to add or change the i18n attribute too.

We can do two things:

  • Don't hot change the language (a reboot of the app will be required).
  • Let the code as is, with hot change, and I will push some PR to solve the above problems, or at least the major part of them.

I prefer the second solution, as I say is not as difficult, and the problems with the selects is a minor problem that with a tab change is solved.

@mikeller
Copy link
Member

I am in favour of the first proposal, to require a restart:

  • the restart can probably be triggered from within the application, with a dialog that pops up after the user changes the language;
  • while changing everything on the fly is feasible, it will require special handling throughout all of the code. This will require all contributors to know about it, and increase the effort required for code reviews, and fixups of on the fly translations. In terms of maintainability I think this is not a desirable outcome.

@McGiverGim
Copy link
Member Author

McGiverGim commented Jan 28, 2018

Is a pity. The 95% of the code is ready, and except the connect button, the only strings that are not translated are combos and if a developer forgets to add the code, nothing "bad" happens.
We wait for other opinions or I change it?

Hot change is useful if a user don't finds something in his language and changes momentary to English. Without hot change a reconnect will be necessary.

@mikeller
Copy link
Member

There's the problem: The last 5% of the code will have to go all through the application, where they will require extra maintenance. I am not sure that much on-the-spot switching forth and back will be happening, most of the time the user will switch to their language of choice, and then stay there. This seems to be the assumption in a lot of other applications that require a restart to change the language at least.

@McGiverGim McGiverGim force-pushed the bf-language_user_selectable branch 3 times, most recently from 978a4e8 to 7019de9 Compare January 28, 2018 12:39
@McGiverGim McGiverGim force-pushed the bf-language_user_selectable branch from 7019de9 to c467f59 Compare January 28, 2018 12:39
@McGiverGim
Copy link
Member Author

Ok, code changed. Now there's simply a text next to the language select saying that a restart is required.

Doing the restart can take more work, I'm not too sure how to maintain the state of the connection, check that is not in a dangerous moment (flashing firmware, etc.) or how to do it. Maybe in a future PR?

@mikeller mikeller merged commit fd0afd1 into betaflight:master Jan 28, 2018
@mikeller
Copy link
Member

Thanks for changing this, @McGiverGim. I think this is perfectly good for now. It solves the problem of users wanting to use a language that is different from their system language (which is normally a permanent choice). If users have to switch forth and back between languages in order to get the information they need, then I suspect this is more of a problem of the information not being clear, and should be fixed by clarification, and making it easy to switch languages is just a workaround.

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.

2 participants