Can we generate list of detection methods automatically in help topic?

Created on 8 March 2021, over 3 years ago
Updated 19 October 2023, about 1 year ago

Problem/Motivation

On #3095737: Convert internationalization modules: config_translation, content_translation, locale, language module hook_help() to topic(s) we created a help topic, core/modules/help_topics/help/language.detect.html.twig, which includes a list of the commonly-used language detection methods.

It would be good if that list could be generated from the code instead of being hard-wired in the template.

This issue is about seeing whether this is possible. Some questions to explore:

a) The list in the current help topic was curated and ordered. It doesn't include all detection methods. Is it OK to include all or just confusing? And does the order matter?

b) The descriptions in the help topic -- is there some place we can take them from in the code?

Steps to reproduce

The topic has this in it (in patch format):

+<h2>{% trans %}What language detection methods are available?{% endtrans %}</h2>
+<p>{% trans %}The available detection methods depend on what modules you have installed. Some of the most commonly-used language detection methods are:{% endtrans %}</p>
+<dl>
+  <dt>{% trans %}URL{% endtrans %}</dt>
+  <dd>{% trans %}Use the language from the URL, which can either be in a path prefix like <em>example.com/fr/page_path</em> for French (fr) language, or in a domain like <em>fr.example.com/page_path</em>.{% endtrans %}</dd>
+  <dt>{% trans %}User{% endtrans %}</dt>
+  <dd>{% trans %}For logged in users, use the language they have set in their profiles.{% endtrans %}</dd>
+  <dt>{% trans %}Browser{% endtrans %}</dt>
+  <dd>{% trans %}Use the language preferences from the user's browser.{% endtrans %}</dd>
+  <dt>{% trans %}Selected language{% endtrans %}</dt>
+  <dd>{% trans %}Use the language most recently selected from a <em>Language switcher</em> block.{% endtrans %}</dd>
+  <dt>{% trans %}Session{% endtrans %}</dt>
+  <dd>{% trans %}Use the language from a session parameter or a request parameter; for example, adding <em>?language=fr</em> to the end of the URL.{% endtrans %}</dd>
+</dl>

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
Help 

Last updated 22 days ago

No maintainer
Created by

🇺🇸United States jhodgdon Spokane, WA, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024