Method for configuring internationalized resource files applicable to wildcard character mode
A technology of resource files and configuration methods, which is applied in the direction of program control devices, software engineering design, instruments, etc., can solve the problem that the method is difficult to apply to all scenarios, and achieve the effect of convenient development and maintenance
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Examples
Embodiment 1
[0048] A configuration method for an internationalized resource file applicable to wildcard patterns, characterized in that the method inherits from the ResourceBundleMessageSource class of springMVC by writing a new class in springMVC, and adds the locations attribute, and then sets the location attribute in the setLocations method Convert it to the baseName attribute and pass the value to the parent class, so that wildcard pattern adaptation can be realized.
Embodiment 2
[0050] On the basis of Embodiment 1, the relevant codes of the method described in this embodiment are as follows:
[0051] public class ResourceBundleMessageSource extends
[0052] org.springframework.context.support.ResourceBundleMessageSource {
[0053] private Resource[] locations;
[0054] / **
[0055] * @param locations the locations to set
[0056] * /
[0057] public void setLocations(Resource[] locations) {
[0058] this. locations = locations;
[0059] list bns = new ArrayList();
[0060] for(int i=0;i
[0061] String filePath = locations[i].getURL().getFile().split(" / WEB-INF / classes")[1];
[0062] String baseName = "i18n / " + filePath. substring(0, filePath. length() - 14);
[0063] if (!bns. contains(baseName)) {
[0064] bns.add(baseName);
[0065] }
[0066] }
[0067] String[] basenames = new String[bns. size()];
[0068] for (int j = 0; j < bns. size(); j++) {
[0069] basenames[j] = bns. g...
Embodiment 3
[0075] On the basis of embodiment 2, the configuration file adopted by the method described in this embodiment is as follows:
[0076]
[0077]
[0078]
[0079] classpath*: / i18n / *
[0080]
[0081]
[0082]
[0083]
[0084] .
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com