tinalabs/react-tinacms-i18n

Allow the sorting of the toolbar widget to be configured by region first, or language first

Opened this issue · 2 comments

Right now we default to:

  • Showing a list of regions (if present) + a list of languages w/o region
  • Selecting a region results in a push to a sub-menu to select the language for that region
  • Selecting a language w/o region selects that locale

We want:

  • Context to take an "sortBy" prop, which can be language, region
  • If sortBy is language, then the initial list is all languages, and:
    • If that language has regions, we push to a menu that lets you select the raw language (if it is a locale on its own) or the regionalized language
  • If sortBy is region, we keep the current behaviour, but move languages w/o regions to the top of the list instead of the bottom.

Would the sortBy prop be passed here

or here

Gut was saying in the ToolbarPlugin component, but wasn't sure if Context was a direct reference to the Provider Context of the plugin

@jbevis the latter! All toolbar plugins are registered and rendered via inversion of control, so you don’t have direct control over their props, generally.

Context is the keeper of the keys for any of our react-specific logic, and the API class is where the fundamental business logic should live.