Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge branch 'string-i18n' into integration/master
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Apr 11, 2013
2 parents 6a2372a + 5002c06 commit db6c321
Show file tree
Hide file tree
Showing 65 changed files with 1,265 additions and 852 deletions.
11 changes: 11 additions & 0 deletions zanata-war/pom.xml
Expand Up @@ -52,6 +52,17 @@
</resources>

<plugins>
<plugin>
<groupId>org.zanata</groupId>
<artifactId>zanata-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<srcDir>src</srcDir>
<transDir>src</transDir>
<!-- only one translation file has been prepared so far -->
<includes>main/resources/messages.properties</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
Expand Down
Expand Up @@ -135,6 +135,7 @@ public void joinTribe()
languageTeamServiceImpl.joinLanguageTeam(this.language, authenticatedAccount.getPerson().getId());
Events.instance().raiseEvent("personJoinedTribe");
log.info("{0} joined tribe {1}", authenticatedAccount.getUsername(), this.language);
// FIXME use localizable string
FacesMessages.instance().add("You are now a member of the {0} language team", getLocale().retrieveNativeName());
}
catch (Exception e)
Expand Down
2 changes: 1 addition & 1 deletion zanata-war/src/main/java/org/zanata/action/UserAction.java
Expand Up @@ -148,7 +148,7 @@ public String save()
}
else
{
FacesMessages.instance().addToControl("username", "Username '" + getUsername() + "' is not available");
FacesMessages.instance().addToControl("username", messages.get("jsf.UsernameNotAvailable"));
setUsername(originalUsername); // reset the username field
return "failure";
}
Expand Down
Expand Up @@ -400,6 +400,9 @@ public String getCopyTransEstimatedTimeLeft()
return formatTimePeriod(handle.getEstimatedTimeRemaining());
}

// FIXME this is not localizable
// Define 4 UI strings: completed by you, canceled by you, completed by [username], canceled by [username]
// OR define UI strings for each of completed/canceled, and another for 'you'
public String getCopyTransStatusMessage()
{
if (!isCopyTransRunning())
Expand Down
Expand Up @@ -88,6 +88,7 @@ public String getConfigurationFileContents(String projectSlug, String iterationS
var.append(" <project-version>").append(iterationSlug).append("</project-version>\n");
if (useOfflinePo)
{
// FIXME this comment could be localized
var.append(" <!-- NB project-type set to 'offlinepo' to allow offline po translation\n")
.append(" from non-po documents, project-type on server is '")
.append(String.valueOf(projectType).toLowerCase()).append("' -->\n")
Expand All @@ -97,6 +98,7 @@ else if ( projectType != null )
{
if( projectType == ProjectType.Gettext )
{
// FIXME this comment could be localized
var.append(" <!-- NB project-type set to 'podir' to allow uploads, but original was 'gettext' -->\n");
var.append(" <project-type>").append(ProjectType.Podir.toString().toLowerCase()).append("</project-type>\n");
}
Expand Down
Expand Up @@ -83,9 +83,8 @@ public String sendActivationEmail(String emailTemplate, String toName, String to

log.info("Sent activation account email: toName '{0}', toEmailAddress '{1}'", toName, toEmailAddr);
return "#{messages['jsf.Account.ActivationMessage']}";

}

@Override
public String sendToLanguageCoordinators(String emailTemplate, List<HPerson> coordinators, String fromName, String fromLoginName, String replyEmail, String subject, String message, String language)
{
Expand Down Expand Up @@ -206,7 +205,7 @@ public String getReceivedReason()
{
return receivedReason;
}

public String getActivationKey()
{
return activationKey;
Expand Down
1,436 changes: 862 additions & 574 deletions zanata-war/src/main/resources/messages.properties

Large diffs are not rendered by default.

Expand Up @@ -6,21 +6,21 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{messages['jsf.email.activation.register.Name']}" />
<ui:param name="toEmailAddr" value="#{emailServiceImpl.toEmailAddr}" />
<ui:param name="subject" value="#{messages['jsf.email.activation.Subject']}" />

<ui:define name="body">
<p>#{messages['jsf.email.activation.register.DearName']}</p>
<p>#{messages['jsf.email.activation.ClickLinkToActivateAccount']}</p>
<p>
<a href="#{applicationConfiguration.serverPath}/account/activate/#{emailServiceImpl.activationKey}">
#{messages['jsf.email.activation.Link']}
#{messages['jsf.email.activation.Link']}
</a>
</p>
<p>

<p>
#{messages['jsf.email.alternate.copyPasteMessage']}
</p>
<p>
Expand All @@ -32,5 +32,5 @@
#{messages['jsf.UrlExpireMessage']}
</p>
</ui:define>

</ui:composition>
Expand Up @@ -6,11 +6,11 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{messages['jsf.email.activation.profile.Name']}" />
<ui:param name="toEmailAddr" value="#{profileAction.email}" />
<ui:param name="subject" value="#{messages['jsf.email.activation.Subject']}" />

<ui:define name="body">
<p>#{messages['jsf.email.activation.profile.DearName']}</p>
<p>#{messages['jsf.email.activation.ClickLinkToActivateAccount']}</p>
Expand All @@ -19,8 +19,8 @@
#{messages['jsf.email.activation.Link']}
</a>
</p>
<p>

<p>
#{messages['jsf.email.alternate.copyPasteMessage']}
</p>
<p>
Expand All @@ -32,5 +32,5 @@
#{messages['jsf.UrlExpireMessage']}
</p>
</ui:define>

</ui:composition>
Expand Up @@ -6,13 +6,13 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{emailServiceImpl.toName}" />
<ui:param name="toEmailAddr" value="#{emailServiceImpl.toEmailAddr}" />
<ui:param name="replyToName" value="#{sendEmail.fromName}" />
<ui:param name="replyToEmail" value="#{sendEmail.replyEmail}" />
<ui:param name="subject" value="#{messages['jsf.email.admin.SubjectPrefix']} #{sendEmail.subject}" />

<ui:define name="body">
<p>#{messages['jsf.email.admin.DearAdmin']}</p>
<p>#{messages['jsf.email.admin.UserMessageIntro']}</p>
Expand All @@ -21,5 +21,5 @@
<hr/>
<p>#{messages['jsf.email.ReplyInstructions']}</p>
</ui:define>

</ui:composition>
Expand Up @@ -6,13 +6,13 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{emailServiceImpl.toName}" />
<ui:param name="toEmailAddr" value="#{emailServiceImpl.toEmailAddr}" />
<ui:param name="replyToName" value="#{sendEmail.fromName}" />
<ui:param name="replyToEmail" value="#{sendEmail.replyEmail}" />
<ui:param name="subject" value="#{messages['jsf.email.coordinator.SubjectPrefix']} #{sendEmail.subject}" />

<ui:define name="body">
<p>#{messages['jsf.email.coordinator.DearCoordinator']}</p>
<p>#{messages['jsf.email.coordinator.UserMessageIntro']}</p>
Expand All @@ -26,5 +26,5 @@
</a>
</p>
</ui:define>

</ui:composition>
Expand Up @@ -6,13 +6,13 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{emailServiceImpl.toName}" />
<ui:param name="toEmailAddr" value="#{emailServiceImpl.toEmailAddr}" />
<ui:param name="replyToName" value="#{sendEmail.fromName}" />
<ui:param name="replyToEmail" value="#{sendEmail.replyEmail}" />
<ui:param name="subject" value="#{messages['jsf.email.joinrequest.Subject']}" />

<ui:define name="body">
<p>#{messages['jsf.email.coordinator.DearCoordinator']}</p>
<p>#{messages['jsf.email.joinrequest.UserRequestingToJoin']}</p>
Expand All @@ -30,5 +30,5 @@
</a>
</p>
</ui:define>

</ui:composition>
Expand Up @@ -6,13 +6,13 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{emailServiceImpl.toName}" />
<ui:param name="toEmailAddr" value="#{emailServiceImpl.toEmailAddr}" />
<ui:param name="replyToName" value="#{sendEmail.fromName}" />
<ui:param name="replyToEmail" value="#{sendEmail.replyEmail}" />
<ui:param name="subject" value="#{messages['jsf.email.joingrouprequest.Subject']}" />

<ui:define name="body">
<p>#{messages['jsf.email.maintainer.DearMaintainer']}</p>
<p>#{messages['jsf.email.joingrouprequest.RequestingToJoinGroup']}</p>
Expand All @@ -25,12 +25,11 @@

<p> #{messages['jsf.email.joingrouprequest.ResponseInstructions']}</p>


<p>
<a href="#{applicationConfiguration.serverPath}/version-group/view/#{versionGroupJoinAction.query}">
#{applicationConfiguration.serverPath}/version-group/view/#{versionGroupJoinAction.query}
</a>
</p>
</ui:define>

</ui:composition>
Expand Up @@ -6,7 +6,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{messages['jsf.email.accountchange.Name']}" />
<ui:param name="toEmailAddr" value="#{profileAction.email}" />
<ui:param name="subject" value="#{messages['jsf.email.accountchange.Subject']}" />
Expand All @@ -19,8 +19,8 @@
#{messages['jsf.email.accountchange.ConfirmationLink']}
</a>
</p>
<p>

<p>
#{messages['jsf.email.alternate.copyPasteMessage']}
</p>
<p>
Expand All @@ -31,7 +31,7 @@
#{applicationConfiguration.serverPath}/account/validate_email/#{profileAction.activationKey}
</a>
</p>

</ui:define>

</ui:composition>
Expand Up @@ -6,11 +6,11 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
template="/WEB-INF/facelets/email/template_email.xhtml">

<ui:param name="toName" value="#{messages['jsf.email.passwordreset.Name']}" />
<ui:param name="toEmailAddr" value="#{passwordResetRequest.account.person.email}" />
<ui:param name="subject" value="#{messages['jsf.email.passwordreset.Subject']}" />

<ui:define name="body">
<p>#{messages['jsf.email.passwordreset.DearName']}</p>
<p>#{messages['jsf.email.passwordreset.FollowLinkToResetPassword']}</p>
Expand All @@ -21,5 +21,5 @@
</a>
</p>
</ui:define>

</ui:composition>
Expand Up @@ -5,7 +5,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:rich="http://richfaces.org/rich">

<h:form>
<s:link view="/home.xhtml" propagation="none" rendered="#{not empty breadcrumbs.locations}" styleClass="breadcrumbs_home">
<span class="icon-home-1" title="#{messages['jsf.ZanataMainDescription']}"/>
Expand Down
Expand Up @@ -65,6 +65,9 @@
<h:outputText>#{messages['jsf.login.openid.SelectProvider']}</h:outputText>
<br/>
<br/>
<ui:remove>
<!-- TODO use localizable strings for tooltips. -->
</ui:remove>
<rich:spacer height="10"/>
<h:graphicImage id="fedora_signin" value="../images/openid/fedora.png" styleClass="login_option"
title="Fedora"
Expand Down
Expand Up @@ -136,7 +136,7 @@

<s:div>
<a4j:region>
<h:selectBooleanCheckbox title="Restrict Project Access" value="#{projectRoleRestrictionAction.restrictByRoles}" >
<h:selectBooleanCheckbox title="#{messages['jsf.RestrictRoleAccessTooltip']}" value="#{projectRoleRestrictionAction.restrictByRoles}" >
<a4j:support event="onchange" reRender="roleList" />
</h:selectBooleanCheckbox>
</a4j:region>
Expand Down
Expand Up @@ -17,7 +17,7 @@
<s:selectItems value="#{roleAssignmentRuleAction.availablePolicyNames}" var="policy" label="#{policy}"
noSelectionLabel=""/>
</h:selectOneMenu>

<s:span styleClass="icon-info-circle-2 input_help" id="policyNameHelp">
<rich:toolTip>
<em>#{messages['jsf.rolerules.PolicyName.tooltip']}</em>
Expand All @@ -32,7 +32,7 @@
<rich:toolTip>
<em>#{messages['jsf.rolerules.IdentityPattern.tooltip']}</em>
</rich:toolTip>
</s:span>
</s:span>
</s:decorate>
<s:decorate id="roleField" template="/WEB-INF/layout/edit.xhtml">
<ui:define name="label">#{messages['jsf.rolerules.RoleToAssign']}</ui:define>
Expand Down
20 changes: 14 additions & 6 deletions zanata-war/src/main/webapp/WEB-INF/layout/statsbar.xhtml
Expand Up @@ -8,30 +8,38 @@
<ui:param name="translated" value="#{status.translated}" />
<ui:param name="fuzzy" value="#{status.needReview}" />
<ui:param name="untranslated" value="#{status.untranslated}" />

<ui:param name="total" value="#{status.total}" />

<ui:param name="wTranslated" value="#{total == 0 ? 0 : 110 * translated / total}" />
<ui:param name="wUntranslated" value="#{total == 0 ? 0 : 110 * untranslated / total}" />
<ui:param name="wFuzzy" value="#{total == 0 ? 0 : 110 * fuzzy / total}" />

<s:fragment rendered="#{status.total > 0}">
<div title="Total: #{status.total}, Translated: #{status.translated}, Need Review: #{status.needReview}" class="translationStatusDiv">
<ui:remove>
<!-- FIXME this string should be localized as a whole, but stats values are not inserted
properly when it is used as-is in a message string. Similar for the hours suffix below
This can probably be done like this http://blog.lunatech.com/2009/05/12/localised-attribute-values-jsf-and-seam
using either params or their other method
-->
</ui:remove>
<div title="#{messages['jsf.stats.Total']} #{status.total}, #{messages['jsf.stats.Translated']} #{status.translated}, #{messages['jsf.stats.NeedReview']} #{status.needReview}" class="translationStatusDiv">
<div class="translationStatusBar statusBar_approved" style="width:#{wTranslated}px;"></div>
<div class="translationStatusBar statusBar_needReview" style="width:#{wFuzzy}px;"></div>
<div class="translationStatusBar statusBar_untranslated" style="width:#{wUntranslated}px;"></div>

<span class="statusBar_percentage">
<h:outputText value="#{status.percentTranslated/100}" rendered="#{status.total > 0}">
<f:convertNumber type="percent" />
</h:outputText>
(<h:outputText value="#{status.remainingHours}">
<f:convertNumber maxFractionDigits="1"/>
</h:outputText>hrs)
</h:outputText>#{messages['jsf.stats.ShortHoursSuffix']})
</span>
</div>
</s:fragment>

<s:fragment rendered="#{status.total eq 0}">
<div class="statusBar_noContent">
<h:outputText value="#{messages['jsf.NoContent']}"/>
Expand Down
Expand Up @@ -37,7 +37,7 @@
<h:inputText id="description" required="false"
value="#{versionGroupHome.instance.description}" style="width:400px;"/>
</s:decorate>

<s:decorate id="statusField" template="edit.xhtml">
<ui:define name="label">#{messages['jsf.Status']}</ui:define>
<h:selectOneMenu value="#{versionGroupHome.instance.status}">
Expand Down

0 comments on commit db6c321

Please sign in to comment.