| 1 | |
| 2 | [[PageOutline(3-4, Sections)]] |
| 3 | |
| 4 | == !GetTranslation == |
| 5 | |
| 6 | === Intro === |
| 7 | |
| 8 | get a translation for given program and language |
| 9 | |
| 10 | ---- |
| 11 | === Description === |
| 12 | |
| 13 | '''struct !GetTranslation(string $token, string $iso639, string $format, string $program )''' |
| 14 | |
| 15 | Returns base64-encoded translation strings for program ''program'' and language ''$iso639'' in format ''$format''. |
| 16 | |
| 17 | This function is used to provide multi-language support for client applications in a single environment. |
| 18 | |
| 19 | The language translation strings are stored on the server which provides user interface to edit/update them. |
| 20 | |
| 21 | Updated strings can then be downloaded to client application using this method. |
| 22 | |
| 23 | |
| 24 | ---- |
| 25 | === Parameters === |
| 26 | |
| 27 | ''token (required)'':: |
| 28 | token string identifying user's session, taken from [wiki:XmlRpcLogIn LogIn] output structure. |
| 29 | ''iso639'' (required):: |
| 30 | language [http://www.loc.gov/standards/iso639-2/php/code_list.php ISO639-1] 2-letter code |
| 31 | ''format'':: |
| 32 | available formats: |
| 33 | * gnugettext compatible: mo, po |
| 34 | * additional: txt, xml |
| 35 | ''program'' (required):: |
| 36 | * name of the program/client application you want translations for. |
| 37 | * currently supported values: ''subdownloader'', ''oscar'' |
| 38 | |
| 39 | ---- |
| 40 | === Return Values === |
| 41 | |
| 42 | Output is returned in this structure: |
| 43 | {{{ |
| 44 | struct( |
| 45 | (string) [status], |
| 46 | (string) [data], |
| 47 | (double) [seconds] |
| 48 | ) |
| 49 | }}} |
| 50 | |
| 51 | and contains these elements: |
| 52 | ''status'':: |
| 53 | function result code, see [wiki:XmlRpcStatusCode list of status codes] |
| 54 | ''data'':: |
| 55 | base64-encoded language file contents |
| 56 | ''seconds'':: |
| 57 | time taken to execute this command on server |
| 58 | |
| 59 | |
| 60 | ---- |
| 61 | === Implementations === |
| 62 | |
| 63 | There are currently no available sample implementations. |
| 64 | |
| 65 | |
| 66 | ---- |
| 67 | === Changelog === |
| 68 | |
| 69 | Version 1: created this function |
| 70 | |
| 71 | |
| 72 | ---- |
| 73 | === Examples === |
| 74 | |
| 75 | |
| 76 | ==== Input ==== |
| 77 | |
| 78 | {{{ |
| 79 | #!xml |
| 80 | <methodCall> |
| 81 | <methodName>GetTranslation</methodName> |
| 82 | <params> |
| 83 | <param> |
| 84 | <value><string>d5pnounn3ea5aja0nn4inqamf2</string></value> |
| 85 | </param> |
| 86 | <param> |
| 87 | <value><string>pb</string></value> |
| 88 | </param> |
| 89 | <param> |
| 90 | <value><string>mo</string></value> |
| 91 | </param> |
| 92 | <param> |
| 93 | <value><string>oscar</string></value> |
| 94 | </param> |
| 95 | </params> |
| 96 | </methodCall> |
| 97 | }}} |
| 98 | |
| 99 | |
| 100 | ==== Output ==== |
| 101 | |
| 102 | {{{ |
| 103 | #!xml |
| 104 | <methodResponse> |
| 105 | <params> |
| 106 | <param> |
| 107 | <value> |
| 108 | <struct> |
| 109 | <member> |
| 110 | <name>status</name> |
| 111 | <value><string>200 OK</string></value> |
| 112 | </member> |
| 113 | <member> |
| 114 | <name>data</name> |
| 115 | <value><string>3hIEl ... gzipped and base64-encoded language file contents ... yZwA=</string></value> |
| 116 | </member> |
| 117 | <member> |
| 118 | <name>seconds</name> |
| 119 | <value><double>3.824</double></value> |
| 120 | </member> |
| 121 | </struct> |
| 122 | </value> |
| 123 | </param> |
| 124 | </params> |
| 125 | </methodResponse> |
| 126 | }}} |
| 127 | |
| 128 | |
| 129 | ---- |
| 130 | === Notes === |
| 131 | |
| 132 | * you must base-64 decode ''data'' to get the translation strings and then save the contents/file to the desired directory. |
| 133 | |
| 134 | |
| 135 | ---- |
| 136 | === See also === |
| 137 | |
| 138 | * [wiki:XmlRpcGetAvailableTranslations GetAvailableTranslations] |
| 139 | |
| 140 | |
| 141 | ---- |
| 142 | === Comments === |
| 143 | |
| 144 | add your comments, hints and suggestions here if you like ... |
| 145 | |
| 146 | |
| 147 | -------- |
| 148 | [wiki:XmlRpcGetAvailableTranslations Prev (GetAvailableTranslations)] [wiki:XmlRpcIntro Home] [Next] |