Skip to content

Resolve "add spanish mode" (#75)

aguestuser requested to merge 75-add-spanish-mode into master

Closes #75 (closed)

Behavior

GIVEN a working signalboost number

  • WHEN a new receiver joins with the message "HOLA"
  • THEN the receiver will receive a welcome message in spanish
  • AND THEN all subsequent messages will be sent to them in spanish

GIVEN an existing member alice on 'foo' whose language is set to "EN" (english)

  • WHEN alice sends a message that says "ESPANOL", "ESPAÑOL", or "SPANISH"
  • THEN alice will receive a confirmation response in spanish
  • AND THEN all further command responses to alice will be in spanish

Implementation

parse commands from incoming messages in both EN & ES:

  • modify parseCommand to look for matches of all command variants in all languages, then pick the one that matched
    • NOTE: this requires no regex collisions between commands in different languages (currently there is a non-problematic collision on the cognate INFO)
  • return language along with executable (for now) to aid in detecting language preference from command (if so desired in future)
  • side-effect: modify responses command logic:
    • use RESPONSES_ON/RESPONSES_OFF not TOGGLE_RESPONSES {payload}
    • eliminates need for redundant parse step for assess whether payload is valid or not
    • also makes translation strings map structure simpler

detect language preferences from a JOIN and pass as arg to addSubscriber repo method:

  • if HOLA, detect spanish, if HELLO detect Englis
  • include language as arg to addSubscriber, which sets language field when creating subscription resource

add SET_LANGUAGE command:

  • matches on the name of a language (no matter what language it is given in)
  • modifies the the language of a given member's subscription or administration record (depending on their role)

update EN -> ES translations:

  • reflect revisions accumulated in recent MRs
  • flatten strings/messages JSON structure so that all top-level keys in commandResponses match command names
  • add regression test to make sure translations are provided in ES for all EN strings

Side-effect: relax regexes in cli/boost-commands/create-channel to support non-north-american country codes!

Merge request reports

Loading