diff --git a/AGENTS.md b/AGENTS.md index 01a9b05..01c1ce0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ ### Directory and File Handling -- In the `custom_components/polleninformation/translations/` directory, only process the `en.json` file. All other files in this directory must be ignored. +- In the `custom_components/polleninformation/translations/` directory, only edit the `en.json` file for content changes (new strings, rewording, etc.). Mechanical changes required for validation compliance (e.g. HACS rules) may be applied across all translation files. ### Coding Principles diff --git a/custom_components/polleninformation/config_flow.py b/custom_components/polleninformation/config_flow.py index 9cd7d25..a615854 100644 --- a/custom_components/polleninformation/config_flow.py +++ b/custom_components/polleninformation/config_flow.py @@ -17,7 +17,7 @@ PollenApiError, async_get_pollenat_data, ) -from .const import DEFAULT_LANG, DOMAIN +from .const import API_KEY_REQUEST_URL, DEFAULT_LANG, DOMAIN from .options_flow import OptionsFlowHandler from .utils import ( async_get_country_code_from_latlon, @@ -285,6 +285,7 @@ async def async_step_user(self, user_input=None): step_id="user", data_schema=data_schema, errors=errors, + description_placeholders={"api_key_url": API_KEY_REQUEST_URL}, ) @staticmethod diff --git a/custom_components/polleninformation/const.py b/custom_components/polleninformation/const.py index f78134e..85a27ab 100644 --- a/custom_components/polleninformation/const.py +++ b/custom_components/polleninformation/const.py @@ -26,6 +26,11 @@ DEFAULT_NAME = "Polleninformation" DEFAULT_APIKEY = "" # Empty by default; must be set by user +# URL for requesting an API key +API_KEY_REQUEST_URL = ( + "https://www.polleninformation.at/en/data-interface/request-an-api-key" +) + # API URL for polleninformation.at (new structure) POLLENAT_API_URL = ( "https://www.polleninformation.at/api/forecast/public" diff --git a/custom_components/polleninformation/options_flow.py b/custom_components/polleninformation/options_flow.py index 3e990a5..6d14f56 100644 --- a/custom_components/polleninformation/options_flow.py +++ b/custom_components/polleninformation/options_flow.py @@ -12,7 +12,7 @@ from homeassistant import config_entries from homeassistant.helpers.selector import LocationSelector, LocationSelectorConfig -from .const import DEFAULT_LANG +from .const import API_KEY_REQUEST_URL, DEFAULT_LANG from .utils import async_get_country_options, async_get_language_options _LOGGER = logging.getLogger(__name__) @@ -81,11 +81,6 @@ async def async_step_init(self, user_input=None): } ) - api_key_info = ( - "An API key is required for polleninformation.at. " - "You can request an API key at: https://www.polleninformation.at/en/data-interface/request-an-api-key" - ) - if user_input is not None: country_code = user_input.get("country") lang_code = user_input.get("language") @@ -159,5 +154,5 @@ async def async_step_init(self, user_input=None): step_id="init", data_schema=data_schema, errors=errors, - description_placeholders={"api_key_info": api_key_info}, + description_placeholders={"api_key_url": API_KEY_REQUEST_URL}, ) diff --git a/custom_components/polleninformation/translations/de.json b/custom_components/polleninformation/translations/de.json index 0421afd..11c5605 100644 --- a/custom_components/polleninformation/translations/de.json +++ b/custom_components/polleninformation/translations/de.json @@ -12,7 +12,7 @@ "location_name": "Standortname (optional)", "apikey": "API-Schlüssel" }, - "description": "Wählen Sie das Land und den Ort, für den Sie die Pollenprognose überwachen möchten, sowie die Sprache, in der Ihre Sensoren konfiguriert werden sollen. Sie benötigen einen API-Schlüssel für polleninformation.at. Beantragen Sie diesen unter: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Wählen Sie das Land und den Ort, für den Sie die Pollenprognose überwachen möchten, sowie die Sprache, in der Ihre Sensoren konfiguriert werden sollen. Sie benötigen einen API-Schlüssel für polleninformation.at. Beantragen Sie diesen unter: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/en.json b/custom_components/polleninformation/translations/en.json index cd4a045..aead9dd 100644 --- a/custom_components/polleninformation/translations/en.json +++ b/custom_components/polleninformation/translations/en.json @@ -3,7 +3,7 @@ "step": { "user": { "title": "Add Pollen Information", - "description": "Select the country and location where you want to monitor the pollen forecast and the language you want your sensors configured as. You need an API key for polleninformation.at. Request it at: https://www.polleninformation.at/en/data-interface/request-an-api-key", + "description": "Select the country and location where you want to monitor the pollen forecast and the language you want your sensors configured as. You need an API key for polleninformation.at. Request it at: {api_key_url}", "data": { "country": "Country", "location": "Location (select on map)", diff --git a/custom_components/polleninformation/translations/es.json b/custom_components/polleninformation/translations/es.json index 06f7ab1..75c8704 100644 --- a/custom_components/polleninformation/translations/es.json +++ b/custom_components/polleninformation/translations/es.json @@ -12,7 +12,7 @@ "location_name": "Nombre de la ubicación (opcional)", "apikey": "Clave API" }, - "description": "Seleccione el país y la ubicación donde desea monitorear el pronóstico de polen y el idioma en el que desea configurar sus sensores. Necesita una clave API de polleninformation.at. Solicítela en: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Seleccione el país y la ubicación donde desea monitorear el pronóstico de polen y el idioma en el que desea configurar sus sensores. Necesita una clave API de polleninformation.at. Solicítela en: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/fi.json b/custom_components/polleninformation/translations/fi.json index 0a2aed1..b0c0f31 100644 --- a/custom_components/polleninformation/translations/fi.json +++ b/custom_components/polleninformation/translations/fi.json @@ -12,7 +12,7 @@ "location_name": "Sijainnin nimi (valinnainen)", "apikey": "API-avain" }, - "description": "Valitse maa ja sijainti, josta haluat seurata siitepölyennustetta, sekä kieli, jolla sensorit määritetään. Tarvitset API-avaimen palvelusta polleninformation.at. Pyydä avain täältä: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Valitse maa ja sijainti, josta haluat seurata siitepölyennustetta, sekä kieli, jolla sensorit määritetään. Tarvitset API-avaimen palvelusta polleninformation.at. Pyydä avain täältä: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/fr.json b/custom_components/polleninformation/translations/fr.json index 4ca29d2..282f07f 100644 --- a/custom_components/polleninformation/translations/fr.json +++ b/custom_components/polleninformation/translations/fr.json @@ -12,7 +12,7 @@ "location_name": "Nom de l'emplacement (optionnel)", "apikey": "Clé API" }, - "description": "Sélectionnez le pays et l'emplacement pour lesquels vous souhaitez surveiller les prévisions de pollen, ainsi que la langue souhaitée pour vos capteurs. Vous avez besoin d'une clé API pour polleninformation.at. Demandez-la ici : https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Sélectionnez le pays et l'emplacement pour lesquels vous souhaitez surveiller les prévisions de pollen, ainsi que la langue souhaitée pour vos capteurs. Vous avez besoin d'une clé API pour polleninformation.at. Demandez-la ici : {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/hu.json b/custom_components/polleninformation/translations/hu.json index 9996713..bc03961 100644 --- a/custom_components/polleninformation/translations/hu.json +++ b/custom_components/polleninformation/translations/hu.json @@ -12,7 +12,7 @@ "location_name": "Helyszín neve (opcionális)", "apikey": "API-kulcs" }, - "description": "Válassza ki az országot és a helyszínt, ahol figyelni szeretné a pollenjósltat, valamint a szenzorok beállításához kívánt nyelvet. Szüksége van egy API-kulcsra a polleninformation.at-hez. Igényelje itt: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Válassza ki az országot és a helyszínt, ahol figyelni szeretné a pollenjósltat, valamint a szenzorok beállításához kívánt nyelvet. Szüksége van egy API-kulcsra a polleninformation.at-hez. Igényelje itt: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/it.json b/custom_components/polleninformation/translations/it.json index 790e786..43db047 100644 --- a/custom_components/polleninformation/translations/it.json +++ b/custom_components/polleninformation/translations/it.json @@ -12,7 +12,7 @@ "location_name": "Nome posizione (opzionale)", "apikey": "Chiave API" }, - "description": "Seleziona il paese e la località per cui vuoi monitorare la previsione dei pollini e la lingua in cui configurare i tuoi sensori. È necessaria una chiave API per polleninformation.at. Richiedila qui: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Seleziona il paese e la località per cui vuoi monitorare la previsione dei pollini e la lingua in cui configurare i tuoi sensori. È necessaria una chiave API per polleninformation.at. Richiedila qui: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/lt.json b/custom_components/polleninformation/translations/lt.json index c0bc9dc..0f560a0 100644 --- a/custom_components/polleninformation/translations/lt.json +++ b/custom_components/polleninformation/translations/lt.json @@ -12,7 +12,7 @@ "location_name": "Vietos pavadinimas (neprivaloma)", "apikey": "API raktas" }, - "description": "Pasirinkite šalį ir vietą, kurioje norite stebėti žiedadulkių prognozę, bei kalbą, kuria bus konfigūruojami jutikliai. Jums reikia API rakto iš polleninformation.at. Prašykite čia: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Pasirinkite šalį ir vietą, kurioje norite stebėti žiedadulkių prognozę, bei kalbą, kuria bus konfigūruojami jutikliai. Jums reikia API rakto iš polleninformation.at. Prašykite čia: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/lv.json b/custom_components/polleninformation/translations/lv.json index 091d972..db00f24 100644 --- a/custom_components/polleninformation/translations/lv.json +++ b/custom_components/polleninformation/translations/lv.json @@ -12,7 +12,7 @@ "location_name": "Vietas nosaukums (nav obligāts)", "apikey": "API atslēga" }, - "description": "Izvēlieties valsti un atrašanās vietu, kur vēlaties uzraudzīt ziedputekšņu prognozi, un valodu, kādā konfigurēt sensorus. Jums ir nepieciešama API atslēga no polleninformation.at. Pieprasiet to šeit: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Izvēlieties valsti un atrašanās vietu, kur vēlaties uzraudzīt ziedputekšņu prognozi, un valodu, kādā konfigurēt sensorus. Jums ir nepieciešama API atslēga no polleninformation.at. Pieprasiet to šeit: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/pl.json b/custom_components/polleninformation/translations/pl.json index 19de464..8abbae8 100644 --- a/custom_components/polleninformation/translations/pl.json +++ b/custom_components/polleninformation/translations/pl.json @@ -12,7 +12,7 @@ "location_name": "Nazwa lokalizacji (opcjonalnie)", "apikey": "Klucz API" }, - "description": "Wybierz kraj i lokalizację, dla których chcesz monitorować prognozę pyłków oraz język, w jakim mają być skonfigurowane czujniki. Potrzebujesz klucza API do polleninformation.at. Złóż wniosek tutaj: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Wybierz kraj i lokalizację, dla których chcesz monitorować prognozę pyłków oraz język, w jakim mają być skonfigurowane czujniki. Potrzebujesz klucza API do polleninformation.at. Złóż wniosek tutaj: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/pt.json b/custom_components/polleninformation/translations/pt.json index 4b82b6e..203d83a 100644 --- a/custom_components/polleninformation/translations/pt.json +++ b/custom_components/polleninformation/translations/pt.json @@ -12,7 +12,7 @@ "location_name": "Nome da localização (opcional)", "apikey": "Chave API" }, - "description": "Selecione o país e a localização onde pretende monitorizar a previsão do pólen e o idioma para configurar os sensores. É necessária uma chave API do polleninformation.at. Solicite-a em: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Selecione o país e a localização onde pretende monitorizar a previsão do pólen e o idioma para configurar os sensores. É necessária uma chave API do polleninformation.at. Solicite-a em: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/ru.json b/custom_components/polleninformation/translations/ru.json index 8401a25..b6f10b5 100644 --- a/custom_components/polleninformation/translations/ru.json +++ b/custom_components/polleninformation/translations/ru.json @@ -12,7 +12,7 @@ "location_name": "Название местоположения (необязательно)", "apikey": "API-ключ" }, - "description": "Выберите страну и местоположение, для которых вы хотите отслеживать прогноз пыльцы, а также язык настройки ваших датчиков. Необходим API-ключ для polleninformation.at. Запросите его здесь: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Выберите страну и местоположение, для которых вы хотите отслеживать прогноз пыльцы, а также язык настройки ваших датчиков. Необходим API-ключ для polleninformation.at. Запросите его здесь: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/sk.json b/custom_components/polleninformation/translations/sk.json index 28a7303..d1b2472 100644 --- a/custom_components/polleninformation/translations/sk.json +++ b/custom_components/polleninformation/translations/sk.json @@ -12,7 +12,7 @@ "location_name": "Názov lokality (voliteľné)", "apikey": "API kľúč" }, - "description": "Vyberte krajinu a miesto, kde chcete sledovať predpoveď peľu, a jazyk, v ktorom chcete nastaviť senzory. Potrebujete API kľúč z polleninformation.at. Požiadajte oň tu: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Vyberte krajinu a miesto, kde chcete sledovať predpoveď peľu, a jazyk, v ktorom chcete nastaviť senzory. Potrebujete API kľúč z polleninformation.at. Požiadajte oň tu: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/sv.json b/custom_components/polleninformation/translations/sv.json index 1353588..62b5676 100644 --- a/custom_components/polleninformation/translations/sv.json +++ b/custom_components/polleninformation/translations/sv.json @@ -12,7 +12,7 @@ "location_name": "Platsnamn (valfritt)", "apikey": "API-nyckel" }, - "description": "Välj land och plats där du vill övervaka pollenprognosen samt det språk du vill ha dina sensorer på. Du behöver en API-nyckel för polleninformation.at. Begär den på: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Välj land och plats där du vill övervaka pollenprognosen samt det språk du vill ha dina sensorer på. Du behöver en API-nyckel för polleninformation.at. Begär den på: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/tr.json b/custom_components/polleninformation/translations/tr.json index 40df48d..e7d40f9 100644 --- a/custom_components/polleninformation/translations/tr.json +++ b/custom_components/polleninformation/translations/tr.json @@ -12,7 +12,7 @@ "location_name": "Konum adı (isteğe bağlı)", "apikey": "API anahtarı" }, - "description": "Polen tahminini izlemek istediğiniz ülkeyi ve konumu, ayrıca sensörlerinizi yapılandırmak istediğiniz dili seçin. polleninformation.at için bir API anahtarına ihtiyacınız var. Şuradan talep edin: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Polen tahminini izlemek istediğiniz ülkeyi ve konumu, ayrıca sensörlerinizi yapılandırmak istediğiniz dili seçin. polleninformation.at için bir API anahtarına ihtiyacınız var. Şuradan talep edin: {api_key_url}" } }, "error": { diff --git a/custom_components/polleninformation/translations/uk.json b/custom_components/polleninformation/translations/uk.json index 8ae2685..40bda3d 100644 --- a/custom_components/polleninformation/translations/uk.json +++ b/custom_components/polleninformation/translations/uk.json @@ -12,7 +12,7 @@ "location_name": "Назва місця (необов’язково)", "apikey": "API-ключ" }, - "description": "Виберіть країну та місце, для яких ви хочете відстежувати прогноз пилку, а також мову для налаштування датчиків. Вам потрібен API-ключ для polleninformation.at. Запросіть його тут: https://www.polleninformation.at/en/data-interface/request-an-api-key" + "description": "Виберіть країну та місце, для яких ви хочете відстежувати прогноз пилку, а також мову для налаштування датчиків. Вам потрібен API-ключ для polleninformation.at. Запросіть його тут: {api_key_url}" } }, "error": {