Changes

Jump to navigation Jump to search
Line 36: Line 36:  
* The main product language;
 
* The main product language;
 
* Other languages mentioned on the product;
 
* Other languages mentioned on the product;
 +
 +
=== Read parameters ===
 
As it is undesirable (to large) to present all possible languages, there must be a way to filter the output, by setting parameters:
 
As it is undesirable (to large) to present all possible languages, there must be a way to filter the output, by setting parameters:
 
* '''lc=''' could specify the language desired by the user. This could match his interface, the language he speaks, the language he wants to show to friends, etc. This should be independent of the actual product. The default is english. Any field that is translatable by OFF, will be translated. Otherwise the main language of the product is used. The output provided by OFF should make clear what language is provided.
 
* '''lc=''' could specify the language desired by the user. This could match his interface, the language he speaks, the language he wants to show to friends, etc. This should be independent of the actual product. The default is english. Any field that is translatable by OFF, will be translated. Otherwise the main language of the product is used. The output provided by OFF should make clear what language is provided.
 
It is also possible to limit the product languages provided. eg. only products with main language dutch, or products that have dutch. This falls either under the category search or filtering.
 
It is also possible to limit the product languages provided. eg. only products with main language dutch, or products that have dutch. This falls either under the category search or filtering.
    +
=== Json field names ===
 
A related question is how languages should be encoded in a resulting json. For each language dependent field the corresponding language must be known. There are three options:
 
A related question is how languages should be encoded in a resulting json. For each language dependent field the corresponding language must be known. There are three options:
 
# Adapt field names - add a postfix to a field name to indicate the language, i.e. name_fr. Draw back of this approach is that the relevant postfixes are not known before hand. A list of possible languages in the json circumvents this. However this requires more extensive programming for the api user. (This approach is currently used).
 
# Adapt field names - add a postfix to a field name to indicate the language, i.e. name_fr. Draw back of this approach is that the relevant postfixes are not known before hand. A list of possible languages in the json circumvents this. However this requires more extensive programming for the api user. (This approach is currently used).
Line 45: Line 48:  
# Structured dictionary - any field that can be in a specific language can be encoded as a standard "language" dictionary: { {"languageCode":"en", "languageValue":"in english"}, {"languageCode":"fr", "languageValue":"en français"}
 
# Structured dictionary - any field that can be in a specific language can be encoded as a standard "language" dictionary: { {"languageCode":"en", "languageValue":"in english"}, {"languageCode":"fr", "languageValue":"en français"}
 
This is also valid for fields that will be in the interface language, as a translation is not always available.
 
This is also valid for fields that will be in the interface language, as a translation is not always available.
 +
 +
=== Write parameters ===
 +
These are parameters defined when writing a field in a specific language, say for updating a product name in spanish. This especially an issue when there are multiple languages involved.
 +
1 Using a default as set by another parameter (lc="en"), then any language dependent field will be in english;
 +
2 adapted field-names, i.e specify ingredients_en, ingredients_es, as needed;
 +
3 Explicit encoding for fields that can comprise multiple languages, i.e. labels="en:bottle, fr:bouteille à recycler, nl:glasbak"
    
= Product read API =
 
= Product read API =
3,393

edits

Navigation menu