Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Document the API to retrieve all existing values of language specific fields for multilingual products #10

Open
Tracked by #23 ...
stephanegigandet opened this issue May 5, 2019 · 4 comments

Comments

@stephanegigandet
Copy link
Contributor

For language specific fields such as product_name or generic_name, the fields parameter of the read API enables to request a specific language (e.g. product_name_fr), or to set a preferred list of languages.

This feature allows to request a new field [field name]_languages with a hash with all existing values:

&fields=generic_name_languages:

product: {
generic_name_languages: {
en: "Chocolate cookies",
fr: "Biscuits au chocolat"
},

stephanegigandet referenced this issue in openfoodfacts/openfoodfacts-server May 5, 2019
@stephanegigandet
Copy link
Contributor Author

Pushed in production.

@CharlesNepote
Copy link
Member

Sorry @stephanegigandet I don't see any documentation about it. I can write it if you don't have time but it has to be documented before closing.

To be sure I understand well, could you give a real URL example?

@CharlesNepote
Copy link
Member

I found an example: https://world.openfoodfacts.org/api/v0/product/5425600101745.json&fields=product_name_languages (name in french and in german)

@stephanegigandet can you confirm the parameter only applies to products? So documentation should go in https://en.wiki.openfoodfacts.org/API/Read/Product, right?

So the documentation could be (between "Name" and "Barcode" sections):

===== List languages for product_name and generic_name fields =====

* https://world.openfoodfacts.org/api/v0/product/5425600101745.json&fields=product_name_languages

Returns all the languages and the corresponding values a field can have. Example:
<pre>
    "product_name_languages": {
        "fr": "Belgian mayonnaise",
        "de": "Mayonnaise mit Ei"
    }
</pre>

@stephanegigandet
Copy link
Contributor Author

@CharlesNepote : yes, that's only for products.

@teolemon teolemon transferred this issue from openfoodfacts/openfoodfacts-server Jan 3, 2021
@teolemon teolemon changed the title New API feature to retrieve all existing values of language specific fields for multilingual products Document the API to retrieve all existing values of language specific fields for multilingual products Aug 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: No status
Development

No branches or pull requests

3 participants