forked from openfoodfacts/openfoodfacts-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pull] main from openfoodfacts:main (#1169)
* More packaging shapes (openfoodfacts#5608) * packaging-fix-for-pains-de-mie packaging-fix-for-pains-de-mie * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * Update packaging_shapes.txt * fix conflicting entries, add tests * fix conflicting entries, add tests Co-authored-by: Stéphane Gigandet <[email protected]> * fix: Differentiate between rtl and ltr for the image position * i18n: Make 'X g / 100 g' translatable (openfoodfacts#5655) * i18n: Make 'X g / 100 g' translatable, especially for RTL languages * fix: Use the old '%.2e' hack to format the decimals * fix: Move selected packaging photos to new main language Co-authored-by: Pierre Slamich <[email protected]> Co-authored-by: Stéphane Gigandet <[email protected]> Co-authored-by: hangy <[email protected]>
- Loading branch information
1 parent
f2aac38
commit 314f112
Showing
9 changed files
with
250 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// This file is part of Product Opener. | ||
// | ||
// Product Opener | ||
// Copyright (C) 2011-2020 Association Open Food Facts | ||
// Copyright (C) 2011-2021 Association Open Food Facts | ||
// Contact: [email protected] | ||
// Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France | ||
// | ||
|
@@ -400,17 +400,16 @@ $.fn.isVisible = function() { | |
return $.expr.filters.visible(this[0]); | ||
}; | ||
function update_nutrition_image_copy() { | ||
|
||
// width big enough to display a copy next to nutrition table? | ||
if ($("#nutrition_data_table").isVisible() && $('#nutrition').width() - $('#nutrition_data_table').width() > 405) { | ||
$('#nutrition_image_copy').css("left", $('#nutrition_data_table').width() + 10).show(); | ||
if ($("#nutrition_data_table").isVisible() && $('#nutrition').width() - $('#nutrition_data_table').width() > 405) { | ||
var position = $('html[dir=rtl]').length ? 'right' : 'left'; | ||
$('#nutrition_image_copy').css(position, $('#nutrition_data_table').width() + 10).show(); | ||
} | ||
else { | ||
$('#nutrition_image_copy').hide(); | ||
} | ||
} | ||
|
||
|
||
function update_display(imagefield, first_display) { | ||
|
||
var display_url = imagefield_url[imagefield]; | ||
|
@@ -1230,4 +1229,4 @@ $("#move_images").click({},function(event) { | |
|
||
} | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# This file is part of Product Opener. | ||
# | ||
# Product Opener | ||
# Copyright (C) 2011-2020 Association Open Food Facts | ||
# Copyright (C) 2011-2021 Association Open Food Facts | ||
# Contact: [email protected] | ||
# Address: 21 rue des Iles, 94100 Saint-Maur des Fossés, France | ||
# | ||
|
@@ -1122,7 +1122,10 @@ sub compute_attribute_nutrient_level($$$$) { | |
if ($target_lc ne "data") { | ||
$attribute_ref->{title} = sprintf(lang_in_other_lc($target_lc, "nutrient_in_quantity"), $Nutriments{$nid}{$target_lc} , | ||
lang_in_other_lc($target_lc, $product_ref->{nutrient_levels}{$nid} . "_quantity")); | ||
$attribute_ref->{description_short} = (sprintf("%.2e", $product_ref->{nutriments}{$nid . $prepared . "_100g"}) + 0.0) . " g / 100 g"; | ||
$attribute_ref->{description_short} = sprintf( | ||
lang_in_other_lc($target_lc, 'g_per_100g'), | ||
(sprintf('%.2e', $product_ref->{nutriments}{$nid . $prepared . '_100g'}) + 0.0) | ||
); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
t/expected_test_results/packaging/packaging_en_citeo_shapes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"lc" : "en", | ||
"packaging" : "Plastic tumbler, Wooden crate, Cardboard case, Strings, Plastic ties, Plastic blister wrap, paper basket, individual capsules", | ||
"packagings" : [ | ||
{ | ||
"material" : "en:plastic", | ||
"shape" : "en:blister" | ||
}, | ||
{ | ||
"shape" : "en:individual-dose" | ||
}, | ||
{ | ||
"material" : "en:plastic", | ||
"shape" : "en:tumbler" | ||
}, | ||
{ | ||
"material" : "en:cardboard", | ||
"shape" : "en:case" | ||
}, | ||
{ | ||
"shape" : "en:crate" | ||
}, | ||
{ | ||
"material" : "en:paper", | ||
"shape" : "en:basket" | ||
}, | ||
{ | ||
"shape" : "en:string" | ||
} | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
t/expected_test_results/packaging/packaging_fr_citeo_shapes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"lc" : "fr", | ||
"packaging" : "Gobelet en plastique, cageots en bois, caisse en carton, ficelle, liens plastiques, blister en plastique, panier en papier, capsules individuelles", | ||
"packagings" : [ | ||
{ | ||
"shape" : "en:capsule" | ||
}, | ||
{ | ||
"material" : "en:plastic", | ||
"shape" : "en:blister" | ||
}, | ||
{ | ||
"material" : "en:plastic", | ||
"shape" : "en:tumbler" | ||
}, | ||
{ | ||
"material" : "en:cardboard", | ||
"shape" : "en:case" | ||
}, | ||
{ | ||
"material" : "en:paper", | ||
"shape" : "en:basket" | ||
}, | ||
{ | ||
"material" : "en:wood", | ||
"shape" : "en:crate" | ||
}, | ||
{ | ||
"shape" : "en:string" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.