Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
MultiLang Fields Bazaar Package
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[Category:EPrints 3 Plugins]] The MultiLang plugins introduces multiple language support in EPrints fields. The specific plugin replaces the '''title''' and '''abstract''' fields' types with their multilingual versions that calculate their values based on two newly added multilingual fields ('''ml_title''' and '''ml_abstract''' respectively). The wiki-page that explains how one can replace basic EPrints fields with multilang-fields -which basically explains how this plugin was created- is [[Adding multilang fields]]. == Installation Prerequisites == None. == Installation == Install through the EPrints Bazaar. == Warning for already populated repositories == Once this plugin is installed, '''existing titles and abstracts''' will not be copied into their multilingual counterparts and '''access to them via the API will be lost'''! The users of this plugin are requested to use EPrints API to copy the values from the old fields to the new ones. A script that copies the '''title''' value of each eprint to '''ml_title''' field's '''en''' and '''el''' languages can be found here:[https://github.com/mamalos/eprints/blob/master/help_scripts/set_ml_title.pl]. Please, use this script at your own risk and don't forget to change its content to reflect the languages of your repository. The same script can be used for copying the '''abstract''' field's values to '''ml_abstract''' '''en''' and '''el''' by replacing title with abstract in this script. == How to use the plugin == Once the plugin has been installed, the user needs to edit the workflow to contain the multilingual fields' versions instead of the default ones. This procedure is explained in the next section. == Editing the workflow == In order for the plugin to be usable, the default field versions need to be commented out and the new multilingual ones need to be added. So, '''~eprints/archives/reponame/cfg/workflows/eprint/default.xml''' has to be edited as follows: <source lang="html4strict"> <!-- <component><field ref="title" required="yes" input_lookup_url="{$config{rel_cgipath}}/users/lookup/title_duplicates" input_lookup_params="id={eprintid}&dataset=eprint&field=title" /></component> <component><field ref="abstract"/></component> --> <component><field ref="ml_title" required="yes" input_lookup_url="{$config{rel_cgipath}}/users/lookup/ml_title_duplicates" input_lookup_params="id={eprintid}&dataset=eprint&field=ml_title"/></component> <component><field ref="ml_abstract"/></component> </source> As can be seen, the default lookup script is replaced by the plugin's lookup script ('''ml_title_duplicates''') which supports the new '''ml_'''fields. Once the workflow has changed, the repository needs to be reloaded for the changes to take effect: <source lang="bash"> ./epadmin reload reponame </source> == Editing the phrase files == The plugin updates the EPrints system by providing an English and a Greek phrase file for the new fields it creates. The new fields are named '''ml_title''' and '''ml_abstract'''. So, if this plugin is used for repositories in other languages than these, the site administrator needs to provide the appropriate phrase files for their languages manually. What they can do is copy the phrases from the English language phrase file located in '''~eprints/archives/<reponame>/cfg/lang/en/phrases/local.xml''' and copy them to a new file located in '''~eprints/archives/<reponame>/cfg/lang/<your_lang>/phrases/'''. The file-name should have an '''xml''' extension (like '''local.xml''' in our example). The phrases that need to be added are the following (excerpt from the Greek phrases file): <source lang="html4strict"> <!-- multilang title related phrases --> <epp:phrase id="eprint_fieldname_ml_title">Τίτλος</epp:phrase> <epp:phrase id="eprint_fieldname_ml_title_text">Κείμενο</epp:phrase> <epp:phrase id="eprint_fieldname_ml_title_help">Το help τεξτ</epp:phrase> <epp:phrase id="eprint_fieldname_ml_title_lang">Γλώσσα</epp:phrase> <epp:phrase id="eprint_fieldhelp_ml_title">Ο τίτλος του τεκμηρίου. Ο τίτλος δεν πρέπει να τελειώνει με τελεία, αλλά μπορεί να τελειώνει με ερωτηματικό. Δεν υπάρχει τρόπος να γράψετε με πλάγια γράμματα, παρακαλώ χρησιμοποιήστε απλό κείμενο. Εάν έχετε έναν υπότιτλο, θα πρέπει να προηγείται η άνω και κάτω τελεία του υπότιτλου [:]. Χρησιμοποιήστε κεφαλαία γράμματα μόνο στην πρώτη λέξη και στα κύρια ονόματα. <br/>Παράδειγμα: <span class="ep_form_example">Μια σύντομη ιστορία</span> <br/>Παράδειγμα: <span class="ep_form_example">Καβάφης: η βιογραφία</span> <br/>Παράδειγμα: <span class="ep_form_example">Μαθηματικά για μηχανικούς και επιστήμονες. 5η έκδοση</span> <br/>Παράδειγμα: <span class="ep_form_example">Οικοσυστήματα του πλανήτη. Τόμ. 26. Εκβολές του πλανήτη.</span> </epp:phrase> <!-- multilang abstract related phrases --> <epp:phrase id="eprint_fieldname_ml_abstract">Περίληψη</epp:phrase> <epp:phrase id="eprint_fieldname_ml_abstract_text">Κείμενο</epp:phrase> <epp:phrase id="eprint_fieldname_ml_abstract_help">Το help τεξτ</epp:phrase> <epp:phrase id="eprint_fieldname_ml_abstract_lang">Γλώσσα</epp:phrase> <epp:phrase id="eprint_fieldhelp_ml_abstract">Μία περίληψη των περιεχομένων. Εάν το τεκμήριο διαθέτει περίληψη, αυτή πρέπει να τοποθετηθεί εδώ. Υποστηρίζεται μόνον απλό κείμενο.</epp:phrase> </source> == Regenerating static files and abstracts == If our repository already contained records, we need to recreate static content such as static pages and abstracts. Hence, as eprints user we should run: <source lang="bash"> $ ./bin/generate_abstracts reponame $ ./bin/generate_static reponame </source> within eprints user's home directory. == How the plugin works == Basically, what the plugin does is that it replaces EPrints default '''title''' and '''abstract''' field types with a type that supports storing and retrieving information on multilingual fields. The procedure that we followed in order to achieve this functionality was the following: * We introduced a new field's type, '''virtualwithvalue''', that would allow our fields to override EPrints fields' default behaviour. * We added multilingual versions of the fields that are replaced (namely '''ml_title''' and '''ml_abstract''') to store multilingual content. * We introduced our new fields' names, types and functionality to EPrints via a configuration file located in '''~eprints/archives/<reponame>/cfg/cfg.d/''' * We added the appropriate phrases in each language's phrase file. * We added a custom lookup cgi script that uses the new '''ml_title''' field for the autocompletion feature. * We changed EPrints basic and advanced search scripts to search our new multilingual fields instead of the original ones. A screenshot showing how the two fields look when inserting a new document follows: [[File:ruomo_multilang.jpg]]
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)