-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
RFC: Backend translations #9
Comments
Since they are never shown in the backend, I think it's fine to keep them as part of the frontend. Let's just make sure that they can be loaded on demand. With config entries we're going to have a lot of strings in the backend that need to be shown in the frontend. Although for now I have them as text, I plan on replacing them with translation keys before the official release of config entries. |
We will just need another script in the backend to upload translations to lokalise. I guess we should do that to a separate lokalise project. (but still just include the project in the frontend) |
Unless I'm missing some missing something, I think (1) is much better. First HA (backend) should be usable in non-English for users of UIs other than the official one. |
So it sounds like we're leaning towards option 1? @andrey-git's point about custom components certainly is enough to tip the scales for me. Updated the summary to also include @balloob's point that this will be a second project in Lokalise. |
Option 1 👍 |
Description
As of yet, we haven't tackled the problem of how to manage translations that are platform specific. I started a WIP PR with one approach, but I wanted to take a moment to get some more opinions.
Right now I see two approaches, detailed above. I started briefly with approach 1, but I'm starting to suspect that 2 will be easier to maintain in the long run. I think in reality, we're never going to need the flexibility that approach 1 would give us, and we could always revisit it later if it really came down to it.
1. Serve translations from the backend
This is the approach I started with the #12453. In this world, platforms will register their strings with the frontend component, which can then serve these translations to clients via an API endpoint. We will have two projects in Lokalise, the current polymer project, and a new project for backend translations.
Pros
2. Merge platform-specific translations into the polymer project
In this approach, we would merge platform-specific translations into our current translation source, under their own component/platform namespace. We would then use the existing translation fragment logic to fetch the strings for each platform that is loaded in hass.
Pros
Use Cases to consider
Configuration prompts:
https://github.com/home-assistant/home-assistant/blob/c7c0df53aab8e5cd22e7d5973e406e8d0a34b152/homeassistant/components/light/hue.py#L72-L84
Custom sensor states:
https://github.com/home-assistant/home-assistant/blob/c7c0df53aab8e5cd22e7d5973e406e8d0a34b152/homeassistant/components/sensor/season.py#L24-L27
The text was updated successfully, but these errors were encountered: