Various translations for RM-183

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55749 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2013-09-20 14:12:37 +00:00
parent b07a02b421
commit 8a416b01a9
8 changed files with 26 additions and 13 deletions

View File

@@ -110,15 +110,6 @@
</bean> </bean>
<!-- Event types --> <!-- Event types -->
<bean id="rmEventResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.module.org_alfresco_module_rm.messages.rm-events</value>
</list>
</property>
</bean>
<bean id="rmEventType" init-method="init" abstract="true"> <bean id="rmEventType" init-method="init" abstract="true">
<property name="recordsManagementEventService" ref="recordsManagementEventService"/> <property name="recordsManagementEventService" ref="recordsManagementEventService"/>
</bean> </bean>

View File

@@ -4,7 +4,7 @@
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
{ {
"eventName": "${event.name}", "eventName": "${event.name}",
"eventDisplayLabel": "${msg(event.displayLabel)}", "eventDisplayLabel": "${event.displayLabel}",
"eventType":"${event.type}" "eventType":"${event.type}"
} }
</#escape> </#escape>

View File

@@ -3,7 +3,7 @@
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
{ {
"name": "${role.name}", "name": "${role.name}",
"displayLabel": "${msg(role.displayLabel)}", "displayLabel": "${role.displayLabel}",
"capabilities": "capabilities":
{ {
<#list role.capabilities as capability> <#list role.capabilities as capability>

View File

@@ -36,6 +36,7 @@ import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Records management event service implementation * Records management event service implementation
@@ -297,8 +298,12 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
// Get the details of the event // Get the details of the event
String eventType = eventJSON.getString("eventType"); String eventType = eventJSON.getString("eventType");
String eventName = eventJSON.getString("eventName"); String eventName = eventJSON.getString("eventName");
String eventDisplayLabel = eventJSON.getString("eventDisplayLabel");
String eventDisplayLabel = eventJSON.getString("eventDisplayLabel");
String translated = I18NUtil.getMessage(eventDisplayLabel);
if (translated!=null ) eventDisplayLabel = translated;
// Check that the eventType is valid // Check that the eventType is valid
if (eventTypes.containsKey(eventType) == false) if (eventTypes.containsKey(eventType) == false)
{ {

View File

@@ -518,6 +518,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
String groupShortName = authorityService.getShortName(roleAuthority); String groupShortName = authorityService.getShortName(roleAuthority);
String name = getShortRoleName(groupShortName, rmRootNode); String name = getShortRoleName(groupShortName, rmRootNode);
String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority);
String translated = I18NUtil.getMessage(displayLabel);
if (translated!=null ) displayLabel = translated;
Set<Capability> capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); Set<Capability> capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority);
Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName);
@@ -559,6 +561,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
String groupShortName = authorityService.getShortName(roleAuthority); String groupShortName = authorityService.getShortName(roleAuthority);
String name = getShortRoleName(groupShortName, rmRootNode); String name = getShortRoleName(groupShortName, rmRootNode);
String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority);
String translated = I18NUtil.getMessage(displayLabel);
if (translated!=null ) displayLabel = translated;
Set<Capability> capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); Set<Capability> capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority);
Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName);

View File

@@ -24,6 +24,7 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Saved search details. * Saved search details.
@@ -139,6 +140,8 @@ public class SavedSearchDetails extends ReportDetails
if (search.has(DESCRIPTION) == true) if (search.has(DESCRIPTION) == true)
{ {
description = search.getString(DESCRIPTION); description = search.getString(DESCRIPTION);
String translated = I18NUtil.getMessage(description);
if (translated!=null ) description = translated;
} }
// Get the query // Get the query

View File

@@ -365,7 +365,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
assertEquals(1, events.length()); assertEquals(1, events.length());
JSONObject event1 = events.getJSONObject(0); JSONObject event1 = events.getJSONObject(0);
assertEquals("case_closed", event1.get("name")); assertEquals("case_closed", event1.get("name"));
assertEquals("rmevent.case_closed", event1.get("label")); assertEquals("Case Closed", event1.get("label"));
assertFalse(event1.getBoolean("complete")); assertFalse(event1.getBoolean("complete"));
assertFalse(event1.getBoolean("automatic")); assertFalse(event1.getBoolean("automatic"));

View File

@@ -64,10 +64,14 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase
{ {
String role1 = GUID.generate(); String role1 = GUID.generate();
String role2 = GUID.generate(); String role2 = GUID.generate();
String role3 = GUID.generate();
// Create a couple or roles by hand // Create a couple or roles by hand
filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5));
filePlanRoleService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5));
//The user can either enter a plain text label or a key to look up in a property file.
filePlanRoleService.createRole(filePlan, role3, "bootstrap.rmadmin.lastName", getListOfCapabilities(5));
// create test group // create test group
String groupName = GUID.generate(); String groupName = GUID.generate();
@@ -98,6 +102,12 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase
assertEquals(role2, roleObj.get("name")); assertEquals(role2, roleObj.get("name"));
assertEquals("My Test Role Too", roleObj.get("displayLabel")); assertEquals("My Test Role Too", roleObj.get("displayLabel"));
checkCapabilities(roleObj, 5); checkCapabilities(roleObj, 5);
//Custom role with a user entered message key
roleObj = roles.getJSONObject(role3);
assertNotNull(roleObj);
assertEquals(role3, roleObj.get("name"));
assertEquals("System Administrator", roleObj.get("displayLabel"));
// Get the roles, specifying the file plan // Get the roles, specifying the file plan
rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan()),200); rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan()),200);