Android: App Configuration panel ignores user defined language

Created on 23 Sep 2020  路  12Comments  路  Source: home-assistant/android

Home Assistant Android version: 2.4.1.-full

Android version: 8.0.0

Phone model: SM-G930F

Home Assistant version: Latest dev (0.116.0)

Last working Home Assistant release (if known):

Description of problem:
The user logged into the app has its language set to English, which is generally adhered to in the app, with the exception of the "App Configuration" panel where everything is still in German (language of the mobile phone itself).

Possibly related: The exposed sensors from the phone also use a German name in HA.

Traceback (if applicable):


Screenshot of problem:

Additional information:

bug webview

Most helpful comment

My opinion is that

  • the sensor name should respect the phone system language
  • the entity id should NOT be translated, and (at least by default) always named in english

image

The rational behind it is that the former is something that belong to the user experience, the UI.
The latter is what will be used by scripts; it is part of the 'hassio programming language' and that would be really awkward to see it in spanish or italian.

If you are not happy with the above arbitrary decision, I think that it should be possible to at least allow the user to specify how he wants the sensors to be named. I think the proper time would be when the user logs on in the mobile app:

image

At this stage the integration has not yet been created, so it should be a proper time to ask.

All 12 comments

You need to make sure the phone and HA matches the language you expect to see. HA frontend only respects the user profile, the app respects your phone language

@dshokouhi So I understand that correctly: You are saying that my use case is currently not supported (having a German phone but wanting to run all of HA in English)?

Is there no way for the app to respect the HA user profile to be consistent and not display a language mixture?

To my understanding apps on your phone take on the system provided language. Our app is a unique case though because we have a webview that has its own language independent from your phone. We provide translation strings in our app and your phone will decide when to show what based on its selected language. I don't believe the app can override that logic while also pulling in the current selected user profile language. We don't get notified when that value changes from your profile so even if we did it, it would be out of sync any time it gets changed. If we are able to offer the app to override the system language then this would be really confusing to users. They would then need to differentiate between their device language, the app language and also the HA frontend language.

So on a technical level, is this understanding then correct:

The "App Configuration" panel icon that is shown in the HA sidebar in the app is not actually part of the regular HA frontend (so not injected by the app into it) but instead is basically a link/trigger that tells the actual Android app to show an Android settings page with the app/sensor settings and that page then has to follow the device language since not actually part of the regular HA frontend?

That at least seems to align with my observations now that I paid a closer look at the app.

That is correct, the Android app controls what appears in the settings. The front end detects that an external app is being used and then shows the App Configuration menu that we can use.

https://developers.home-assistant.io/docs/frontend/external-bus/#show-config-screen-config_screenshow
https://developers.home-assistant.io/docs/api/native-app-integration/webview

I think the best way to correct this would be to put an override in the app configuration to change to a desired language, similar to what we do with the app theme.

I tried to fix this and faced with issue overriding context with current themes implementation. It does not work with light theme.

@JBassett is there anything preventing us from update appcompat to ver. 1.2.0
Seems like it was fixed there https://developer.android.com/jetpack/androidx/releases/appcompat#1.2.0

@skynetua I don't believe there is anything preventing us.

@skynetua I tried bumping that dependency earlier and had issues https://github.com/home-assistant/android/pull/842#issuecomment-683319138 so had to revert the change.

In my case it's quite annoying that entity ids for sensors in the mobile app get translated to Spanish (what we got in our phones), while everything else from integrations get English entity ids.

To my best knowledge non-mobile-app integrations use English entity ids for sensors, and even English friendly names for them. If they need to be translated at all, the entity ids should use a consistent language to the one used by the HA install, rather than being device-dependent.

@skandalfo a lot of integrations actually pull the user defined name which can be anything. In this case we need to allow a language override in the app to overcome this. Luckily app the entities are registered so you are free to rename them as you see fit in the meantime.

@dshokouhi thanks! I didn't realize these can be overridden in the backend's config.

My opinion is that

  • the sensor name should respect the phone system language
  • the entity id should NOT be translated, and (at least by default) always named in english

image

The rational behind it is that the former is something that belong to the user experience, the UI.
The latter is what will be used by scripts; it is part of the 'hassio programming language' and that would be really awkward to see it in spanish or italian.

If you are not happy with the above arbitrary decision, I think that it should be possible to at least allow the user to specify how he wants the sensors to be named. I think the proper time would be when the user logs on in the mobile app:

image

At this stage the integration has not yet been created, so it should be a proper time to ask.

Was this page helpful?
0 / 5 - 0 ratings