Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
RHBPMS-4553 - jBPM process designer is not using the language chosen …
Browse files Browse the repository at this point in the history
…in workbench settings (#549)
  • Loading branch information
Tihomir Surdilovic authored and manstis committed Feb 16, 2017
1 parent 6a94b07 commit 79147a2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
21 changes: 21 additions & 0 deletions jbpm-designer-api/pom.xml
Expand Up @@ -43,6 +43,26 @@

<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<executions>
<execution>
<id>copy-zanata-files</id>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<sourceFile>src/main/resources/org/jbpm/designer/resources/i18n/DesignerConstants.properties</sourceFile>
<destinationFile>src/main/resources/org/jbpm/designer/resources/i18n/DesignerConstants_en.properties</destinationFile>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -62,6 +82,7 @@
<configuration>
<includes>
<include>**/DesignerConstants.properties</include>
<include>**/DesignerConstants_en.properties</include>
<include>**/DesignerConstants_de.properties</include>
<include>**/DesignerConstants_es.properties</include>
<include>**/DesignerConstants_fr.properties</include>
Expand Down
Expand Up @@ -62,29 +62,17 @@ private void setupInlineFrame() {
public void setEditorID( final String editorID ) {
this.editorID = editorID;
inlineFrame.getElement().setId(editorID);
inlineFrame.getElement().setAttribute("name", editorID);
inlineFrame.getElement().setAttribute("name",
editorID);
}

@Override
public void setEditorParamters( final Map<String, String> editorParameters ) {
this.editorParameters = editorParameters;
// fix locale if needed (for "default")
String locale = LocaleInfo.getCurrentLocale().getLocaleName();
/* if(locale == null) {
if(locale == null || locale.equals("default")) {
locale = "en";
} else {
if(locale.equals("default")) {
locale = "en";
}
if(locale.indexOf("_") > 0) {
locale = locale.split("_")[0]; // just use the language (ommit country and variant)
}
if(!(locale.equalsIgnoreCase("en") || locale.equalsIgnoreCase("ja"))) {
// we currently only support english and japanese. default to english
locale = "en";
}
}
*/
String paramsStr = "";
Iterator<String> paramsIter = this.editorParameters.keySet().iterator();
while ( paramsIter.hasNext() ) {
Expand All @@ -93,7 +81,8 @@ public void setEditorParamters( final Map<String, String> editorParameters ) {
}
// add timestamp to end of url for caching
paramsStr += "&ms=" + System.currentTimeMillis();
inlineFrame.getElement().setAttribute( "src", GWT.getModuleBaseURL() + "inlineeditor.jsp?locale=" + locale + paramsStr );
inlineFrame.getElement().setAttribute("src",
GWT.getModuleBaseURL() + "inlineeditor.jsp?locale=" + locale + paramsStr );
}

@Override
Expand Down
@@ -1,19 +1,13 @@
<%@ page import="java.util.Locale" %>
<%@ page import="org.apache.commons.lang3.LocaleUtils" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/i18n-1.0" prefix="i18n" %>
<%
Locale locale= request.getLocale();
try{
String localeStr=request.getParameter("locale");
if(localeStr!= null && localeStr.length()==2){
locale = new Locale(request.getParameter("locale"));
}else if(localeStr!= null && localeStr.length()==5){
locale = new Locale(localeStr.substring(0,2),localeStr.substring(3));
}
} catch(Exception e){
}
Locale locale= null;
try{
locale = LocaleUtils.toLocale( request.getParameter( "locale" ) );
} catch(Exception e){
locale= request.getLocale();
}
%>
<i18n:bundle id="bundle" baseName="org.jbpm.designer.resources.i18n.DesignerConstants"
locale='<%= locale%>' />
Expand Down

0 comments on commit 79147a2

Please sign in to comment.