Difference between revisions of "Multilang field"
m (missing closing tt) |
m |
||
Line 12: | Line 12: | ||
*** [[Multilang field]] | *** [[Multilang field]] | ||
− | == Properties == | + | == Additional Properties == |
+ | Same as [[Compound field#Additional_Properties|Compound fields]] except for: | ||
+ | |||
{| border="1" cellpadding="3" cellspacing="0" | {| border="1" cellpadding="3" cellspacing="0" | ||
| name || default || description | | name || default || description | ||
Line 22: | Line 24: | ||
== Required Phrases == | == Required Phrases == | ||
− | + | Same as [[Compound field#Required_Phrases|Compounds fields]] but rather than needing: | |
datasetid + "_fieldname_" + fieldname | datasetid + "_fieldname_" + fieldname | ||
Multilang fields require the following phrases. The first directly replaces the original fieldname phrase and the second specifies the language used: | Multilang fields require the following phrases. The first directly replaces the original fieldname phrase and the second specifies the language used: |
Revision as of 22:41, 9 April 2023
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid
Contents
Description
Allows multiple text values to be recorded representing the same text in different languages. This is a sub-class of the Compound field as at least two sub-fields are required. At least one to store the text and one to store the language (sub-field called lang) in which it is written. By default a Multilang field still sets multiple => 0 so if more than only one language will be used for any one record then multiple => 1 also needs to be set.
The languages available for the lang sub-field are specified in the cfg/namedsets/languages file.
Inheritance
Additional Properties
Same as Compound fields except for:
name | default | description |
input_boxes | 1 | as for Metadata but with a different default. |
input_ordered | 0 | as for Metadata but with a different default. |
Required Phrases
Same as Compounds fields but rather than needing:
datasetid + "_fieldname_" + fieldname
Multilang fields require the following phrases. The first directly replaces the original fieldname phrase and the second specifies the language used:
datasetid + "_fieldname_" + fieldname + "_" + subfieldname datasetid + "_fieldname_" + fieldname + "_lang"
As Multilang fields are compound there may be more than two phrases to add depending on the number of subfields specified.
If you were to change the title phrase for an eprint to have type multilang, you would need the phrases:
eprint_fieldname_title_text eprint_fieldname_title_lang
If you modify the cfg/namedsets/languages file you will need to make sure you add the appropriate additional phrases in the form:
languages_typename_LANGID
E.g. languages_typename_fr_ca could be French Canadian
Database
Multilang fields do not have a standard way of being stored in the database as they are compound fields. The lang sub-field will appear in the dataset table (or separate table if a multiple field) as:
fieldname_lang VARCHAR(16)
API
See API page.
Examples
Most basic example.
{ name => 'title_multilang', type => 'multilang', fields => [ { sub_name => 'text', type => 'text', }, ], }
Multiple languages for a single record field.
{ name => 'title_multilang', type => 'multilang', multiple => 1, fields => [ { sub_name => 'text', type => 'text', }, ], }
More than one non-language sub-field.
{ name => 'question', type => 'multilang', multiple => 1, fields => [ { sub_name => 'question', type => 'longtext', }, { sub_name => 'answer', type => 'text', }, ], }