New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: locales service returns different structure per repo #472

Closed
pascalchevrel opened this Issue Jun 10, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@pascalchevrel
Member

pascalchevrel commented Jun 10, 2015

https://transvision-beta.mozfr.org/api/v1/locales/central/
returns a list with indexed values such as:

{
    "0": "ar",
    "1": "ast",
    "2": "cs"
}

While gaia returns a list without indices:
https://transvision-beta.mozfr.org/api/v1/locales/gaia/

[
    "af",
    "ar",
    "as",
    "ast"
]

This is a bug, we should return the same data structure, the simple one without indices seems more logical to me.

@pascalchevrel pascalchevrel added the bug label Jun 10, 2015

@pascalchevrel pascalchevrel self-assigned this Jun 10, 2015

pascalchevrel added a commit to pascalchevrel/transvision that referenced this issue Jun 10, 2015

Issue #472: API: locales service returns different structure per repo
The reason is that we sure asort() which sorts arrays taking keys into account, if the source file is already sorted correctly, asort has no effect and the data returned is a simple array. If asort() changed the order of the locales, the returned array now has numeric keys. We need to use sort().

pascalchevrel added a commit to pascalchevrel/transvision that referenced this issue Jun 10, 2015

Issue #472: API: locales service returns different structure per repo
The reason is that we sure asort() which sorts arrays taking keys into account, if the source file is already sorted correctly, asort has no effect and the data returned is a simple array. If asort() changed the order of the locales, the returned array now has numeric keys. We need to use sort().

pascalchevrel added a commit that referenced this issue Jun 10, 2015

Merge pull request #473 from pascalchevrel/issue472_api_locales_sorting
Issue #472: API: locales service returns different structure per repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment