From 1179d617790fa63ac0784d2f78ab738e92088c09 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 5 Mar 2024 09:41:21 +0100 Subject: [PATCH] Add blog about support for strings.platform_name.json will be removed (#2103) --- ...latform_entity_translations_deprecation.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 blog/2024-03-05-platform_entity_translations_deprecation.md diff --git a/blog/2024-03-05-platform_entity_translations_deprecation.md b/blog/2024-03-05-platform_entity_translations_deprecation.md new file mode 100644 index 00000000..03777e46 --- /dev/null +++ b/blog/2024-03-05-platform_entity_translations_deprecation.md @@ -0,0 +1,30 @@ +--- +author: Erik Montnemery +authorURL: https://github.com/emontnemery +title: "Support for platform translations in separate files will be removed" +--- + +The method for integrations to provide translations for states of its entities under other integrations, for example to translate an integration's sensors was changed in November 2022, and support for the old method will be removed in Home Assistant Core 2024.5.0. + +Once Home Assistant Core 2024.5.0 is released, integrations can no longer use custom device classes together with a `strings..json` file. Instead, entities must set the `translation_key` property on an entity and include that `translation_key` in the integration's `strings.json`. + +The following example `strings.json` is for a Moon domain `sensor` entity with its `translation_key` property set to `phase`: + +```json +{ + "entity": { + "sensor": { + "phase": { + "state": { + "new_moon": "New moon", + "first_quarter": "First quarter", + "full_moon": "Full moon", + "last_quarter": "Last quarter" + } + } + } + } +} +``` + +For more details, see the [`translation`](/docs/internationalization/core/#state-of-entities) and [`entity`](/docs/core/entity#generic-properties) documentation.