Java Code Examples for org.springframework.extensions.surf.util.I18NUtil#registerResourceBundle()
The following examples show how to use
org.springframework.extensions.surf.util.I18NUtil#registerResourceBundle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DictionaryDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Before public void setUp() throws Exception { // register resource bundles for messages I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES); // Instantiate Dictionary Service TenantService tenantService = new MultiTServiceImpl(); this.dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO, tenantService); new AuthenticationUtil().afterPropertiesSet(); // Populate with appropriate models DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add("alfresco/model/systemModel.xml"); bootstrapModels.add("alfresco/model/contentModel.xml"); List<String> labels = new ArrayList<String>(); bootstrap.setModels(bootstrapModels); bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); DictionaryComponent component = new DictionaryComponent(); component.setDictionaryDAO(dictionaryDAO); component.setMessageLookup(new StaticMessageLookup()); service = component; }
Example 2
Source File: CopyServiceImplUnitTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Before public void setup() { I18NUtil.registerResourceBundle("alfresco/messages/copy-service"); this.preservedLocale = I18NUtil.getLocale(); this.copyServiceImpl = new CopyServiceImpl(); }
Example 3
Source File: ResourceBundleBootstrapComponent.java From alfresco-core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Set the resource bundles to be registered. This should be a list of resource * bundle base names whose content will be made available across the repository. * * @param resourceBundles the resource bundles */ public void setResourceBundles(List<String> resourceBundles) { for (String resourceBundle : resourceBundles) { I18NUtil.registerResourceBundle(resourceBundle); } }
Example 4
Source File: DictionaryBootstrap.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
/** * Register the static resource bundles */ private void initStaticMessages() { // register messages for (String resourceBundle : resourceBundles) { I18NUtil.registerResourceBundle(resourceBundle); } }
Example 5
Source File: DictionaryDAOTest.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Before public void setUp() throws Exception { // register resource bundles for messages I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES); // Instantiate Dictionary Service TenantService tenantService = new SingleTServiceImpl(); this.dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO, tenantService); // Populate with appropriate models DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add(TEST_MODEL); List<String> labels = new ArrayList<String>(); labels.add(TEST_BUNDLE); bootstrap.setModels(bootstrapModels); bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); DictionaryComponent component = new DictionaryComponent(); component.setDictionaryDAO(dictionaryDAO); component.setMessageLookup(new StaticMessageLookup()); service = component; }
Example 6
Source File: RepoDictionaryDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void setUp() throws Exception { // Registered the required constraints ConstraintRegistry constraintRegistry = ConstraintRegistry.getInstance(); AbstractConstraint constraintReg1 = new UserNameConstraint(); constraintReg1.setShortName("cm:reg1"); constraintReg1.setRegistry(constraintRegistry); constraintReg1.initialize(); AbstractConstraint constraintReg2 = new UserNameConstraint(); constraintReg2.setShortName("cm:reg2"); constraintReg2.setRegistry(constraintRegistry); constraintReg2.initialize(); // register resource bundles for messages I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES); // Instantiate Dictionary Service TenantService tenantService = new SingleTServiceImpl(); DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); initDictionaryCaches(dictionaryDAO, tenantService); // Populate with appropriate models DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add(TEST_MODEL); List<String> labels = new ArrayList<String>(); labels.add(TEST_BUNDLE); bootstrap.setModels(bootstrapModels); bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); DictionaryComponent component = new DictionaryComponent(); component.setDictionaryDAO(dictionaryDAO); component.setMessageLookup(new StaticMessageLookup()); service = component; }
Example 7
Source File: DictionaryLoadDAOTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Before public void setUp() throws Exception { // register resource bundles for messages I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES); // Instantiate Dictionary Service TenantService tenantService = new MultiTServiceImpl(); this.dictionaryDAO = new DictionaryDAOImpl(); dictionaryDAO.setTenantService(tenantService); // TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() // { // @Override // public Void doWork() throws Exception // { // dictionaryDAO.init(); // return null; // } // }, "user1", "tenant1"); initDictionaryCaches(dictionaryDAO, tenantService); new AuthenticationUtil().afterPropertiesSet(); // Populate with appropriate models DictionaryBootstrap bootstrap = new DictionaryBootstrap(); List<String> bootstrapModels = new ArrayList<String>(); bootstrapModels.add("alfresco/model/dictionaryModel.xml"); bootstrapModels.add("alfresco/model/systemModel.xml"); bootstrapModels.add("alfresco/model/contentModel.xml"); bootstrapModels.add("org/alfresco/repo/security/authentication/userModel.xml"); bootstrapModels.add("alfresco/model/bpmModel.xml"); bootstrapModels.add("alfresco/model/wcmModel.xml"); bootstrapModels.add("alfresco/model/forumModel.xml"); bootstrapModels.add("alfresco/model/imapModel.xml"); bootstrapModels.add("alfresco/model/transferModel.xml"); bootstrapModels.add("alfresco/model/applicationModel.xml"); bootstrapModels.add("alfresco/model/wcmAppModel.xml"); bootstrapModels.add("org/alfresco/repo/action/actionModel.xml"); bootstrapModels.add("org/alfresco/repo/rule/ruleModel.xml"); bootstrapModels.add("org/alfresco/repo/version/version_model.xml"); bootstrapModels.add("org/alfresco/repo/version/version2_model.xml"); bootstrapModels.add("alfresco/model/emailServerModel.xml"); bootstrapModels.add("alfresco/model/calendarModel.xml"); bootstrapModels.add("alfresco/model/deprecated/blogIntegrationModel.xml"); bootstrapModels.add("alfresco/model/linksModel.xml"); bootstrapModels.add("alfresco/model/remoteCredentialsModel.xml"); bootstrapModels.add("alfresco/model/datalistModel.xml"); bootstrapModels.add("alfresco/model/quickShareModel.xml"); bootstrapModels.add("alfresco/model/surfModel.xml"); bootstrapModels.add("alfresco/model/siteModel.xml"); List<String> labels = new ArrayList<String>(); bootstrap.setModels(bootstrapModels); bootstrap.setLabels(labels); bootstrap.setDictionaryDAO(dictionaryDAO); bootstrap.setTenantService(tenantService); bootstrap.bootstrap(); }
Example 8
Source File: ValidationResultTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Before public void setUp() { I18NUtil.registerResourceBundle("alfresco.messages.system-messages"); }
Example 9
Source File: DifferenceTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Before public void setUp() { I18NUtil.registerResourceBundle("alfresco.messages.system-messages"); }
Example 10
Source File: RedundantDbObjectTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Before public void setUp() { I18NUtil.registerResourceBundle("alfresco.messages.system-messages"); }
Example 11
Source File: AlfrescoRuntimeExceptionTest.java From alfresco-core with GNU Lesser General Public License v3.0 | 4 votes |
public void testI18NBehaviour() { // Ensure that the bundle is present on the classpath String baseResourceAsProperty = BASE_RESOURCE_NAME.replace('.', '/') + ".properties"; URL baseResourceURL = AlfrescoRuntimeExceptionTest.class.getClassLoader().getResource(baseResourceAsProperty); assertNotNull(baseResourceURL); baseResourceAsProperty = BASE_RESOURCE_NAME.replace('.', '/') + "_fr_FR" + ".properties"; baseResourceURL = AlfrescoRuntimeExceptionTest.class.getClassLoader().getResource(baseResourceAsProperty); assertNotNull(baseResourceURL); // Ensure we can load it as a resource bundle ResourceBundle properties = ResourceBundle.getBundle(BASE_RESOURCE_NAME); assertNotNull(properties); properties = ResourceBundle.getBundle(BASE_RESOURCE_NAME, new Locale("fr", "FR")); assertNotNull(properties); // From here on in, we use Spring // Register the bundle I18NUtil.registerResourceBundle(BASE_RESOURCE_NAME); AlfrescoRuntimeException exception1 = new AlfrescoRuntimeException(MSG_PARAMS, new Object[]{PARAM_VALUE}); assertTrue(exception1.getMessage().contains(VALUE_PARAMS)); AlfrescoRuntimeException exception3 = new AlfrescoRuntimeException(MSG_ERROR); assertTrue(exception3.getMessage().contains(VALUE_ERROR)); // Change the locale and re-test I18NUtil.setLocale(new Locale("fr", "FR")); AlfrescoRuntimeException exception2 = new AlfrescoRuntimeException(MSG_PARAMS, new Object[]{PARAM_VALUE}); assertTrue(exception2.getMessage().contains(VALUE_FR_PARAMS)); AlfrescoRuntimeException exception4 = new AlfrescoRuntimeException(MSG_ERROR); assertTrue(exception4.getMessage().contains(VALUE_FR_ERROR)); AlfrescoRuntimeException exception5 = new AlfrescoRuntimeException(NON_I18NED_MSG); assertTrue(exception5.getMessage().contains(NON_I18NED_MSG)); // MNT-13028 String param1 = PARAM_VALUE + "_1"; String param2 = PARAM_VALUE + "_2"; String param3 = PARAM_VALUE + "_3"; AlfrescoRuntimeException exception6 = new AlfrescoRuntimeException(NON_EXISTING_MSG, new Object[]{param1, param2, param3}); String message6 = exception6.getMessage(); assertTrue(message6.contains(NON_EXISTING_MSG)); assertTrue(message6.contains(param1)); assertTrue(message6.contains(param2)); assertTrue(message6.contains(param3)); }
Example 12
Source File: ConstraintsTest.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 4 votes |
@Override protected void setUp() throws Exception { // register resource bundles for messages I18NUtil.registerResourceBundle(DictionaryDAOTest.TEST_RESOURCE_MESSAGES); }