You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getBestMatchingLanguage() currently returns en for English if all the other fallbacks have been exhausted. Instead, it should return null as a last resort.
The current behavior is problematic, because the caller may not know whether this method returned en because it’s the best match or because there’s no other option. A client may want to use this method with a list of acceptable languages, such as navigator.languages, stopping only when a match is found. With the current behavior, the client would have to either ignore every language after the first one (because this method always returns a value) or ignore every language other than English (because this method uses English as a last resort).
getBestMatchingLanguage()
currently returnsen
for English if all the other fallbacks have been exhausted. Instead, it should returnnull
as a last resort.osrm-text-instructions/index.js
Line 295 in ed70d2a
The current behavior is problematic, because the caller may not know whether this method returned
en
because it’s the best match or because there’s no other option. A client may want to use this method with a list of acceptable languages, such asnavigator.languages
, stopping only when a match is found. With the current behavior, the client would have to either ignore every language after the first one (because this method always returns a value) or ignore every language other than English (because this method uses English as a last resort)./cc @mcwhittemore @lyzidiamond @allierowan @bsudekum
The text was updated successfully, but these errors were encountered: