Skip to content
Snippets Groups Projects
Commit 78d9d31f authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Update the documentation regarding translation (remove all references to the...

Update the documentation regarding translation (remove all references to the translation portal, reformat and fix typos).
parent add952ff
No related branches found
No related tags found
No related merge requests found
......@@ -2,27 +2,19 @@ SimpleSAMLphp Translation Portal
================================================================
<!--
This file is written in Markdown syntax.
For more information about how to use the Markdown syntax, read here:
http://daringfireball.net/projects/markdown/syntax
This file is written in Markdown syntax.
For more information about how to use the Markdown syntax, read here:
http://daringfireball.net/projects/markdown/syntax
-->
<!-- {{TOC}} -->
SimpleSAMLphp supports multiple languages.
* The SimpleSAMLphp Translation Portal
* Language definition file
* Translation file
## How translated terms are referred from a template
Here is an example of how two terms are included in a template from dictionary files:
<h2><?php echo $this->t('{core:frontpage:about_header}'); ?></h2>
<p><?php echo $this->t('{core:frontpage:about_text}'); ?></p>
<h2><?php echo $this->t('{core:frontpage:about_header}'); ?></h2>
<p><?php echo $this->t('{core:frontpage:about_text}'); ?></p>
In this example, two translated terms are included: `about_header` and `about_text`. Both these terms are found in a dictionary file named `frontpage`, inside the module named `core`.
......@@ -48,149 +40,52 @@ The content of the defintion file is a *JSON encoded array* of `term => definiti
Here is an example of a definition file with three terms:
{
"header": {
"en": "Missing cookie"
},
"description": {
"en": "You appear to have disabled cookies in your browser. Please check the settings in your browser, and try again."
},
"retry": {
"en": "Retry"
}
}
{
"header": {
"en": "Missing cookie"
},
"description": {
"en": "You appear to have disabled cookies in your browser. Please check the settings in your browser, and try again."
},
"retry": {
"en": "Retry"
}
}
Note: you may not include other languages in the definition files, the `en` index is used in order to at a later point in time introduce more meta information for each term, like in example:
"header": {
"en": "Missing cookie",
"_note": "This text shows up on the error page when the browser do not support cookies."
},
"header": {
"en": "Missing cookie",
"_note": "This text shows up on the error page when the browser do not support cookies."
},
To summarize the pattern of the defintion file is as follows:
To summarize the pattern of the definition file is as follows:
{
"TERM1": {
"en": "English text 1"
},
"TERM2": {
"en": "English text 2"
}
}
{
"TERM1": {
"en": "English text 1"
},
"TERM2": {
"en": "English text 2"
}
}
## The translation file
The translation file is similar to the definition file, but including translation to languages others than English.
This file is reccomended to never write manually, but instead use the SimpleSAMLphp translation portal, and then download generated translation files.
This file is recommended to never write manually, but instead use the SimpleSAMLphp translation portal, and then download generated translation files.
The structure of the file is identical to the definition files, except from the language index, which now is not `en`, but the actual langauge that is translated:
{
"TERM1": {
"no": "Norsk tekst 1",
"da": "Dansk tekst 1"
},
"TERM2": {
"no": "Norsk tekst 2",
"da": "Dansk tekst 2"
}
}
## The SimpleSAMLphp Translation Portal
The SimpleSAMLphp translation portal is available here:
* <https://translation.rnd.feide.no/>
Use Feide OpenIdP to login, select the application you want to translate, SimpleSAMLphp or your own application, then start translate to your langauge.
## The `translation.php` command line script
The `translation.php` script is available in the `bin` directory of SimpleSAMLphp.
The script requires that the config file `translation.php` is copied from `config-templates` to the `config` directory.
The script may be used to these tasks:
* Uploading definition files
* Downloading definition files
* Downloading translation files
### Uploading defintion files
You probably do not have access to upload definition files for the SimpleSAMLphp application. But, from January 2010, the translation portal is generic to host multiple independent applications. What you may do is to contact Andreas to add your own application to the translation portal, where you of course have access to upload definition files.
**Note**: an application may very well be a local SimpleSAMLphp module that you run.
To add a new application to the SimpleSAMLphp translation portal, contact Andreas with the following information:
* name of the application
* Feide OpenID userids of the individuals that should have access to upload definition files
* a list of languages that should be expored
If you want to upload a definition file, edit the `translation.php` config file to include the ID of your application.
Then manually create a definition file as described in the section *The definition file* above.
Next run the script as follows:
bin/translation.php push modules/MODULENAME/dictionaries/BASENAME.definition.json
Output example:
Action: [push]
Application: [simplesamlphp]
File orig: [modules/core/dictionaries/no_cookie.definition.json]
File base: [no_cookie]
Using OAuth to authenticate you to the translation portal
Successfully read OAuth Access Token from cache [_6d20d3830e7823304881ca9b829bedb0caf8877c8c]
New definition file [no_cookie] stored in application [simplesamlphp] for user [andreas@rnd.feide.no] ...
The script uses OAuth to connect your session on the command line client with the translation portal, then you need to login using Feide OpenIdP.
### Deleting definition files
Is perfomed via the webbased translation portal.
### Downloading defintion files
Seldom used, as the defintion file is manually created locally. Anyway:
bin/translation.php pulldef modules/MODULENAME/dictionaries/BASENAME.definition.json
Output example:
Action: [pulldef]
Application: [simplesamlphp]
File orig: [modules/core/dictionaries/no_cookie.definition.json]
File base: [no_cookie]
### Downloading translation files
bin/translation.php pull modules/MODULENAME/dictionaries/BASENAME.translation.json
Note: it is optional whether you use `BASENAME.defintion.json` or `BASENAME.translation.json`
Example output:
Action: [pull]
Application: [simplesamlphp]
File orig: [modules/core/dictionaries/no_cookie.definition.json]
File base: [no_cookie]
Often you would like to pull translation from a number of definition files distributed in many different modules. Then you may use some helpful commands like:
find . -name '*.definition.json' | xargs -n 1 bin/translation.php pull
Note: Be careful when you checkin
### Converting old translation file to new definition file
bin/translation.php convert modules/MODULENAME/dictionaries/BASENAME.php
And a new definition file is created using the new JSON format.
{
"TERM1": {
"no": "Norsk tekst 1",
"da": "Dansk tekst 1"
},
"TERM2": {
"no": "Norsk tekst 2",
"da": "Dansk tekst 2"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment