syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Syncope > Adding new language to admin console UI
Date Fri, 29 Mar 2013 07:37:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/3/_/styles/combined.css?spaceKey=SYNCOPE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/SYNCOPE/Adding+new+language+to+admin+console+UI">Adding
new language to admin console UI</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~ilgrosso">Francesco
Chicchiricco</a>
    </h4>
        <br/>
                         <h4>Changes (3)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">If
your language isn&#39;t in the default java set of locale constants, it&#39;s possible
to add the language  <br>using locale language tag as is showed bellow, for example,
to use Brazilian Portuguese language: <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{note}
<br>If your language is not in the default Java set of locale constants, it is possible
to add it as shown below for Brazilian Portuguese: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <br>    public
static final List&lt;Locale&gt; SUPPORTED_LOCALES = Arrays.asList(new Locale[] { <br>
       Locale.ENGLISH, Locale.ITALIAN, Locale.forLanguageTag(&quot;pt-BR&quot;) });
<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{note}
  <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. Add actual translations
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Let's take an example: consider that you want to add support for French language
in the admin console UI.</p>

<h2><a name="AddingnewlanguagetoadminconsoleUI-Sampleworkflow"></a>Sample
workflow</h2>

<h3><a name="AddingnewlanguagetoadminconsoleUI-CheckoutfreshcopyfromSVN"></a>Checkout
fresh copy from SVN</h3>

<ul>
	<li><a href="https://svn.apache.org/repos/asf/syncope/trunk/" class="external-link"
rel="nofollow">trunk</a></li>
	<li><a href="https://svn.apache.org/repos/asf/syncope/branches/1_0_X/" class="external-link"
rel="nofollow">1_0_X</a></li>
</ul>


<h3><a name="AddingnewlanguagetoadminconsoleUI-Localbuildandinstallation"></a>Local
build and installation</h3>

<p>From inside the directory where you have checked out the sources:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
$ mvn -PskipTests
</pre>
</div></div>

<h3><a name="AddingnewlanguagetoadminconsoleUI-AddsupportintheJavacode"></a>Add
support in the Java code</h3>

<p>You need to change the following List in SyncopeSession (<a href="https://svn.apache.org/repos/asf/syncope/trunk/console/src/main/java/org/apache/syncope/console/SyncopeSession.java"
class="external-link" rel="nofollow">trunk</a> / <a href="https://svn.apache.org/repos/asf/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/SyncopeSession.java"
class="external-link" rel="nofollow">1_0_X</a>) from</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    <span class="code-keyword">public</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> List&lt;Locale&gt; SUPPORTED_LOCALES
= Arrays.asList(<span class="code-keyword">new</span> Locale[] {
        Locale.ENGLISH, Locale.ITALIAN});
</pre>
</div></div>
<p>to</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    <span class="code-keyword">public</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> List&lt;Locale&gt; SUPPORTED_LOCALES
= Arrays.asList(<span class="code-keyword">new</span> Locale[] {
        Locale.ENGLISH, Locale.ITALIAN, Locale.FRENCH});
</pre>
</div></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>If your language is not in the
default Java set of locale constants, it is possible to add it as shown below for Brazilian
Portuguese:

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    <span class="code-keyword">public</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> List&lt;Locale&gt; SUPPORTED_LOCALES
= Arrays.asList(<span class="code-keyword">new</span> Locale[] {
        Locale.ENGLISH, Locale.ITALIAN, Locale.forLanguageTag(<span class="code-quote">"pt-BR"</span>)
});
</pre>
</div></div></td></tr></table></div>  

<h3><a name="AddingnewlanguagetoadminconsoleUI-Addactualtranslations"></a>Add
actual translations</h3>

<p>The admin console is a plain Apache Wicket web application, empowering Wicket's i18n
support: see <a href="/confluence/display/WICKET/Everything+about+Wicket+internationalization"
title="Everything about Wicket internationalization">all details</a> about this mechanism.</p>

<p>Basically, for each <tt>*_it.properties</tt> file found under <tt>console/src/main/resources/org/apache/syncope/console/</tt></p>
<ul>
	<li>copy it in the same place by adding <tt>_fr</tt> to file name (for
example, copy <tt>SyncopeApplication.properties</tt> into <tt>SyncopeApplication_fr.properties</tt></li>
	<li>edit the newly added files by translating all messages to French</li>
</ul>


<h3><a name="AddingnewlanguagetoadminconsoleUI-Checkthe%28partial%29result"></a>Check
the (partial) result</h3>

<p>In order to check if you are doing well, from inside the directory where you have
checked out the sources:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
$ cd console
$ mvn -Pdev
</pre>
</div></div>

<p>You should now be able to browse the admin console at <a href="http://localhost:9080/syncope-console/"
class="external-link" rel="nofollow">http://localhost:9080/syncope-console/</a>,
choose 'French' from the dropdown on the login form and see if the provided translation is
working.</p>

<h3><a name="AddingnewlanguagetoadminconsoleUI-Finalize"></a>Finalize</h3>

<p>Once done with latest two items above, you are ready to either commit your work or
file an issue on <a href="https://issues.apache.org/jira/browse/SYNCOPE" class="external-link"
rel="nofollow">JIRA</a> and <a href="http://syncope.apache.org/contributing.html"
class="external-link" rel="nofollow">attach a patch</a> there.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/SYNCOPE/Adding+new+language+to+admin+console+UI">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=30759289&revisedVersion=4&originalVersion=3">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/SYNCOPE/Adding+new+language+to+admin+console+UI?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message