bookwyrm-social/bookwyrm

Allow the language of user content to be specified

Ouverte

#1 035 ouverte le 1 mai 2021

 (3 commentaires) (10 réactions) (0 personne assignée)Python (326 forks)auto 404
UIaccessibilityenhancementgood first issue

Métriques du dépôt

Stars
 (2 754 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

Writing a status (comment, quote, direct message…) can be done in all sort of language.

Content is currently always defined as being written in the browser’s defined language (5 available as of today):

<html lang="…">

This of course poses issues to screen readers which will try to render text in the wrong language, and maybe to bots.

UI Proposal

For any text content:

  • a select allows to select the language being used, but not necessarily only one in which BookWyrm has been translated into; a Thai user using English might be willing to write in their own language.
  • a link allows to easily create a new Issue to add specific languages if one is missing from the options.

On the DB side, I am imagining a cross-reference table that would collect the objects ID with its language tag.

<label for="language">Language:</label>

<select id="language" name="language">
    <optgroup label="Americas">
        […]
        <option value="en-US" selected>English (US)</option>
        <option value="es-CO">Español (Colombia)</option>
        <option value="fr-CA">français (Canada)</option>
    </optgroup>
    <optgroup label="Asia">
        […]
        <option value="zh-Hans">简化字</option>
        <option value="zh-Hant">正體字</option>
        […]
    </optgroup>
    <optgroup label="Europe">
        […]
        <option value="de-DE">Deutsch (Deutshland)</option>
        <option value="en-GB">English (GB)</option>
        <option value="es">Español</option>
        <option value="fr-FR">français (France)</option>
        […]
    </optgroup>
</select>

<a href="https://github.com/bookwyrm-social/bookwyrm/issues/new?template=feature_request.md&title=Add+language: ">Add you language</a>

Other option considered

I initially thought a datalist could be used but that implies that the user actually knows the language tag to be used if it is not in the list, so better propose a selected list and add more as we go?

<label for="language">Language:</label>
<input list="languages" id="language" name="language" value="US English">

<datalist id="languages">
    <option value="de_DE">Deutsch (Deutshland)</option>
    <option value="en_US" selected="">US English</option>
    <option value="es">Español</option>
    <option value="fr_FR">français (France)</option>
    <option value="zh-Hans">简化字</option>
</datalist>

Screenshots

The proposal would lead to a select box with groups of local languages:

image

Guide contributeur