Skip to content
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

Get localized Open Food Facts product URI #301

Closed
monsieurtanuki opened this issue Nov 20, 2021 · 3 comments · Fixed by #302
Closed

Get localized Open Food Facts product URI #301

monsieurtanuki opened this issue Nov 20, 2021 · 3 comments · Fixed by #302
Assignees

Comments

@monsieurtanuki
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Typical use case: in smoothie we want to open the OFF website on the given barcode page.

Describe the solution you'd like
Something like

static Uri getProductUri(
    final String barcode, {
    OpenFoodFactsLanguage? language,
    OpenFoodFactsCountry? country,
    });

Describe alternatives you've considered
Currently in smoothie we use https://openfoodfacts.org/product/7300400481588/
But here we don't specify the language or the country.
And if we do (https://openfoodfacts.org/product/7300400481588/?lc=fr&cc=de) that is not taken into account.

Is there an URI for a product, a language and a country, and if there is one, what is it?

@monsieurtanuki monsieurtanuki self-assigned this Nov 27, 2021
@monsieurtanuki
Copy link
Contributor Author

That's perfect @teolemon, I'm working on it!

monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue Nov 27, 2021
Impacted files:
* `api_getProduct_test.dart`: new test "get product uri"
* `CountryHelper.dart`: replaced 'gb' with the OFF standard 'uk'
* `openfoodfacts.dart`: new method `getProductUri`
* `UriHelper.dart`: new method `replaceSubdomain`
@teolemon teolemon changed the title get OFF product URI Get localized Open Food Facts product URI Dec 3, 2021
monsieurtanuki added a commit to monsieurtanuki/openfoodfacts-dart that referenced this issue Dec 4, 2021
Impacted file:
* `api_saveProduct_test.dart`: clearer test
monsieurtanuki added a commit that referenced this issue Dec 4, 2021
Impacted files:
* `api_getProduct_test.dart`: new test "get product uri"
* `api_saveProduct_test.dart`: clearer test
* `CountryHelper.dart`: replaced 'gb' with the OFF standard 'uk'
* `openfoodfacts.dart`: new method `getProductUri`
* `UriHelper.dart`: new method `replaceSubdomain`
@monsieurtanuki monsieurtanuki linked a pull request Dec 4, 2021 that will close this issue
@monsieurtanuki
Copy link
Contributor Author

Done in #302.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants