Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

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

Inactive Publication Date: 2017-03-08
ZHENGZHOU YUNHAI INFORMATION TECH CO LTD
View PDF2 Cites 5 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] SpringMVC provides a very powerful container management function, and also provides users with a method of internationalizing resources, but the general method is difficult to apply to all scenarios

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Examples

Experimental program
Comparison scheme
Effect test

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] .

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for configuring internationalized resource files applicable to a wildcard character mode. The method includes that a new class is written in Spring MVC to inherit a Resource Bundle Message Source class of the Spring MVC, a locations attribute is added and then is converted into a baseName attribute in a set Locations method, value transfer to a parent class is achieved, and wildcard character mode adaptation can be achieved accordingly. The method has the advantages that the Spring MVC internationalized resource files can enable spring to read all resources under specific paths without manual one-by-one addition, so that development and maintenance of codes are facilitated.

Description

technical field [0001] The invention relates to the technical field of computer software applications, in particular to a configuration method of an internationalized resource file applicable to a wildcard pattern, and a configuration method of a SpringMVC internationalized resource file applicable to a wildcard pattern. Background technique [0002] Spring MVC is a follow-up product of SpringFrameWork, which has been integrated into Spring Web Flow. The Spring Framework provides a full-featured MVC module for building web applications. Using Spring's pluggable MVC architecture, you can choose to use the built-in Spring Web framework or a Web framework such as Struts. [0003] Spring MVC is one of the most important modules of the Spring Framework. It is based on the powerful Spring IoC container, and makes full use of the characteristics of the container to simplify its configuration. [0004] Model-View-Controller (MVC) is a well-known design pattern based on designing ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/44
CPCG06F8/315
Inventor 宁升蔡卫卫
Owner ZHENGZHOU YUNHAI INFORMATION TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products