Difference between revisions of "API:EPrints/Language"
(Removing all content from page) |
|||
Line 1: | Line 1: | ||
+ | <!-- Pod2Wiki=_preamble_ | ||
+ | This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. | ||
+ | -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/Language.pm|package_name=EPrints::Language}}[[Category:API|Language]]<div><!-- Edit below this comment --> | ||
+ | |||
+ | <!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> | ||
+ | ==NAME== | ||
+ | '''EPrints::Language''' - A Single Language supported by a repository. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=head_description --> | ||
+ | ==DESCRIPTION== | ||
+ | The language class handles loading the "phrase" files for a single language. See the mail documentation for a full explanation of the format of phrase files. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_new --> | ||
+ | ===$language = EPrints::Language->new( $langid, $repository, [$fallback] )=== | ||
+ | |||
+ | Create a new language object representing the phases eprints will use in a given language, loading them from the phrase config XML files. | ||
+ | |||
+ | $langid is the ISO language ID of the language, $repository is the repository to which this language object belongs. $fallback is either undef or a reference to the main language object for the repository. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_get_phrase_info --> | ||
+ | ===$info = $lang->get_phrase_info( $phraseid, $session )=== | ||
+ | |||
+ | Returns a hash describing the phrase $phraseid. Contains: | ||
+ | |||
+ | langid - the language the phrase is from | ||
+ | phraseid - the phrase id | ||
+ | xml - the raw XML fragment | ||
+ | fallback - whether the phrase was from the fallback language | ||
+ | system - whether the phrase was from the system files | ||
+ | filename - the file the phrase came from | ||
+ | |||
+ | If $phraseid doesn't exist returns undef. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_get_phrase_ids --> | ||
+ | ===$phraseids = $language->get_phrase_ids( $fallback )=== | ||
+ | |||
+ | Return a reference to an array of all phrase ids that are defined in this language (repository and system). | ||
+ | |||
+ | If $fallback is true returns any additional phrase ids defined in the fallback language. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_phrase --> | ||
+ | ===$xhtml = $language->phrase( $phraseid, $inserts, $session )=== | ||
+ | |||
+ | Return an XHTML DOM structure for the phrase with the given phraseid. | ||
+ | |||
+ | The phraseid is looked for in the following order, if it's not in one phrase file the system checks the next. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_this_languages_repository_specific_phrases --> | ||
+ | ===This languages repository specific phrases.=== | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_phrases --> | ||
+ | ===The fallback languages repository specific phrases (if there is a fallback).=== | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_this_languages_general_phrases --> | ||
+ | ===This languages general phrases.=== | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_phrases --> | ||
+ | ===The fallback languages general phrases (if there is a fallback).=== | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_failing_that_it_returns_an_xhtml_dom_encoded_error --> | ||
+ | ===Failing that it returns an XHTML DOM encoded error.=== | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_has_phrase --> | ||
+ | ===$boolean = $language->has_phrase( $phraseid, $session )=== | ||
+ | |||
+ | Return 1 if the phraseid is defined for this language. Return 0 if it is only available as a fallback or unavailable. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_get_id --> | ||
+ | ===$langid = $language->get_id=== | ||
+ | |||
+ | Return the ISO language ID of this language object. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_get_fallback --> | ||
+ | ===$lang = $language->get_fallback()=== | ||
+ | |||
+ | Return the fallback language for this language. Returns undef if there is no fallback. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_load_phrases --> | ||
+ | ===$ok = $language->load_phrases( $session, $file )=== | ||
+ | |||
+ | Load phrases from $file into the current language (use with care!). | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=item_create_phrase_doc --> | ||
+ | ===$doc = EPrints::Language->create_phrase_doc( $session, [ $comment ] )=== | ||
+ | |||
+ | Create and return a new, empty, phrases document. Optionally put $comment at the top. | ||
+ | |||
+ | <div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <span style='display:none'>User Comments</span> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | </div> | ||
+ | <!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment --> |
Revision as of 13:21, 25 February 2010
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
- 1 NAME
- 2 DESCRIPTION
- 2.1 $language = EPrints::Language->new( $langid, $repository, [$fallback] )
- 2.2 $info = $lang->get_phrase_info( $phraseid, $session )
- 2.3 $phraseids = $language->get_phrase_ids( $fallback )
- 2.4 $xhtml = $language->phrase( $phraseid, $inserts, $session )
- 2.5 This languages repository specific phrases.
- 2.6 The fallback languages repository specific phrases (if there is a fallback).
- 2.7 This languages general phrases.
- 2.8 The fallback languages general phrases (if there is a fallback).
- 2.9 Failing that it returns an XHTML DOM encoded error.
- 2.10 $boolean = $language->has_phrase( $phraseid, $session )
- 2.11 $langid = $language->get_id
- 2.12 $lang = $language->get_fallback()
- 2.13 $ok = $language->load_phrases( $session, $file )
- 2.14 $doc = EPrints::Language->create_phrase_doc( $session, [ $comment ] )
NAME
EPrints::Language - A Single Language supported by a repository.
DESCRIPTION
The language class handles loading the "phrase" files for a single language. See the mail documentation for a full explanation of the format of phrase files.
$language = EPrints::Language->new( $langid, $repository, [$fallback] )
Create a new language object representing the phases eprints will use in a given language, loading them from the phrase config XML files.
$langid is the ISO language ID of the language, $repository is the repository to which this language object belongs. $fallback is either undef or a reference to the main language object for the repository.
$info = $lang->get_phrase_info( $phraseid, $session )
Returns a hash describing the phrase $phraseid. Contains:
langid - the language the phrase is from phraseid - the phrase id xml - the raw XML fragment fallback - whether the phrase was from the fallback language system - whether the phrase was from the system files filename - the file the phrase came from
If $phraseid doesn't exist returns undef.
$phraseids = $language->get_phrase_ids( $fallback )
Return a reference to an array of all phrase ids that are defined in this language (repository and system).
If $fallback is true returns any additional phrase ids defined in the fallback language.
$xhtml = $language->phrase( $phraseid, $inserts, $session )
Return an XHTML DOM structure for the phrase with the given phraseid.
The phraseid is looked for in the following order, if it's not in one phrase file the system checks the next.
This languages repository specific phrases.
The fallback languages repository specific phrases (if there is a fallback).
This languages general phrases.
The fallback languages general phrases (if there is a fallback).
Failing that it returns an XHTML DOM encoded error.
$boolean = $language->has_phrase( $phraseid, $session )
Return 1 if the phraseid is defined for this language. Return 0 if it is only available as a fallback or unavailable.
$langid = $language->get_id
Return the ISO language ID of this language object.
$lang = $language->get_fallback()
Return the fallback language for this language. Returns undef if there is no fallback.
$ok = $language->load_phrases( $session, $file )
Load phrases from $file into the current language (use with care!).
$doc = EPrints::Language->create_phrase_doc( $session, [ $comment ] )
Create and return a new, empty, phrases document. Optionally put $comment at the top.