Problem/Motivation

In some cases we can try to submit node or get status for drupal locale that doesn't have language mapping in smartling settings. In other words, the function convertLocaleDrupalToSmartling returns NULL. If you don't have a valid smartling locale then all operations with File API will fail.

I reviewed code and can say that each piece of code that uses convertLocaleDrupalToSmartling is not ready for NULL value. I don't see any sense to return it

Proposed resolution

Code must fail as soon as cannot convert locale from smartling to drupal and vice versa

Remaining tasks

  1. Remove statements like return NULL; from convertLocaleDrupalToSmartling
  2. Function must return locale or fail
  3. User must be notified about error. Important: SmartlingApiWrapper is low level class and we use it in tests. It must not have interaction with user
  4. Unittest that verifies only convertLocaleDrupalToSmartling (return locale or fail)
  5. Tests that verify behavior of upload\download\status operations when drupal locale cannot be converted to smartling

Comments

  • dimitrystd committed 66362d2 on 7.x-2.x
    #2363281 Extended logging ApiWrapper and how it converts drupal locale...
dimitrystd’s picture

Improved code but didn't fix a bug

  • dimitrystd committed 66362d2 on oop2-xml-creation
    #2363281 Extended logging ApiWrapper and how it converts drupal locale...

  • dimitrystd committed 66362d2 on 8.x-1.x
    #2363281 Extended logging ApiWrapper and how it converts drupal locale...

  • dimitrystd committed 66362d2 on 7.x-3.x
    #2363281 Extended logging ApiWrapper and how it converts drupal locale...