adobe-photoshop / spaces-design

Adobe Photoshop Design Space
http://adobe-photoshop.github.io/
Other
853 stars 74 forks source link

Bug fix: search bar localization error #3612

Closed shaoshing closed 8 years ago

shaoshing commented 8 years ago

Fix for issue #3467

baaygun commented 8 years ago

This looks like it's curing the symptom rather than the cause. We have safeFilterNameMap to figure out what we can remove from the id. Can you explain why this change had to be done in the function, essentially quieting down the error, instead of fixing it in search/libraries.js where we're supplying the non-localizable strings?

shaoshing commented 8 years ago

Hi @volfied, that's a great question. The essential cause is that the ID is a mix of localizable/non-localizable strings. For example, here are some possible values of the id param:

[""] // not localizable
["RECENT_DOC"]
["ALL_LAYER", "ARTBOARD"]
["LIBRARY", "123456.ABCD.ABCD.ABCD.123456"] // ID is not localizable

The original way was to translate the text, then look for the name from safeFilterNameMap. If neither of them works, do nothing. This used to be working until we changed the behavior of nls.localize to raise an error if translation not found. So the easiest fix for me is to catch the translation error.

baaygun commented 8 years ago

Thanks for the explanation.