Multilingual Studio Home > PHP Library > API Reference

Multilingual Studio PHP Library Reference

Multilingual Studio PHP Library contains APIs for using functions provided by the Language Grid, such as back translation, sound reproduction and multi-hop translation, in various languages. Multilingual Studio PHP Library is a library that enables users to easily invoke the wrapped Language Grid PHP API (SOAP). This library is compatible with PHP5.3 or higher.

Please see Function list page for the list of functions in this library. Please refer to Tutorial page for how to use this library.

Contents

Service Grid API

Services: Common

Specification for authentication information

There are two ways to specify authentication information.
  • Specification of default authentication information of common services
  • Specification of specific authentication information for each service

In specification of default authentication information of common services, once you fill in the following code in the configuration file for the entire application and keep it readable until service execution, you don’t need to specify ID and password each time when running services. This is the commonly used method.
        ClientFactory::setDefaultUserId('someUserId');
        ClientFactory::setDefaultPassword('somePassword');

Specification of specific authentication information of each service specifies the ID and password individually when creating the service client. This method is used when a server in the service grid is different for each provided service and so on.
        $client = ClientFactory::createTranslationClient('Service URL');
        $client->setUserId('someUserId');
        $client->setUserId('somePassword');

Exception on failure of invoking SOAP

In the case of failure of invoking SOAP, such as authentication error, LangridException (the standardException class) occurs. When using a client, be sure to catch the exception by using the try~catch syntax.

        try {
            $client = ClientFactory::createBilingualDictionaryClient('Service URL');
            $client->getSupportedLanguagePairs();
        } catch(LangridException $e) {
            // Some error handling
        }

AdjacencyPairClient

Interface of the AdjacencyPairs service client.

search

Parameter

  • (string) category - category
  • (string) language - language code based on RFC3066. (In the case that only the prefix corresponds to the defined language, only the first option is invoked (For example: In the case that the supporting language has zh-Hans and zh specified as the language))
  • (string) firstTurn - utterance (REQUIRED)
  • (const MatchingMethod) matchingMethod - search method ("COMPLETE","PREFIX","SUFFIX","PARTIAL","REGEX") (REQUIRED)
Return value
  • category - category
  • firstTurn - utterance
  • secondTurns - adjacency array reply
[An example of execution results]
        .array(2) {
          [0]=>
          object(stdClass)#207 (3) {
            ["category"]=>
            string(7) "Payment"
            ["firstTurn"]=>
            string(23) "test/examination charge"
            ["secondTurns"]=>
            array(1) {
              [0]=>
              string(98) "charges for specimen tests, ie.blood, urine etc. and physical examinations ie. ECG, endoscopy etc."
            }
          }
          [1]=>
          object(stdClass)#205 (3) {
            ["category"]=>
            string(7) "account"
            ["firstTurn"]=>
            string(23) "test/examination charge"
            ["secondTurns"]=>
            array(1) {
              [0]=>
              string(100) "charges for specimen tests ie.blood, urine etc. and physical examinations ie.EKG/ECG, endoscopy etc."
            }
          }
        }
                        

Top↑

BackTranslationClient

Interface of the BackTranslation service client.

backTranslate

Parameter

  • (Language) sourceLang - the source language
  • (Language) intermediateLang - the intermediate language
  • (String) source - the character string to be translated
Return value
[An example of execution results]
        .object(stdClass)#207 (2) {
          ["intermediate"]=>
          string(148) "Kyoto, 因 Mi to Luoyang became the capital of the Chinese dynasties, and often, was told Kyoraku, inside the capital, Luoyang and such a long time."
          ["target"]=>
          string(164) "洛陽に京都,因Miは中国王朝の首都となり,多くの場合,首都,洛陽,そのような長い時間の中で,京楽を言われました."
        }

Top↑

BilingualDictionaryClient

Interface of the bilingual dictionary service client.

search

Parameter

  • (Language) headLang - the source language based on RFC3066. (In the case that only the prefix corresponds to the defined language, only the first option is invoked (For example: In the case that the target language has zh-Hans and zh specified as headLang))
  • (Language) targetLang - the target language based on RFC3066. (In the case that only the prefix corresponds to the defined language, only the first option is invoked (For example: In the case that the target language has zh-Hans and zh specified as targetLang))
  • (String) headWord - the word matching original translation
  • (MatchingMethod) matchingMethod - the matching method
Return value
  • headWord -  source language translation
  • targetWords -  target language translation
[An example of execution results]
        array(4) {
          [0]=> 
          object(stdClass)#198 (2) {
           ["headWord"]=> string(15) "生き生きと"
           ["targetWords"]=> array(1) {
            [0]=> string(7) "freshly" }
          } 
          [1]=> object(stdClass)#199 (2) {
           ["headWord"]=> string(18) "生き返らせる"
           ["targetWords"]=> array(1) {
            [0]=> string(6) "revive" }
          }
          [2]=> object(stdClass)#200 (2) {
           ["headWord"]=> string(12) "生き返る" 
           ["targetWords"]=> array(1) {
            [0]=> string(6) "revive" 
           } 
          } 
          [3]=> object(stdClass)#201 (2) {
           ["headWord"]=> string(15) "生きている" 
           ["targetWords"]=> array(2) { 
            [0]=> string(6) "living" 
            [1]=> string(5) "alive"
           }
          }
        }

getSupportedLanguagePairs

Parameter

  • Nothing
Return value
  • (String)first - the source language supported by the service
  • (String)second - the target language supported by the service
[An example of execution results]
        array(2) {
         [0]=> object(stdClass)#6 (2) {
          ["first"]=> string(2) "ja" 
          ["second"]=> string(2) "en"
          }
          [1]=> object(stdClass)#7 (2) {
           ["first"]=> string(2) "en" 
           ["second"]=> string(2) "ja" 
          } 
        }

getSupportedMatchingMethods

Parameter

  • Nothing
Return value
  • first - the source language supported by the service
[An example of execution results]
        array(4) {
         [0]=> string(6) "PREFIX" 
         [1]=> string(8) "COMPLETE" 
         [2]=> string(7) "PARTIAL" 
         [3]=> string(6) "SUFFIX"
        }

getLastUpdate

Parameter

  • nothing
Return value
    Last modified time
[An example of execution results]
        string(24) "2009-10-05T07:35:00.000Z"

Top↑

BilingualDictionaryWithLongestMatchSearchClient

Interface of the bilingual dictionary with longest match search service client.

searchLongestMatchingTerms

Parameter

  • (Language) headLang - the source language
  • (Language) targetLang - the target language
  • (Morpheme) text - the morphemes
Return value
  • Results array
[An example of execution results]
        array(1) {
          [0]=>
          object(stdClass)#230 (3) {
            ["numberOfMorphemes"]=>
            int(1)
            ["startIndex"]=>
            int(0)
            ["translation"]=>
            object(stdClass)#231 (2) {
              ["headWord"]=>
              string(5) "hello"
              ["targetWords"]=>
              array(7) {
                [0]=>
                string(15) "こんにちは"
                [1]=>
                string(6) "もし"
                [2]=>
                string(12) "もしもし"
                [3]=>
                string(6) "あら"
                [4]=>
                string(6) "おや"
                [5]=>
                string(6) "やあ"
                [6]=>
                string(6) "おい"
              }
            }
          }
        }

Top↑

ConceptDictionaryClient

Interface of the concept dictionary service client.

getRelatedConcepts

Parameter

  • (Language) language - language of the concept
  • (String) conceptId -  ID of concept
  • (ConceptualRelation) relation - the conceptual relation
Return value
[An example of execution results]
        .array(1) {
          [0]=>
          object(stdClass)#208 (5) {
            ["conceptId"]=>
            string(38) "urn:langrid:edr:concept:unknown:30f8af"
            ["glosses"]=>
            array(1) {
              [0]=>
              object(stdClass)#207 (2) {
                ["glossText"]=>
                string(67) "action, act (action having to do with progress of action or matter)"
                ["language"]=>
                string(2) "en"
              }
            }
            ["partOfSpeech"]=>
            string(7) "unknown"
            ["relations"]=>
            array(2) {
              [0]=>
              string(9) "HYPERNYMS"
              [1]=>
              string(8) "HYPONYMS"
            }
            ["synset"]=>
            array(1) {
              [0]=>
              object(stdClass)#209 (2) {
                ["language"]=>
                string(2) "en"
                ["lemmaForm"]=>
                string(0) ""
              }
            }
          }
        }

searchConcepts

Parameter

  • (Language) language - language of the concept
  • (String) word -  source word for the concept
  • (MatchingMethod) matchingMethod - matching method
Return value
[An example of execution results]
        array(4) { [0]=> object(stdClass)#201 (5) { ["conceptId"]=> string(40) "urn:langrid:edr:concept:adjective:0dcb8f" ["glosses"]=> array(1) { [0]=> object(stdClass)#202 (2) { ["glossText"]=> string(13) "of experiment" ["language"]=> string(2) "en" } } ["partOfSpeech"]=> string(9) "adjective" ["relations"]=> array(1) { [0]=> string(9) "HYPERNYMS" } ["synset"]=> array(1) { [0]=> object(stdClass)#203 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(7) "testing" } } } [1]=> object(stdClass)#204 (5) { ["conceptId"]=> string(40) "urn:langrid:edr:concept:adjective:0dcb90" ["glosses"]=> array(1) { [0]=> object(stdClass)#205 (2) { ["glossText"]=> string(24) "requiring maximum effort" ["language"]=> string(2) "en" } } ["partOfSpeech"]=> string(9) "adjective" ["relations"]=> array(1) { [0]=> string(9) "HYPERNYMS" } ["synset"]=> array(1) { [0]=> object(stdClass)#206 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(7) "testing" } } } [2]=> object(stdClass)#207 (5) { ["conceptId"]=> string(35) "urn:langrid:edr:concept:verb:3ce65d" ["glosses"]=> array(1) { [0]=> object(stdClass)#208 (2) { ["glossText"]=> string(28) "to make a trial of something" ["language"]=> string(2) "en" } } ["partOfSpeech"]=> string(4) "verb" ["relations"]=> array(2) { [0]=> string(9) "HYPERNYMS" [1]=> string(8) "HYPONYMS" } ["synset"]=> array(5) { [0]=> object(stdClass)#209 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(5) "prove" } [1]=> object(stdClass)#210 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(4) "test" } [2]=> object(stdClass)#211 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(6) "proven" } [3]=> object(stdClass)#212 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(10) "field-test" } [4]=> object(stdClass)#213 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(3) "try" } } } [3]=> object(stdClass)#214 (5) { ["conceptId"]=> string(42) "urn:langrid:edr:concept:noun.common:3ce65d" ["glosses"]=> array(1) { [0]=> object(stdClass)#215 (2) { ["glossText"]=> string(28) "to make a trial of something" ["language"]=> string(2) "en" } } ["partOfSpeech"]=> string(11) "noun.common" ["relations"]=> array(2) { [0]=> string(9) "HYPERNYMS" [1]=> string(8) "HYPONYMS" } ["synset"]=> array(8) { [0]=> object(stdClass)#216 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(11) "examination" } [1]=> object(stdClass)#217 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(4) "test" } [2]=> object(stdClass)#218 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(7) "testing" } [3]=> object(stdClass)#219 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(7) "approof" } [4]=> object(stdClass)#220 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(3) "ex." } [5]=> object(stdClass)#221 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(5) "trial" } [6]=> object(stdClass)#222 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(4) "exam" } [7]=> object(stdClass)#223 (2) { ["language"]=> string(2) "en" ["lemmaForm"]=> string(3) "try" } } } }
                        

Top↑

DependencyParserClient

Interface of the dependency parser service client.

parseDependency

Parameter

  • (Language) language - input sentence language
  • (String) sentence -  input sentence
Return value
[An example of execution results]
        array(6) { [0]=> object(stdClass)#198 (3) { ["chunkId"]=> string(1) "0" ["dependency"]=> object(stdClass)#199 (2) { ["headChunkId"]=> string(1) "4" ["label"]=> string(10) "DEPENDENCY" } ["morphemes"]=> array(2) { [0]=> object(stdClass)#200 (3) { ["lemma"]=> string(3) "主" ["partOfSpeech"]=> string(7) "unknown" ["word"]=> string(3) "主" } [1]=> object(stdClass)#201 (3) { ["lemma"]=> string(3) "に" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(3) "に" } } } [1]=> object(stdClass)#202 (3) { ["chunkId"]=> string(1) "1" ["dependency"]=> object(stdClass)#203 (2) { ["headChunkId"]=> string(1) "4" ["label"]=> string(10) "DEPENDENCY" } ["morphemes"]=> array(2) { [0]=> object(stdClass)#204 (3) { ["lemma"]=> string(6) "薬味" ["partOfSpeech"]=> string(11) "noun.common" ["word"]=> string(6) "薬味" } [1]=> object(stdClass)#205 (3) { ["lemma"]=> string(9) "として" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(9) "として" } } } [2]=> object(stdClass)#206 (3) { ["chunkId"]=> string(1) "2" ["dependency"]=> object(stdClass)#207 (2) { ["headChunkId"]=> string(1) "3" ["label"]=> string(10) "DEPENDENCY" } ["morphemes"]=> array(2) { [0]=> object(stdClass)#208 (3) { ["lemma"]=> string(6) "多く" ["partOfSpeech"]=> string(7) "unknown" ["word"]=> string(6) "多く" } [1]=> object(stdClass)#209 (3) { ["lemma"]=> string(3) "の" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(3) "の" } } } [3]=> object(stdClass)#210 (3) { ["chunkId"]=> string(1) "3" ["dependency"]=> object(stdClass)#211 (2) { ["headChunkId"]=> string(1) "4" ["label"]=> string(10) "DEPENDENCY" } ["morphemes"]=> array(2) { [0]=> object(stdClass)#212 (3) { ["lemma"]=> string(6) "料理" ["partOfSpeech"]=> string(7) "unknown" ["word"]=> string(6) "料理" } [1]=> object(stdClass)#213 (3) { ["lemma"]=> string(3) "で" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(3) "で" } } } [4]=> object(stdClass)#214 (3) { ["chunkId"]=> string(1) "4" ["dependency"]=> object(stdClass)#215 (2) { ["headChunkId"]=> string(1) "5" ["label"]=> string(10) "DEPENDENCY" } ["morphemes"]=> array(4) { [0]=> object(stdClass)#216 (3) { ["lemma"]=> string(6) "使う" ["partOfSpeech"]=> string(4) "verb" ["word"]=> string(6) "使わ" } [1]=> object(stdClass)#217 (3) { ["lemma"]=> string(6) "れる" ["partOfSpeech"]=> string(4) "verb" ["word"]=> string(3) "れ" } [2]=> object(stdClass)#218 (3) { ["lemma"]=> string(3) "て" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(3) "て" } [3]=> object(stdClass)#219 (3) { ["lemma"]=> string(6) "いる" ["partOfSpeech"]=> string(4) "verb" ["word"]=> string(6) "いる" } } } [5]=> object(stdClass)#220 (3) { ["chunkId"]=> string(1) "5" ["dependency"]=> object(stdClass)#221 (2) { ["headChunkId"]=> string(2) "-1" ["label"]=> string(10) "DEPENDENCY" } ["morphemes"]=> array(3) { [0]=> object(stdClass)#222 (3) { ["lemma"]=> string(3) "“" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(3) "“" } [1]=> object(stdClass)#223 (3) { ["lemma"]=> string(6) "ねぎ" ["partOfSpeech"]=> string(11) "noun.common" ["word"]=> string(6) "ねぎ" } [2]=> object(stdClass)#224 (3) { ["lemma"]=> string(3) "”" ["partOfSpeech"]=> string(5) "other" ["word"]=> string(3) "”" } } } }
                        

Top↑

DocumentTranslationClient

Interface of the document translation service client.

start

Parameter

  • (Language) headLang - the source language
  • (Language) targetLang - the target language
  • (Document) doc - the document to be translated
Return value
    Token consisting of 40 characters used in correspondence below.
[An example of execution results]
                        

isFinished

Parameter

  • (String) token - the token returned by start method
Return value
    Whether translation is finished or not.
[An example of execution results]
                        

getProgress

Parameter

  • (String) token - the token returned by start method
Return value
    The state of translation progress. 0.0 means start, 1.0 means end.
[An example of execution results]
                        

getResult

Parameter

  • (String) token - the token returned by start method
Return value
    The binary file of the translation result document data.
[An example of execution results]
                        

Top↑

LanguageIdentificationClient

Interface of the morpheme service client.

identifyLanguageAndEncoding

Parameter

  • (byte[]) textBytes - identified character string
Return value
  • Identification results

identify

Parameter

  • (String) text - Identified character string
  • (String) originalEncoding - encoding of the character string
Return value
[An example of execution results]
        string(2) "ja"

getSupportedLanguages

Parameter

Return value
[An example of execution results]
        array(53) {
          [0]=>
          string(2) "af"
          [1]=>
          string(2) "sq"
          [2]=>
          string(2) "ar"
          [3]=>
          string(2) "be"
          [4]=>
          string(2) "bg"
          [5]=>
          string(2) "ca"
          ・・・
          [51]=>
          string(2) "cy"
          [52]=>
          string(2) "yi"
        }

getSupportedEncodings

Parameter

  • Nothing
Return value
  • Encoding array
[An example of execution results]
        array(1) {
         [0]=> string(5) "UTF-8" 
        }

Top↑

MorphologicalAnalysisClient

Interface of the morphological analysis service client.

analyze

Parameter

  • (Language) language -  the source language based on RFC3066. (In the case that only the prefix corresponds to the defined language, only the first option is invoked (For example: In the case that the target language has zh-Hans and zh specified as headLang))
  • (String) text - the source text (REQUIRED)
Return value
  • The results of morphological analysis
[An example of execution results]
        .array(23) {
          [0]=>
          object(stdClass)#208 (3) {
            ["lemma"]=>
            string(6) "立春"
            ["partOfSpeech"]=>
            string(11) "noun.common"
            ["word"]=>
            string(6) "立春"
          }
          [1]=>
          object(stdClass)#206 (3) {
            ["lemma"]=>
            string(6) "から"
            ["partOfSpeech"]=>
            string(5) "other"
            ["word"]=>
            string(6) "から"
          }
          [2]=>
          object(stdClass)#207 (3) {
            ["lemma"]=>
            string(6) "春分"
            ["partOfSpeech"]=>
            string(11) "noun.common"
            ["word"]=>
            string(6) "春分"
          }
          [3]=>
          object(stdClass)#211 (3) {
            ["lemma"]=>
            string(3) "の"
            ["partOfSpeech"]=>
            string(5) "other"
            ["word"]=>
            string(3) "の"
          }
          ・・・

          [21]=>
          object(stdClass)#229 (3) {
            ["lemma"]=>
            string(6) "呼ぶ"
            ["partOfSpeech"]=>
            string(4) "verb"
            ["word"]=>
            string(6) "呼ぶ"
          }
          [22]=>
          object(stdClass)#230 (3) {
            ["lemma"]=>
            string(3) "."
            ["partOfSpeech"]=>
            string(5) "other"
            ["word"]=>
            string(3) "."
          }
        }

Top↑

MultihopTranslationClient

Interface of the multihop translation service client.

multihopTranslate

Parameter

  • (Language) sourceLang - the source language
  • (Language[]) intermediateLangs - the intermediate language
  • (Language) targetLang - the target language
  • (String) source - the character string to be translated
Return value
  • intermediates - intermediate results
  • target - translation results
  • li
[An example of execution results]
        .object(stdClass)#207 (2) {
          ["intermediates"]=>
          array(1) {
            [0]=>
            string(15) "こんにちは"
          }
          ["target"]=>
          string(15) "안녕하세요"
        }

Top↑

ParallelTextClient

Interface of the parallel text service client.

search

Parameter

  • (Language) sourceLang - the source language of parallel text
  • (Language) targetLang - the target language of parallel text
  • (String) source - the character string to be matched
  • (MatchingMethod) matchingMethod - the matching method
Return value
[An example of execution results]
        array(2) {
         [0]=> object(stdClass)#198 (2) {
          ["source"]=> string(51) "Body Measurements and Periodic Health Examinations " 
          ["target"]=> string(33) "身体測定・定期健康診断"
         } 
         [1]=> object(stdClass)#199 (2) {
          ["source"]=> string(282) "Children’s health and safety is considered the first priority. If a child becomes ill or is injured, they will receive first aid treatment in the health room, and hospitals and families will be contacted as necessary. By law, a periodic health examination will also be undertaken." 
          ["target"]=> string(309) "子どもの健康と安全を第一に考えています.子どもが病気になったり,けがをしたときには,保健室で応急手当をし,必要によっては病院や家庭に連絡をします.また,法律の定めるところにより,定期的に健康診断を行います."
         }
        }

Top↑

PictogramDictionaryClient

The interface of pictogram dictionary service client.

search

Parameter

  • (Language) language - the language of the word
  • (String) word - the word matching pictogram
  • (MatchingMethod) matchingMethod - the matching method
Return value
  • the matching results of pictogram. If not found, null.
[An example of execution results]
        array(1) {
         [0]=> object(stdClass)#198 (3) {
          ["image"]=> string(1924) "/* バイナリデータ */" 
          ["imageType"]=> string(3) "SWF" 
          ["word"]=> string(6) "tomato" 
         } 
        }

Top↑

QualityEstimationClient

Interface of the quality estimation service client.

estimate

Parameter

  • (Language) sourceLang - the source language
  • (Language) targetLang - the target language
  • (String) source - the source character string
  • (String) target - the target character string
Return value
  • the estimation results

Top↑

SimilarityCalculationClient

Interface of the similarity calculation service client.

calculate

Parameter

  • (Language) language - the source language based on RFC3066. (In the case that only the prefix corresponds to the defined language, only the first option is invoked (For example: In the case that the target language has zh-Hans and zh specified as headLang))
  • (String) text1 - the text to be compared (REQUIRED)
  • (String) text2 - the text to be compared (REQUIRED)
Return value
  • the calculation results
[An example of execution results]
        float(0)

Top↑

SpeechRecognitionClient

Interface of the speech recognition service client.

recognize

Parameter

  • (String) language - language
  • (Speech) speech - speech data
Return value
[An example of execution results]
        langrid exception
                        

getSupportedLanguages

Parameter

  • Nothing
Return value
  • supported languages
[An example of execution results]
        .array(1) {
          [0]=>
          string(2) "ja"
        }

getSupportedVoiceTypes

Parameter

  • Nothing
Return value
  • the types of supported voice
[An example of execution results]
        NULL
                        

getSupportedAudioTypes

Parameter

  • Nothing
Return value
  • the file format of supported audio data
[An example of execution results]
        .array(2) {
          [0]=>
          string(11) "audio/x-mp3"
          [1]=>
          string(9) "audio/wav"
        }

Top↑

TemplateParallelTextClient

Interface of the template parallel text service client.

listTemplateCategories

Parameter

  • (Language) language - language to acquire
Return value
  • the category list
[An example of execution results]
        array(1) {
         [0]=> object(stdClass)#198 (2) {
          ["categoryId"]=> string(1) "1" 
          ["categoryName"]=> string(7) "default"
         }
        }

getCategoryNames

Parameter

  • (String) categoryId - the category ID
  • (Language[]) languages - language to acquire
Return value
  • the category name
[An example of execution results]
        array(3) {
         [0]=> string(7) "default" 
         [1]=> string(7) "default" 
         [2]=> string(7) "default" 
        }

searchTemplates

Parameter

  • (Language) language - language
  • (String) text - the string to search
  • (MatchingMethod) matchingMethod - the matching method
  • (String[]) categoryIds - the category ID
Return value
  • the category name
[An example of execution results]
        array(7) { [0]=> object(stdClass)#199 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#200 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(138) "Selection is based on the results of the “interview”, “other tests” and “Chousa Sho (Records of study)” by junior high school." ["templateId"]=> string(3) "202" ["valueParameters"]=> array(0) { } } [1]=> object(stdClass)#201 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#202 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(161) "① “Written tests”.(English, Japanese, and mathematics) -Written tests will be conducted in Japanese but will have rubi(hiragana beside Chinese characters)." ["templateId"]=> string(3) "204" ["valueParameters"]=> array(0) { } } [2]=> object(stdClass)#203 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#204 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(33) "There are no “written tests”." ["templateId"]=> string(3) "200" ["valueParameters"]=> array(0) { } } [3]=> object(stdClass)#205 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#206 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(53) "Written tests and other tests of Kouki Examination II" ["templateId"]=> string(3) "137" ["valueParameters"]=> array(0) { } } [4]=> object(stdClass)#207 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#208 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(48) "Interviews and other tests of Zenki Examination " ["templateId"]=> string(3) "120" ["valueParameters"]=> array(0) { } } [5]=> object(stdClass)#209 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#210 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(47) "There are schools that may test on Feb.19(Fri)." ["templateId"]=> string(3) "129" ["valueParameters"]=> array(0) { } } [6]=> object(stdClass)#211 (5) { ["categories"]=> array(1) { [0]=> object(stdClass)#212 (2) { ["categoryId"]=> string(1) "1" ["categoryName"]=> string(7) "default" } } ["choiceParameters"]=> array(0) { } ["template"]=> string(52) "Written tests and other tests of Kouki Examination I" ["templateId"]=> string(3) "130" ["valueParameters"]=> array(0) { } } }
                        

getTemplatesByTemplateId

Parameter

  • (Language) language - language
  • (String[]) categoryIds - the category ID
Return value
  • the array of the template
[An example of execution results]
        array(5) {
          [0]=>
          object(stdClass)#238 (5) {
            ["categories"]=>
            array(1) {
              [0]=>
              object(stdClass)#235 (2) {
                ["categoryId"]=>
                string(1) "1"
                ["categoryName"]=>
                string(7) "default"
              }
            }
            ["choiceParameters"]=>
            array(0) {
            }
            ["template"]=>
            string(65) "Kanagawa Prefecture “Public High School Enrollment Guidebook”"
            ["templateId"]=>
            string(1) "3"
            ["valueParameters"]=>
            array(0) {
            }
          }
          ・・・
          [4]=>
          object(stdClass)#230 (5) {
            ["categories"]=>
            array(1) {
              [0]=>
              object(stdClass)#227 (2) {
                ["categoryId"]=>
                string(1) "1"
                ["categoryName"]=>
                string(7) "default"
              }
            }
            ["choiceParameters"]=>
            array(0) {
            }
            ["template"]=>
            string(26) "Japanese + English Version"
            ["templateId"]=>
            string(1) "4"
            ["valueParameters"]=>
            array(0) {
            }
          }
        }

generateSentence

Parameter

  • (Language) language -  language
  • (String) templateId - the template ID
  • (BoundChoiceParameter[]) boundChoiceParameters - the specification of the choice parameter
  • (BoundValueParameter[]) boundValueParameters - the specification of the value parameter
Return value
  • text
[An example of execution results]
        string(23) "For 2010 Enrollment Use"

Top↑

TextToSpeechClient

Interface of the text to speech service client.

speak

Parameter

  • (Language) language - the language of text (based on RFC3306)
  • (String) text - the text to be compared (REQUIRED)
  • (String) voiceType - the voice type."man", "woman" and so on. The default is null or "*"
  • (String) audioType - the format of output data (MIME type). "audio/mpeg", "audio/x-wav" and so on. The default is null or "audio/*"
Return value
[An example of execution results]
        object(stdClass)#209 (3) {
          ["audio"]=>
          string(24936) "/* binary data */"
        }

getSupportedLanguages

Parameter

  • nothing
Return value
  • the language list
[An example of execution results]
        array(4) {
          [0]=>
          string(2) "ja"
          [1]=>
          string(2) "en"
          [2]=>
          string(2) "zh"
          [3]=>
          string(5) "zh-CN"
        }

getSupportedVoiceTypes

Parameter

  • nothing
Return value
  • the supported voice type list
[An example of execution results]
        array(2) {
          [0]=>
          string(5) "woman"
          [1]=>
          string(3) "man"
        }

getSupportedAudioTypes

Parameter

  • nothing
Return value
  • the supported audio type list
[An example of execution results]
        array(3) {
          [0]=>
          string(11) "audio/x-wav"
          [1]=>
          string(9) "audio/ogg"
          [2]=>
          string(14) "video/x-ms-asf"
        }

Top↑

TranslationClient

Interface of the translation service client.

translate

Parameter

  • (Language) sourceLang - source language
  • (Language) targetLang - target language
  • (String) source - the character string to be translated
Return value
  • translation results
[An example of execution results]
        string(15) "This is a test."

Top↑

TranslationSelectionClient

Interface of the translation selection service client.

select

Parameter

  • (Language) sourceLang - source language
  • (Language) targetLang - target language
  • (String) source - the character string to be translated
Return value
  • translation results
[An example of execution results]
        string(16) "It is fine today"

Top↑

TranslationWithTemporalDictionaryClient

Interface of the translation with temporal dictionary service client.

translate

Parameter

  • (Language) sourceLang - source language
  • (Language) targetLang - target language
  • (String) source - the character string to be translated
  • (Translation[]) source - temporal dictionary data
  • (Language) source - the supported language of the dictionary. The head language is sourceLang
Return value
  • translation results
[An example of execution results]
        string(76) "Hiei in Kyoto Higashiyama, including is also known as the HIGASHIYAMA36HOU ."

Top↑

Local service API

Settings for using local services

Database connection settings

You need to set the database connection settings in advance. Fill a setup file for the entire application once and you can use it by reading the file. The settings are described below.

        ActiveRecord\Config::initialize(function($cfg){
           specify // "${Library root}/models"
           $cfg->set_model_directory(dirname(__FILE__).'/models');

           // descrive URL which connects to database
           $cfg->set_connections(array(
                'development' => 'mysql://${User name}:${Password}@${Host name}/${Database name}'
           ));
        });
It is also possible to define multiple connections and switching from the application side if you want switch the connection between the test environment and the production environment. Please see the section "Default_connection" of the following link for more information.
PHP ActiveRecord - Configuration Setup - An easy to use ORM for PHP

※The sample setup file is located in ${Library root}/config/service_settings.php.
You can use it by filling in the required information and by reading it.

Creation of database table

Create DB table for a local service. DDL for creating a table is located in ${Library root}/config/mysql.sql. Please run it using the DB client. The description of DDL is specified for MySQL. If you use other database servers, please modify the file accordingly.
You can use MySQL, PostgresSQL, Oracle, SQLite as the database server.

Top↑

Local dictionary

Maintain application-specific multilingual dictionaries, and use them as temporal dictionaries in the Service Grid.

Data model

[Dictionary]

  • id: Dictionary-specific ID
  • name: Dictionary name
  • licenser: License of dictionary
  • created_at: Creation date of dictionary
  • updated_at: Modification date of dictionary
  • created_by: Creator of dictionary
  • dictionary_records: Dictionary data (value acquisition is done in the below API)
  • dictionary_languages: Languages included in the dictionary (value acquisition is done in the below API)
  • dictionary_development: Deployment condition of the dictionary (value acquisition is done in the below API)
[DictionaryRecord]
  • id: Dictionary record-specific ID
  • dictionary_contents: Contents of dictionary (value acquisition is done in the below API)

Top↑

How to use

Create new dictionary

        // Creating a dictionary with property as the argument						
        $dictionary = Dictionary::create(array(
            'name' => 'Multilingual Studio common dictionary',
            'licenser' => 'Kyoto University')
        );

        echo $dictionary->id; // Show id
        echo $dictionary->name; // Show name

Update dictionary
You can update the dictionary by using either of the following methods.

        // Acquire dictionary object based on the dictionary ID					
        $dictionary = Dictionary::find(1);
        $dictionary->update_attribute('name', 'new dictionary name');
        ------------------------
        // Acquire dictionary object based on the dictionary ID					
        $dictionary = Dictionary::find(1);
        $dictionary->name = 'new dictionary name';
        $dictionary->save();

Delete dictionary

        // Acquire dictionary object based on the dictionary ID					
        $dictionary = Dictionary::find(2);
        // Case of logical delete
        $dictionary->remove();
        ------------------------
        // Case of physical delete
        $dictionary->remove(true);

Add or delete language of dictionary

        // Acquire dictionary object based on the dictionary ID
        $dictionary = Dictionary::find(3);
        // Add vi(Vietnamese) to the dictionary
        $dictionary->add_language(Language::get('vi'));

Add contents to the dictionary

        // Acquire dictionary object based on the dictionary ID
        $dictionary = Dictionary::find(3);
        // Add record to the dictionary
        $dictionary->add_record({'ja' => '京都', 'en' => 'Kyoto', 'zh' => '京都'});

Update the dictionary contents

        // Acquire dictionary object based on the dictionary ID
        $record = DictionaryRecord::find(10);
        // Update contents of the dictionary record (Update only assigned language. The languages which were not included are not updated)
        $record->update_contents(array(
            'ja' => '健康',
            'en' => 'health'
        ), '0000001');

Delete dictionary contents

        // Acquire dictionary object based on the dictionary ID
        $record = DictionaryRecord::find(10);
        $record->delete();

Provide WSDL of the dictionary service

        $endpointUrl = 'http://deploy/url/billingualdictionary.php';
        $targetNamespace = 'http://deploy/url/billingualdictionary/';
        $dictionaryId = 'dictionaryId';
        $wsdlGenerator = new BillingualDictionaryWSDL($endpointUrl, $dictionaryId, $targetNamespace);
        $wsdlGenerator->getWSDL();

Run dictionary service
        $soapServer = new BillingualDictionarySOAPServer($dictionaryId);
        $soapServer->service(file_get_contents("php://input"));

Top↑

API List

Dictionary
Instance method
Method name Arguments Return value Description
remove · (Boolean) force [= false]: logical delete or physical delete void
add_language · (Language) language: language to add (DictionaryLanguage) added DictionaryLanguage record Add languages ​​to the dictionary
get_languages
(array) A list of language codes Get the language contained in the dictionary
remove_language · (Language) $ language: language to remove
· (Boolean) $ force [= false]: whether to delete the content

Remove the language from dictionary
update_languages · (array) languages: language list to be updated
· (Boolean) force_on_delete [= false]: whether to delete the content when deleting

Update the language included in the dictionary to specify the list. (Delete  content not included in the argument. )
is_deploy
(Boolean) deployment status Return the deployment status of the dictionary service
deploy

Deploy dictionary as a service
undeploy

Undeploy dictionary from the service
add_record · (array) params: content to add
· (String) create_user [= null]: ID of the user adding content

Add content to the dictionary. Specify parameters in the hash of {language=>content}
records_count
(Integer) The number Count the total number of content included in the dictionary
get_records · (array) options: search condition (DictionaryRecord) Record the results Return records that match the search criteria included in the dictionary. Search criteria is described below .
count_records_each_language
(array) Registration number for each language Get the number of registrations for each language
count_records_by_language · (Language) language: language to obtain (Integer) Registration number Get the number of registrations in the target language
can_view · (String) user_id [= null]: ID of the user (Boolean) Result Get whether specified user (the default is all users) can view parallel texts
can_edit · (String) user_id [= null]: ID of the user (Boolean) Result Get whether specified user (the default is all users) can edit parallel texts
is_owner · (String) user_id [= null]: ID of the user (Boolean) Result Get whether the specified user is the owner of the dictionary
to_json
(String) JSON text Convert the dictionary to Json format. (Contents are not included)
to_xml
(String) XML text Convert the dictionary to the XML format. (Contents are not included)
Arguments: (data type) Argument Name [=(optional)default value]
Class Methods
Method name Arguments Return value Description
create_with_records · (Array) params: properties and records of the dictionary
· (String) create_user: ID of the user to create
(Dictionary) created dictionary Create dictionary and record immediately. Used in import etc..
details of params
 [Required]
 name, languages, records
 [Optional]
 licenser
records is in the form of array of the same number as languages.
(Example)
Dictionary::create_with_records(array(
 'name' => 'Dictionary name',
 'languages' => array('ja', 'en', 'ko'),
 'records' => array(
   array('こんにちは', 'Hello', ''),
   array('こんばんは', 'Good evening', '')
 )
));
first · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get the first parallel text that match the search criteria. Search criteria is described below
last · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get the last parallel text that match the search criteria. Search criteria is described below
all · (array) $ options [= array ()]: the search criteria (Dictionary []) list dictionary Get all of the dictionary that match the search criteria. Search criteria is described below
count · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get the number of dictionary that match the search criteria. Search criteria is described below
first_with_deleted · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get the first parallel text that match the search criteria. (Including logical deleted one) Search criteria is described below
last_with_deleted · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get the last parallel text that match the search criteria. (Including logical deleted one) Search criteria is described below
all_with_deleted · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get all of the dictionary that match the search criteria. (Including logical deleted one) Search criteria is described below
count_with_deleted · (array) $ options [= array ()]: the search criteria (Dictionary) Dictionary Get the number of dictionary that match the search criteria. (Including logical deleted one) Search criteria is described below

DictionaryRecord
Instance method
Method name Parameter Return value Description
remove

Delete the dictionary record
get_contents ・(Boolean) withAllProperty [= false]: Data format of contents (array) Hashing format array of contents Acquire contents included in the record
If withAllProperty is false (Default),return using the format, {$languageCode => $content}.
[例]
array('ja' => 'こんにちは', 'en' => 'Hello')
If withAllProperty is true, return using the format {'language code' => {$propertyName => $propertyValue} }
[例]
array( 'ja' => array('text' => 'こんにちは', 'created_at' => '2012-03-10 16:44:46'), 'en' => array('text' => 'Hello', 'created_by' => '0000001' )
get_contents_as_ordered_array ・(array) languageOrder: Array of languages (array) Array of contens Acquire contents against the assigned language in assigned order. If data in the assigned language doesn't exist, return null character string. If set array ('ja', 'en', 'ko') as the parameter, return array ('contents of ja', 'contents of en', 'contents of ko') as return value. Use this if you can get data separated by comma.
update_contents ・(array) params: Update data
・(String) update_user [= '']: Update user
(DictionaryRecord) Updated record Update the dictionary record. params set in {$languageCode => $contentText} format
[例] $reocrd->update_contents(array('ja' => '大阪', 'en' => 'Osaka'));
Class method
Method name Parameter Return calue Description
first ・(array) options [= array()]: Search criteria (DictionaryRecord) Dictionary record Get the first dictionary record matching the search criteria. The search criteria is below
last ・(array) options [= array()]: Search criteria (DictionaryRecord) Dictionary record Get the last dictionary record matching the search criteria. The search criteria is below
all ・(array) options [= array()]: Search criteria (DictionaryRecord[]) Dictionary record list Get all dictionary records matching the search criteria. The search criteria is below
count ・(array) options [= array()]: Search criteria (DictionaryRecord) Dictionary record Get the number of dictionary record matching the search criteria. The search criteria is below
count_by_resource_id_and_language ・(Integer) resource_id: Dictionary ID to be counted ・(Language) languageCode: Language code to be counted (Integer) the registration number Get the registration number of the assigned language included in the assigned dictionary.
count_by_resource_id_each_languages ・(Integer) resource_id: Dictionary ID to be counted (array) Registration number for each dictionary Get the registration number for each dictionary included in all languages.
create_record ・(Integer) resource_id: Dictionary ID to add record
・(array) params [= array()]: Added data
・(String) create_user [= '']: User ID to add
(DictionaryRecord) Added record Add a new record to the assigned dictionary
Top↑

Local parallel text

Maintain application-specific multilingual parallel text, and use as temporal parallel text in the Service Grid.

Data model

[ParallelText]

  • id: Parallel text-specific ID
  • name: Parallel text name
  • licenser: Parallel text license
  • created_at: Creation date of parallel text
  • updated_at: Update date of parallel text
  • created_by: Creator of parallel text
  • ParallelText_records: Parallel text data (value acquisition is done in the below API)
  • ParallelText_languages: Languages inluded in parallel text (value acquisition is done in the below API)
  • ParallelText_development: Deployment condition of parallel text (value acquisition is done in the below API)
[ParallelTextRecord]
  • id: Parallel text record-specific ID
  • ParallelText_contents: Contents of parallel text (value acquisition is done in the below API)

Top↑

How to use

Create new parallel text

        // Create parallel text with properties as parameters						
        $ParallelText = ParallelText::create(array(
            'name' => 'Multilingual Studio common dictionary',
            'licenser' => 'Kyoto University')
        );

        echo $ParallelText->id; // Show id
        echo $ParallelText->name; // Show name

Update parallel text
Can be updated using either of the following methods.

        // Acquire parallel text object based on the parallel text record ID					
        $ParallelText = ParallelText::find(1);
        $ParallelText->update_attribute('name', 'New parallel text name');
        ------------------------
        // Acquire parallel text object based on the parallel text record ID					
        $ParallelText = ParallelText::find(1);
        $ParallelText->name = 'New parallel text name';
        $ParallelText->save();

Delete parallel text

        // Acquire parallel text object based on the parallel text record ID					
        $ParallelText = ParallelText::find(2);
        // Case of logical delete
        $ParallelText->remove();
        ------------------------
        // Case of physical delete
        $ParallelText->remove(true);

Add or delete language to parallel text

        // Acquire parallel text object based on the parallel text record ID
        $ParallelText = ParallelText::find(3);
        // Add vi(Vietnamese) to parallel text
        $ParallelText->add_language(Language::get('vi'));

Add contents to parallel text

        // Acquire parallel text object based on the parallel text record ID
        $ParallelText = ParallelText::find(3);
        // Add record to parallel text
        $ParallelText->add_record({'ja' => '京都', 'en' => 'Kyoto', 'zh' => '京都'});

Update parallel text contents

        // Acquire parallel text object based on the parallel text record ID
        $record = ParallelTextRecord::find(10);
        // Update contents of parallel text record (Update just the assigned language. Maintain the languages which are not included)
        $record->update_contents(array(
            'ja' => '健康',
            'en' => 'health'
        ), '0000001');

Delete parallel text contents

        // Acquire parallel text object based on the parallel text record ID
        $record = ParallelTextRecord::find(10);
        $record->delete();

Provide WSDL of parallel text service
        $endpointUrl = 'http://deploy/url/paralleltext.php';
        $targetNamespace = 'http://deploy/url/paralleltextdictionary/';
        $dictionaryId = 'dictionaryId';
        $wsdlGenerator = new BillingualParallelTextWSDL($endpointUrl, $dictionaryId, $targetNamespace);
        $wsdlGenerator->getWSDL();

Run parallel text service
        $soapServer = new ParallelTextSOAPServer($dictionaryId);
        $soapServer->service(file_get_contents("php://input"));

Top↑

API List

ParallelText
Instance method
Method name Arguments Return value Description
Remove · (Boolean) force [= false]: logical delete or physical delete void
add_language · (Language) language: language to add (ParallelTextLanguage) added ParallelTextLanguage record Add languages ​​to parallel texts
get_languages
(array) A list of language codes Get the language contained in parallel texts
remove_language · (Language) $ language: language to remove
· (Boolean) $ force [= false]: whether to delete the content

Remove the specified language from parallel texts
update_languages · (array) languages: the language list to be updated
· (Boolean) force_on_delete [= false]: whether to delete the content when deleting

Update the specified list of the language that is included in the parallel text. (Delete content that is not included in the argument)
is_deploy
(Boolean) deployment situations Return the status of deployment of parallel text service
deploy

Deploy parallel texts as a service
undeploy

Undeploy the parallel texts from a service
add_record · (array) params: content to add
· (String) create_user [= null]: ID of the user to add content

Add content to the parallel text. Parameters are specified in the hash of {language=>content}
records_count
(Integer) the number of records Count the total number of contents included in parallel texts
get_records · (array) options: search condition (ParallelTextRecord) results record Return record that match the search criteria included in parallel texts. Search criteria is described below .
count_records_each_language
(array) Registration number for each language Get the number of registrations for each language
count_records_by_language · (Language) language: the language to obtain (Integer) Registration number Get the number of registrations of the target language
can_view · (String) user_id [= null]: ID of the user (Boolean) Result Get whether specified user (the default is all users) can view parallel texts
can_edit · (String) user_id [= null]: ID of the user (Boolean) Result Get whether specified user (the default is all users) can edit parallel texts
is_owner · (String) user_id [= null]: ID of the user (Boolean) Result Get whether the specified user is the owner of parallel texts
to_json
(String) JSON text Convert parallel texts to Json format (Contents are not included)
to_xml
(String) XML text Convert parallel texts to XML format (Contents are not included)
Arguments: (data type) Argument Name [=(optional)default value]
Class Methods
Method name Arguments The return value Description
create_with_records · (array) params: properties and records of parallel texts
· (String) create_user: ID of the user to create
(ParallelText) created parallel texts Create parallel texts and records immediately. Used in import etc..
details of params
 [Required]
 name, languages, records
 [Optional]
 licenser
records is in the form of an array based on the number of languages.
(Example)
ParallelText::create_with_records(array(
 'name' => '用例対訳名',
 'languages' => array('ja', 'en', 'ko'),
 'records' => array(
   array('こんにちは', 'Hello', ''),
   array('こんばんは', 'Good evening', '')
 )
));
first · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get the first parallel text that match the search criteria. Search criteria is described below
last · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get the last parallel text that match the search criteria. Search criteria is described below
all · (array) $ options [= array ()]: the search criteria (ParallelText []) list of parallel texts Get all parallel texts that match the search criteria. Search criteria is described below
count · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get the number of parallel texts that match the search criteria. Search criteria is described below
first_with_deleted · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get the first parallel text that match the search criteria. (Including logical deleted one) Search criteria is described below
last_with_deleted · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get the last parallel text that match the search criteria. (Including logical deleted one) Search criteria is described below
all_with_deleted · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get all parallel texts that match the search criteria. (Including logical deleted one) Search criteria is described below
count_with_deleted · (array) $ options [= array ()]: the search criteria (ParallelText) Parallel text Get the number of parallel texts that match the search criteria. (Including logical deleted one) Search criteria is described below

ParallelTextRecord
Instance method
Method name Arguments The return value Description
Remove

Remove parallel texts record
get_contents · (Boolean) withAllProperty [= false]: data format of the content (array) hash format array of content Get the content contained in the record.
If withAllProperty is false (the default), return in the form of {$languageCode => $content}.
[Example]
array('ja' => 'こんにちは', 'en' => 'Hello')
If withAllProperty is true, return in the form of {'language code' => {$propertyName => $propertyValue} }.
[Example]
array( 'ja' => array('text' => 'こんにちは', 'created_at' => '2012-03-10 16:44:46'), 'en' => array('text' => 'Hello', 'created_by' => '0000001' )
get_contents_as_ordered_array · (array) languageOrder: array of languages (array) array of content Get the content for the specified language in the specified order. If the data in the specified language does not exist, return an empty string. Assuming that the argument array is ('ja', 'en', 'ko'), Return value is array ('content of ja', 'content of en', 'content of ko'). Use commas to separate data.
update_contents · (array) params: update data
· (String) update_user [='']: Update User
(ParallelTextRecord) Updated record Update parallel texts record. params are specified in the form of {$languageCode => $contentText}
[Example] $reocrd->update_contents(array('ja' => '大阪', 'en' => 'Osaka'));
Class Methods
Method name Arguments The return value Description
first · (array) options [= array()]: the search criteria (ParallelTextRecord) Parallel text record Get the first parallel text that match the search criteria. Search criteria is described below
last · (array) options [= array()]: the search criteria (ParallelTextRecord) Parallel text record Get the last parallel text that match the search criteria. Search criteria is described below
all · (array) options [= array()]: the search criteria (ParallelTextRecord []) parallel texts record list Get all parallel texts that match the search criteria. Search criteria is described below
count · (array) options [= array()]: the search criteria (ParallelTextRecord) Parallel text record Get the number of parallel texts that match the search criteria. Search criteria is described below
count_by_resource_id_and_language · (Integer) resource_id: ID of parallel texts to be counted · (Language) languageCode: language code to be counted (Integer) The number Get the registration number of the specified language that match the search criteria.
count_by_resource_id_each_languages · (Integer) resource_id: ID of parallel texts to be counted ​​(array) Registration number for each language Get the registration number for each language that match the search criteria.
create_record · (Integer) resource_id: ID of parallel text to add a record
· (array) params [= array()]: additional data
· (String) create_user [='']: ID of the user to add
(ParallelTextRecord) Added record Add a new record to the specified parallel texts
Top ↑

Information on specifying search criteria for local dictionaries and parallel texts

See following page for details.
PHP ActiveRecord - Finders - An easy to use ORM for PHP

Top ↑