question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support localized fields in API responses

See original GitHub issue

In order to fully switch to API v5, we need to support the new localized fields. Instead of directly getting a value for any localized field, we will always receive an object with at least one key/value (the key is the locale, the value is the localized content).

The API v5 should be used to see those localized fields.

See also: https://github.com/mozilla/addons-server/issues/8794

For QA:

This touches pretty much every part of the site. There should be no observable changes, but we should do a fairly comprehensive regression check.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:27 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
bobsilverbergcommented, Nov 26, 2020

@willdurand I’m going to work on this as a code quality issue. Do you think we should assume that we’re only getting one locale back from an API request (as we always pass a lang as a query parameter), or is the idea here that we should assume we could be getting multiple locales returned, and we should use the current lang to look up the value in the returned object? If the latter, what would we do if we don’t find a match for the current lang? I know that should never happen, but if we’re coding to deal with multiple returned langs, we should also code to deal with that scenario.

0reactions
AlexandraMogacommented, Jan 7, 2021

After testing the frontend functionality as a whole, with more focus on localizations, there were no regressions found.

I’m marking this issue as verified fixed on stage.

Read more comments on GitHub >

github_iconTop Results From Across the Web

REST API localization best practice - Google Groups
I am trying to understand best practices for API localization (support multiple ... Our response contains uniqueId for a field and its value...
Read more >
Localization for REST APIs - Stack Overflow
The basic problem is that APIs may need to provide content that is dependent on the user culture, country, language and timezone. For...
Read more >
How to localize your API - API UX
Localization (L10n) means making an application work for a particular market, such as French-speaking Canadians. Native Language Support (NLS) ...
Read more >
Are API responses localized? - Okta Support
I am wondering if the ErrorSummary and ErrorCauses fields in the OktaException class are localized, or if they are only ever returned in...
Read more >
Modifying REST API responses | Contentful
Modifying REST API responses · Choosing fields · Including and excluding objects · Assets · All REST APIs supported · Client library implementation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found