[PP-1] Indicate translation availability per language in the Canvas language switcher dropdown
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3590572. -->
Reported by: [kunal.sachdev](https://www.drupal.org/user/3685163)
Related to !1122
>>>
<h3 id="overview">Overview</h3>
<p> A language switcher dropdown is currently being implemented in <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3585452" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3585452</a></span> that allows users to preview content in different configurable site languages. The dropdown is powered by <code>ApiLanguageController</code>, which returns the list of all configurable site languages.<br>
However, the current API response does not indicate whether the current entity has a translation in each listed language. When a user selects a language for which the entity has no translation, the canvas preview falls back to the default language content. This can be confusing; users may think something is broken rather than understanding they are seeing a default-language fallback.<br>
Note: Showing a language with no translation is still a valid and useful use case, because other referenced entities may themselves be translated and would render differently even when the main entity falls back to the default language. The goal is therefore not to hide untranslated languages, but to communicate the state clearly to the user.</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p>Extend the language list endpoint (ApiLanguageController::list()) to accept the current entity context (entity type + entity ID, or similar) and include a hasTranslation boolean flag in each language entry in the JSON response. The frontend Canvas language-switcher dropdown (currently in progress) would then visually indicate — e.g. via a label suffix, icon, or tooltip — whether the selected language has a dedicated translation or will fall back to the default.</p>
> Related issue: [Issue #3585452](https://www.drupal.org/node/3585452)
issue