From 9edf6d1044c7cb2f1246f778da2fd7cc5fc58bf8 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 25 Apr 2018 14:17:12 -0700 Subject: [PATCH] Better translation icon tooltips resolves #2808 --- CHANGELOG-v3.md | 1 + src/templates/_includes/field.html | 12 ++++++++++++ src/templates/_includes/forms/field.html | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index a036b4cd82d..000862d4e30 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -3,6 +3,7 @@ ## Unreleased ### Changed +- Fields’ translation icons now reveal the chosen Translation Method in their tooltip. ([#2808](https://github.com/craftcms/cms/issues/2808)) - Improved the error messages displayed when an Assets field has an invalid Upload Location setting. ([#2803](https://github.com/craftcms/cms/issues/2803)) ### Fixed diff --git a/src/templates/_includes/field.html b/src/templates/_includes/field.html index 381e357bc01..a6b7bc420c3 100644 --- a/src/templates/_includes/field.html +++ b/src/templates/_includes/field.html @@ -7,6 +7,17 @@ {% set translatable = field.getIsTranslatable(element) %} {% set siteId = (translatable and (element.isLocalized() ?? true)) ? (siteId ?? element.siteId ?? craft.app.sites.currentSite.id) %} +{% if translatable %} + {% switch field.translationMethod %} + {% case 'site' %} + {% set translationDescription = 'This field is translated for each site.'|t('app') %} + {% case 'siteGroup' %} + {% set translationDescription = 'This field is translated for each site group.'|t('app') %} + {% case 'language' %} + {% set translationDescription = 'This field is translated for each language.'|t('app') %} + {% endswitch %} +{% endif %} + {% if not static %} {% set input = field.getInputHtml(value, element) %} {% else %} @@ -17,6 +28,7 @@ {% embed "_includes/forms/field" with { label: field.name|t('site')|e, translatable: translatable, + translationDescription: translationDescription ?? null, siteId: siteId, required: (not static ? required : false), instructions: instructions|e, diff --git a/src/templates/_includes/forms/field.html b/src/templates/_includes/forms/field.html index b8b4b6ae012..94164cd8034 100644 --- a/src/templates/_includes/forms/field.html +++ b/src/templates/_includes/forms/field.html @@ -23,7 +23,7 @@ {% if label %} {% endif %} {% if instructions %}