Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n - Add a way to localize teams' names. #568

Closed
borisschapira opened this issue Nov 28, 2019 · 7 comments · Fixed by #569
Closed

i18n - Add a way to localize teams' names. #568

borisschapira opened this issue Nov 28, 2019 · 7 comments · Fixed by #569
Labels
development Building the Almanac tech stack translation world wide web
Milestone

Comments

@borisschapira
Copy link
Contributor

Current team names (Analysts, Authors, Brainstormers, Designers…) are use on the Contributors page to filter people. We should think about a way to localize theses teams' names.

@tunetheweb
Copy link
Member

Related: #398 and #561

@borisschapira short term, can’t we just have buttons with local wording on the buttons but using the English categories to filter? Though I’m guessing that currently the buttons are dynamically generated so this would mean hard coding the team names? Not ideal but also I wouldn’t expect to add new teams that often so maybe acceptable...

@borisschapira
Copy link
Contributor Author

Short term, I've added "(noms anglais)", aka "(English names)" to the "Filter by teams:" translation, because the buttons are generated from config.teams.items() and I don't know the app well enough to know where I could put a key-value mapping dictionary with the translations.

@tunetheweb
Copy link
Member

Yes but could just replace this:

    {% for id, team in config.teams.items() %}
      <button class="{{ id }}" type="button">{{ team.name }}</button>
    {% endfor %}

with this:

      <button class="analysts" type="button">Analystes</button>
      <button class="authors" type="button">Auteurs</button>
      <button class="brainstormers" type="button">Brainstormers</button>
      ....etc.

Hardcoding as a say, but maybe sufficient - at least in short term

@borisschapira
Copy link
Contributor Author

This presents a risk if a new team is added but if it's okay with everyone, I can do it that way.

borisschapira added a commit to borisschapira/almanac.httparchive.org that referenced this issue Nov 28, 2019
@tunetheweb
Copy link
Member

tunetheweb commented Nov 28, 2019

Agreed but think that's relatively unlikely and think it's far friendlier to French visitors so I say go for it for now. Leave this issue open for longer term options.

Also doing this for now will also give us the translations to use for when (if?) we do implement a better option. Which might be a lookup table in the Contributors chapter with fallback to English. @mikegeyser any thoughts on this?

@tunetheweb tunetheweb added development Building the Almanac tech stack translation world wide web labels Nov 28, 2019
@tunetheweb tunetheweb added this to the Après Ski milestone Nov 28, 2019
@mikegeyser
Copy link
Contributor

mikegeyser commented Nov 29, 2019

I think it would make sense for the base template to read the team names from a variable, and then each specific translation can override the variables in the contributors page. Something similar to how we set metadata in the chapter.html? We could just use a dictionary keyed off of config.teams[id], that gets set up in the template. (I think it's probably close to what you mean by a lookup table @bazzadp)

Edit:

Something like this:

<div class="contributor-teams">
    {% set teams = OrderedDict([
        ('analysts', 'Analystes'),
        ('authors', 'Auteurs'),
        ('brainstormers', 'Brainstormers')
    ]) %}

    {% for id in contributor.teams | sort() %}
    <span class="contributor-team team-{{ id }}">{{ teams[id] or config.teams[id].name }}</span>
    {% endfor %}
</div>

(The above is just pseudocode, I haven't run it.)

@tunetheweb
Copy link
Member

Yes that’s what I was thinking.

borisschapira added a commit to borisschapira/almanac.httparchive.org that referenced this issue Nov 29, 2019
With fallback to English team names if the dictionary is not populated.

Fixes HTTPArchive#568
tunetheweb pushed a commit that referenced this issue Nov 29, 2019
* Localized Team Names

With fallback to English team names if the dictionary is not populated.

Fixes #568

* Using a null coalescing operator
instead of duplicating HTML markup.
Thanks @mikegeyser
tunetheweb added a commit that referenced this issue Nov 29, 2019
* FR - Language-specific templates part I

* Adding pluralization of the word "comment" to the EN version

* Adding French to supported languages

* Adding myself to contributors
(assuming I join the translators team)

* Removing inline style

- Does not conform with the CSP
- Is useless with the CSS styling

* Change logic for comment pluralization

Show the right word according to the number of comment.

* Translating a string

* Update src/config/2019.json

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/config/2019.json

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/templates/fr/2019/base_chapter.html

Co-Authored-By: Barry Pollard <[email protected]>

* Adding some missing translation on alternatives

* Add FR translation for Contributors template

* Add FR translation for Index template

* Hardcode Contributors's team names in FR

According to #568 (comment)

* Update src/templates/fr/2019/contributors.html

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/templates/fr/2019/contributors.html

Co-Authored-By: Barry Pollard <[email protected]>

* Localize Breadcrumb's name

* Fixing a missed "on" => "sur"

* Update src/templates/fr/2019/base_chapter.html

Co-Authored-By: Barry Pollard <[email protected]>

* Improving alternatives on avatars

* Update src/templates/fr/2019/contributors.html

Co-Authored-By: Barry Pollard <[email protected]>

* Improving wording on "one's website" to "site web de…"

* Typofix Web Almanac

* FR - Localized Team Names

With fallback to English team names if the dictionary is not populated.
related to #569

* Using a null coalescing operator
instead of duplicating HTML markup.
Thanks @mikegeyser

* Update src/templates/fr/2019/base_chapter.html

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/templates/fr/2019/chapter.html

Co-Authored-By: Barry Pollard <[email protected]>
goalcc added a commit to goalcc/almanac.httparchive.org that referenced this issue Aug 4, 2024
* FR - Language-specific templates part I

* Adding pluralization of the word "comment" to the EN version

* Adding French to supported languages

* Adding myself to contributors
(assuming I join the translators team)

* Removing inline style

- Does not conform with the CSP
- Is useless with the CSS styling

* Change logic for comment pluralization

Show the right word according to the number of comment.

* Translating a string

* Update src/config/2019.json

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/config/2019.json

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/templates/fr/2019/base_chapter.html

Co-Authored-By: Barry Pollard <[email protected]>

* Adding some missing translation on alternatives

* Add FR translation for Contributors template

* Add FR translation for Index template

* Hardcode Contributors's team names in FR

According to HTTPArchive/almanac.httparchive.org#568 (comment)

* Update src/templates/fr/2019/contributors.html

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/templates/fr/2019/contributors.html

Co-Authored-By: Barry Pollard <[email protected]>

* Localize Breadcrumb's name

* Fixing a missed "on" => "sur"

* Update src/templates/fr/2019/base_chapter.html

Co-Authored-By: Barry Pollard <[email protected]>

* Improving alternatives on avatars

* Update src/templates/fr/2019/contributors.html

Co-Authored-By: Barry Pollard <[email protected]>

* Improving wording on "one's website" to "site web de…"

* Typofix Web Almanac

* FR - Localized Team Names

With fallback to English team names if the dictionary is not populated.
related to #569

* Using a null coalescing operator
instead of duplicating HTML markup.
Thanks @mikegeyser

* Update src/templates/fr/2019/base_chapter.html

Co-Authored-By: Barry Pollard <[email protected]>

* Update src/templates/fr/2019/chapter.html

Co-Authored-By: Barry Pollard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Building the Almanac tech stack translation world wide web
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants