Skip to content

Locale and i18n #232

@mathewjordan

Description

@mathewjordan

Considerations

  • Ability to define locales from canopy.yml
  • Ability to state a default locale/lang
  • Ability to easily write content/ directory pages to for multiple language versions
  • Ability to toggle languages from defined locales in UI
  • Ability to distill internationalized manifest/collection label/value properties to screen
  • Ability to define aria and UI strings per language
  • Ability to define navigation per language

Fixtures

  • Collection
    • Manifests w/ multiple internationalized label/value
      • label, metadata, etc..
    • Textual annotations (commenting/tagging) multiple lang?
    • Supplementing annotations (VTTs) multiple lang?

A default locale/lang

Should there be any assumed default? Currently our <html> element has a lang="en" attribute.

  • Con: assumptive and potentially exclusive
  • Pro: en is the default template -- unless we can figure out how to not make it so

Would it be better to not state lang at all unless we it is stated?

Customizing Content

/content/** → Default lang
/content/en/** → Alternate lang(s)

And then in config canopy.yml

locales:
  - lang: pt
    label: Português
    default: true
  - lang: en
    label: English

Customizing UI language strings

Certain UI elements may need to be updated for defined languages

A locale config:

content/locale.yml

search: Pesquisar
filter: Filtrar
# more...

content/en/locale.yml

search: Search
filter: Filter
# more...

Customizing navigation per language code

This may be difficult as we need to consider how language relative routes can be defined for /search results page. and /works.

A locale config:

content/navigation.yml

navigation:
  - href: /obras
    label: Obras
  - href: /sobre
    label: Sobre
# more...

content/en/navigation.yml

navigation:
  - href: /en/search
    label: Works
  - href: /en/about
    label: About
# more...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions