CN114489839B - Method and device for loading configuration data on page and server - Google Patents

Method and device for loading configuration data on page and server Download PDF

Info

Publication number
CN114489839B
CN114489839B CN202210033650.0A CN202210033650A CN114489839B CN 114489839 B CN114489839 B CN 114489839B CN 202210033650 A CN202210033650 A CN 202210033650A CN 114489839 B CN114489839 B CN 114489839B
Authority
CN
China
Prior art keywords
page
key
language configuration
directory
language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210033650.0A
Other languages
Chinese (zh)
Other versions
CN114489839A (en
Inventor
马兴国
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hainan Chezhiyi Communication Information Technology Co ltd
Original Assignee
Hainan Chezhiyi Communication Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hainan Chezhiyi Communication Information Technology Co ltd filed Critical Hainan Chezhiyi Communication Information Technology Co ltd
Priority to CN202210033650.0A priority Critical patent/CN114489839B/en
Publication of CN114489839A publication Critical patent/CN114489839A/en
Application granted granted Critical
Publication of CN114489839B publication Critical patent/CN114489839B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method and a device for loading configuration data for pages, a server, a computing device and a readable storage medium. The method comprises the following steps: performing directory search processing on keys of the language configuration file contained in the analysis function, and searching an upward directory of the keys of the language configuration file; translating the catalog search symbol into a catalog name, processing the content contained in the analytic function to generate a unique character string, taking a preset number of characters in the character string, and renaming the key; traversing the dependent file of the page, if the dependent file contains the renamed key name, attributing the key value corresponding to the key under the page, and generating the corresponding relation between each page and the language configuration file represented by the renamed key name; and searching the language configuration file represented by the renamed key name according to the corresponding relation and adding the language configuration file to a page. According to the technical scheme of the invention, the directory hierarchy naming can be automatically carried out, encryption processing can be carried out, the security is improved, and the on-demand quotation is realized.

Description

Method and device for loading configuration data on page and server
Technical Field
The present invention relates to the field of page display, and in particular, to a method and apparatus for loading configuration data for a page, a server, a computing device, and a readable storage medium.
Background
In the development process of internationalization multi-language, a large number of documents are generally required to be configured according to different languages or countries, on one hand, an efficient configuration scheme is selected to improve development efficiency, on the other hand, on-demand quotation of configuration is realized, and further user access experience is improved.
One common practice is: the method adopts a hard coding mode to configure multiple languages in service logic. When the user accesses, the corresponding content is acquired and displayed through different language identifiers. This solution has the following drawbacks: according to the method, the multi-language configuration is packaged into the same file, and can not be cited as required, so that the file volume is increased, and the page access speed is reduced. In addition, the coupling degree of the multi-language configuration and the service codes is high, and the reusability is reduced; the configuration is scattered in each business code file, which is unfavorable for the later maintenance.
Another way is: the multi-language text used in the service is manually configured into an independent JSON or JS file by adopting a global introduction mode, and in order to ensure the uniqueness of the ID, the ID is named as a longer character string. The disadvantage of this solution is: wherein, checking the uniqueness of ID naming by manual work results in low development efficiency and easy naming conflict; the defined ID is too long, is not easy to view, and is easy to make mistakes in use; in addition, the multiple languages are configured in the same file, and can not be cited as required, so that the page access speed is reduced.
Disclosure of Invention
To this end, the present invention provides a method and apparatus, server and computing device, readable storage medium for loading configuration data for pages in an effort to solve or at least alleviate at least one of the problems presented above.
According to one aspect of the present invention, there is provided a method for loading configuration data for a page, comprising: executing directory retrieval processing on keys of a language configuration file contained in an analysis function through directory retrieval symbols, and searching an upward directory of the keys of the language configuration file, wherein the analysis function is packaged in advance, the directory retrieval symbols and the keys of the language configuration file are contained, the language configuration file is defined by a user in advance, the keys of the attribute of the identification language configuration file and corresponding values are contained, and the values are used for identifying page display content corresponding to the language configuration file; translating the directory search symbol in the analytic function into the name of the searched directory, encrypting the content contained in the analytic function by using an encryption algorithm to generate a unique character string, taking a preset number of characters in the character string, and renaming the key; traversing all language configuration files to perform the key renaming operation; traversing the dependent file of the page, judging whether the dependent file contains the renamed key name, if so, attributing the key value corresponding to the key to the page, and generating the corresponding relation between each page and the language configuration file represented by the renamed key name in the mode; and searching the language configuration file represented by the renamed key name according to the corresponding relation aiming at the accessed page, and adding the language configuration file to the page in the form of a global variable.
According to another aspect of the present invention, there is provided a server storing a correspondence between each page generated according to the above method and a language profile represented by a renamed key name.
According to another aspect of the present invention, there is provided an apparatus for loading configuration data for a page, comprising: the search module is used for executing directory search processing on keys of the language configuration files contained in the analysis function through directory search symbols and searching for upward directories of the keys of the language configuration files, wherein the analysis function is packaged in advance and comprises the directory search symbols and the keys of the language configuration files, the language configuration files are defined by a user in advance and comprise keys for marking the attributes of the language configuration files and corresponding values, and the values are used for marking page display contents corresponding to the language configuration files; the naming module translates the catalog search symbol in the analytic function into the name of the searched catalog, encrypts the content contained in the analytic function by using an encryption algorithm to generate a unique character string, takes a preset number of characters in the character string and renames the keys; traversing all language configuration files to perform the key renaming operation; the page attribution module traverses the dependent file of the page, judges whether the dependent file contains renamed key names, if yes, attributions the key values corresponding to the keys to the page, and generates the corresponding relation between each page and the renamed language configuration file represented by the key names in the mode; and the additional module is used for searching the language configuration file represented by the renamed key name according to the corresponding relation aiming at the accessed page, and adding the language configuration file to the page in the form of a global variable.
According to yet another aspect of the present invention, there is provided a computing device comprising: at least one processor and a memory storing program instructions; the program instructions, when read and executed by the processor, cause the computing device to perform the method described above for page loading configuration data.
According to yet another aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the above-described method for page loading configuration data.
According to the technical scheme of the invention, the following steps can be realized: dynamically extracting and merging language configuration files without manual intervention, and integrating the configuration files defined in each business component; automatic directory hierarchy naming and encryption processing are carried out, naming conflict is avoided, and safety is improved; the configuration file is quoted according to the requirement, code redundancy is not generated, and the loading speed is improved.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention;
FIG. 2 illustrates a flow diagram of a method 200 for loading configuration data for a page, according to one embodiment of the invention.
FIG. 3 illustrates an exemplary diagram of keys and values of a language profile.
Fig. 4 shows an example of a file directory lattice generated at the server side.
FIG. 5 shows a schematic block diagram of an apparatus for loading configuration data for a page in accordance with an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Aiming at the problems that the existing page language configuration scheme can not refer to the language configuration file as required, the page access speed is low and the like, the invention provides a method for loading configuration data on a page, which can provide the capability of loading and using as required during the webpage access.
The method of the present invention for loading configuration data for a page is performed in a computing device. The computing device may be any device having storage and computing capabilities, and may be implemented, for example, as a server, a workstation, or the like, or may be implemented as a personal configured computer such as a desktop computer, a notebook computer, or may be implemented as a terminal device such as a mobile phone, a tablet computer, an intelligent wearable device, or an internet of things device, but is not limited thereto.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention. It should be noted that the computing device 100 shown in fig. 1 is only an example, and in practice, the computing device for implementing the method of the present invention may be any type of device, and the hardware configuration of the computing device may be the same as the computing device 100 shown in fig. 1 or may be different from the computing device 100 shown in fig. 1. In practice, a computing device for implementing the methods of the present invention may add or subtract hardware components of the computing device 100 illustrated in fig. 1, and the present invention is not limited to a specific hardware configuration of the computing device.
As shown in FIG. 1, in a basic configuration 102, a computing device 100 typically includes a system memory 106 and one or more processors 104. The memory bus 108 may be used for communication between the processor 104 and the system memory 106.
Depending on the desired configuration, the processor 104 may be any type of processing including, but not limited to: a microprocessor (μp), a microcontroller (μc), a digital information processor (DSP), or any combination thereof. The processor 104 may include one or more levels of caches, such as a first level cache 110 and a second level cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations, the memory controller 118 may be an internal part of the processor 104.
Depending on the desired configuration, system memory 106 may be any type of memory including, but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. Physical memory in a computing device is often referred to as volatile memory, RAM, and data in disk needs to be loaded into physical memory in order to be read by processor 104. The system memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some embodiments, the application 122 may be arranged to execute instructions on an operating system by the one or more processors 104 using the program data 124. The operating system 120 may be, for example, linux, windows or the like, which includes program instructions for handling basic system services and performing hardware-dependent tasks. The application 122 includes program instructions for implementing various functions desired by the user, and the application 122 may be, for example, a browser, instant messaging software, a software development tool (e.g., integrated development environment IDE, compiler, etc.), or the like, but is not limited thereto. When an application 122 is installed into computing device 100, a driver module may be added to operating system 120.
When the computing device 100 starts up running, the processor 104 reads the program instructions of the operating system 120 from the memory 106 and executes them. Applications 122 run on top of operating system 120, utilizing interfaces provided by operating system 120 and underlying hardware to implement various user-desired functions. When a user launches the application 122, the application 122 is loaded into the memory 106, and the processor 104 reads and executes the program instructions of the application 122 from the memory 106.
Computing device 100 also includes storage device 132, storage device 132 including removable storage 136 and non-removable storage 138, both removable storage 136 and non-removable storage 138 being connected to storage interface bus 134.
Computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to basic configuration 102 via bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via one or more communication ports 164 over a network communication link.
The network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media in a modulated data signal, such as a carrier wave or other transport mechanism. A "modulated data signal" may be a signal that has one or more of its data set or changed in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or special purpose network, and wireless media such as acoustic, radio Frequency (RF), microwave, infrared (IR) or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In computing device 100 according to the present invention, application 122 includes instructions for performing the method 200 of the present invention for page load configuration data that may instruct processor 104 to perform the method 200 of the present invention for page load configuration data to provide on-demand load usage capabilities at web page access by performing defined configuration at the page or component level, fetching, translating, splitting, merging, etc. at the code compilation stage.
FIG. 2 illustrates a flow diagram of a method 200 for loading configuration data for a page, according to one embodiment of the invention. The method 200 is performed in a computing device (e.g., the computing device 100 described previously). The detailed steps of method 200 are described below with reference to fig. 2, as shown in fig. 2, which includes:
step S210, performing directory retrieval processing on keys of the language configuration file contained in the analysis function through the directory retrieval symbol, and searching for an upward directory of the keys of the language configuration file, wherein the analysis function is packaged in advance, the directory retrieval symbol and the keys of the language configuration file are contained, the language configuration file is defined in advance by a user, the keys of the attribute of the identification language configuration file and corresponding values are contained, and the values are used for identifying page display contents corresponding to the language configuration file.
For example, the parsing function is named t_msg, and contains a directory search symbol, which may be "@" or any symbol other than "@". The parsing function also includes a key of a language profile, which is a parameter of the parsing function.
The keys of the language profile and their corresponding values are described below with reference to fig. 3.
The language profile is defined in the component as shown in fig. 3 as the de.json folder built under the i18n directory (in case of english in the page language, the built folder may be named en.json). Wherein the component is a simple package of data and methods. The language profile may be named according to country or language (in the example of fig. 3, naming is done in language), optionally stored in json format. json is a lightweight data exchange language conceived and designed by daglas-crowford, which is based on easily readable text for transmitting data objects consisting of attribute values or sequential values. The language profile contains keys and key values, wherein the keys identify attributes of the language profile, each key has its corresponding value (value) identifying the content of the page display to which each language profile corresponds. It is necessary to ensure that keys and values in the same language profile are unique, i.e. a key can only correspond to a value, and a key is also unique. FIG. 3 shows an exemplary diagram of keys and values for a language profile, with two columns of symbols under the de. Json folder, the left column of symbols being keys, such as "Search", "video", and the right column being corresponding values, such as "erkunden" being the value of the key "Search", and "video" being the value of the key "video".
The above-described parsing function is described further below. In addition to the directory retrieval notation (such as "@") and keys of the language profile, the parsing function may also contain another parameter that is a variable reference in the profile.
Examples: the parsing function is t_msg ('@ placeholder', { name: 'John',) where @ is a directory retrieval symbol, placeholder is a key to a language configuration file, { name: 'John', } is a variable reference in the configuration file. The value corresponding to the key placeholder in the language configuration file is' hello, $ { name }, and after the analytical function is packaged, the obtained packaging result is: hello, john.
Step S210 is described next. The current step S210 is to abstract the key (key) of the language profile, and retrieve the directory upward by the directory retrieval symbol "@" in the example. One "@" indicates the current directory, "@" indicates a lookup to a parent directory, and so on.
For example, with this process, a De.json or En.json folder is found for t_msg ('@ … …), and an i18n directory under folder Layout shown in FIG. 3 is found for t_msg (' @ … …).
Alternatively, only the current directory or the parent directory may be found, or the current directory and the parent directory may be found at the same time, or a directory above the parent directory may be found, or the like.
S220, translating the catalog search symbol in the analytic function into the name of the searched catalog, encrypting the content contained in the analytic function by adopting an encryption algorithm to generate a unique character string, taking the preset number of characters in the character string, and renaming the key.
In practice, the program executed in step S220 may be named i18n-loader or other name, packaged based on a packaging tool such as Webpack. Webpack is an open source front end packaging tool. Weback provides a modular development approach that is lacking in front-end development, treats various static resources as modules, and generates optimized code from it. The packing tool that may be used in the embodiments of the present invention is not limited thereto, and a packing tool such as roller may be used.
In the current step S220, the key (key) of the above-mentioned language configuration file is parsed, the directory search symbol "@" in the example is translated into the found directory name (i 18n, for example), and the directory search symbol (translated into the directory name at this time) and the parameters included in the parsing function are encrypted, for example, a hash process, an MD5 algorithm (a widely used cryptographic hash function may generate a 128-bit (16-byte) hash value (hash value) for ensuring that the information transmission is completely consistent) and other encryption algorithms may be used to generate the unique string. The encryption algorithm is not limited thereto, and other encryption algorithms such as sha256, sha512, and the like may be employed. A predetermined number of characters therein, such as the first 8 bits (1-8 bits), the last 8 bits (9-16 bits) characters, or any intermediate 8 bit characters (such as 3-10 bits) are then renamed to shorten the key length.
Examples: for example, for the parsing function t_msg ('@ aboutus'), the following is obtained after translation: after encryption processing and 8-bit processing are performed, the renamed key name may be: e6d0fda2.
In step S220, special symbols are assigned to the keys to replace directory hierarchy, and the special symbols are automatically parsed and encrypted during translation, thus ensuring the uniqueness and security of the keys.
The partial code in the i18n-loader is provided below:
translating file directory names:
source=source.replace(/t_msg\(('|")@+/ig,(word)=>{
const dirNum=word.match(/@/g).length;
const newPath=this.resourcePath.replace(/(.*src\/)(.*)\/.*\.jsx$/,'$2');
const pathList=newPath.split('/');
const namespace=pathList.slice(0,pathList.length-(dirNum-1)).join('.').toLowerCase();
return word.replace(/@+$/,`${namespace}.`);
});
hash encryption processing:
const replaceFunc=(word,id)=>{
const hash=crypto.createHash('md5').update(id).digest('hex').substr(9,8);
return word.replace(id,hash);
s230, traversing all language configuration files to conduct the key renaming operation. Here, the renamed key names of the configuration files in different languages are different, and the renamed key names of the configuration files in the same language are the same, so that collision is prevented, and subsequent on-demand reference is facilitated.
S240, traversing the dependent file of the page, judging whether the dependent file contains renamed key names, if so, attributing the key values corresponding to the keys to the page, and generating the corresponding relation between each page and the language configuration file represented by the renamed key names in the mode.
This step may also include comparing the key to the original profile (de. Json, en. Json, etc.) to determine if the original profile is present, and if not, the resulting data is garbage and will not be added to the page.
Where the dependency file is a code file or code module of a page (there may be many code files disassembled for a page). Here we describe this step by taking the dealer (dealer) page as an example. Traversing the dependency file may be based on the page path, i.e., the directory structure shown in FIG. 3: as shown in fig. 3, there is a Layout folder under the combs folder, and there are files Dealer, footer, header and the like under the Layout folder.
After the processing of steps S230-240, a renamed key name such as e6d0fda2 is obtained, and then the renamed key name such as e6d0fda2 is found in the "distributor" file (which is a dependent file of the distributor web page). If so, the key value (such as e6d0fda2: 'ABOUT US') corresponding to the key is attributed to the page, and finally the configuration data required by each page is generated.
Under the condition of configuring other pages except the dealer page, such as configuring the home page, traversing the dependent file of the home page, searching for the renamed key name in the dependent file, and under the condition of finding, attributing the key value corresponding to the key to the position below the home page.
After generating the corresponding relation between each page and the renamed key name representing language configuration file (the language configuration file is that the key value pair corresponding to the renamed key name is e6d0fda2: 'ABOUT US'), the corresponding relation can be written into a server based on a page path and stored in a JSON format. The file directory format generated by the server side is shown in fig. 4, for example, in which files are stored under the i18n folder. Therefore, independent packaging is carried out according to the configuration files required by the pages, the code packaging volume is reduced, the load of the server is reduced, the throughput of the server is improved, and the on-demand quotation can be realized. The above describes examples of page-by-page references, configuration files may also be packaged nationally, and references may be made according to nationally as needed when called.
In practice, the procedure performed in steps S230 and S240 may be named i18n-plug in or other name, packaged based on packaging tools such as Webpack or roller, etc.
The partial codes in i18n-plug are provided below:
traversing all dependent files:
judging whether the file content contains an ID value in language configuration, if so, attributing the configuration to the current page:
if(fileStr.indexOf(key)>-1){
usedJson.en[key]=langJson.en[key];
usedJson.de[key]=langJson.de[key];
s250, searching the language configuration file represented by the renamed key name according to the corresponding relation aiming at the accessed page, and adding the language configuration file to the page in the form of a global variable.
In the page access phase, a configuration file in a server (which may be based on node. Js, which is a JavaScript running environment based on the Chrome V8 engine) is looked up through a route, and the configuration file is represented by a renamed key name, such as e6d0fda2. As described above, the language profile is: key-value pairs corresponding to renamed key names, such as e6d0fda2: 'ABOUT US'. The configuration file may then be read by a requiring method, which is a method known to those skilled in the art of introducing code modules, relying on files, etc., and will not be described in detail herein. Finally, the configuration file represented by the 8-bit code is added to the front page IN the form of a global variable (such as by introducing the configuration file IN window). Append in the form of a global variable refers to the ability to call a global variable (e.g., the global variable window_intl_messages_) anywhere on the page, as is known to those skilled in the art.
By the mode, front-end and back-end configuration data are communicated. Moreover, the page access path is used for carrying out reference according to the requirement, so that the loading speed of the front-end page is increased, and the use experience of a user is improved.
As described above, according to the technical scheme of the invention, a solution is provided based on packaging tools such as Webpack extraction, translation, splitting and merging of multilingual configuration files, so that required configuration data can be dynamically loaded according to pages and country when a website is accessed. The technical scheme of the invention has the following characteristics and advantages:
dynamically extracting and merging language configuration files without manual intervention, and integrating the configuration files defined in each business component; automatic directory hierarchy naming and processing such as hash encryption processing are carried out, naming conflict is avoided, and safety is improved; according to the reference, code redundancy is not generated, and the loading speed is improved.
Server device
According to an embodiment of the present invention, there is provided a server storing the correspondence between each page and the language configuration file represented by the renamed key name.
Device for loading configuration data for page
According to the embodiment of the invention, a device for loading configuration data for pages is also provided. Fig. 5 shows a schematic block diagram of the device. As shown in fig. 5, the apparatus includes:
the search module 510 performs a directory search process on the keys of the language configuration file contained in the parsing function through the directory search symbol, and searches for an upward directory of the keys of the language configuration file, where the parsing function is packaged in advance, and includes the directory search symbol and the keys of the language configuration file, where the language configuration file is defined in advance by the user, and includes the keys of the attribute of the markup language configuration file and the corresponding values, where the values are used to mark the page display content corresponding to the language configuration file.
Wherein the retrieving module 520 may find the current directory or the parent directory of the keys of the language configuration file, or find both the current directory and the parent directory, or find the directory above the parent directory, etc.
The naming module 520 translates the directory search symbol in the parsing function into the name of the directory found, encrypts the content contained in the parsing function using an encryption algorithm to generate a unique string, takes a predetermined number of characters in the string, and renames the key; and traversing all language configuration files to perform the key renaming operation. Wherein the predetermined number may be 8 and the naming module 520 takes the last 8-bit character of the string to rename.
The page attribution module 530 traverses the dependent file of the page, determines whether the dependent file contains the renamed key name, if so, attributions the key value corresponding to the key to the page, and generates the corresponding relation between each page and the language configuration file represented by the renamed key name in this way. The page attribution module 530 may store the corresponding relationship between each page and the language configuration file represented by the renamed key name in the server side in JSON format.
The append module 540 finds the language configuration file represented by the renamed key name according to the corresponding relation for the accessed page, and appends the language configuration file to the page in the form of global variable.
For details of the apparatus, please refer to the description of the above method embodiments, and the description of the present invention is omitted here.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the method of the invention for page loading configuration data according to instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It should be appreciated that the teachings of the present invention as described herein may be implemented in a variety of programming languages and that the foregoing description with respect to the particular languages is provided for disclosure of preferred embodiments of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter.

Claims (10)

1. A method of loading configuration data for a page, comprising:
executing directory retrieval processing on keys of a language configuration file contained in an analysis function through directory retrieval symbols, and searching an upward directory of the keys of the language configuration file, wherein the analysis function is packaged in advance, the directory retrieval symbols and the keys of the language configuration file are contained, the language configuration file is defined by a user in advance, the keys of the attribute of the identification language configuration file and corresponding values are contained, and the values are used for identifying page display content corresponding to the language configuration file;
translating the directory search symbol in the analytic function into the name of the searched directory, encrypting the content contained in the analytic function by using an encryption algorithm to generate a unique character string, taking a preset number of characters in the character string, and renaming the key;
traversing all language configuration files to perform the key renaming operation;
traversing the dependent file of the page, judging whether the dependent file contains the renamed key name, if so, attributing the key value corresponding to the key to the page, and generating the corresponding relation between each page and the language configuration file represented by the renamed key name in the mode;
and searching the language configuration file represented by the renamed key name according to the corresponding relation aiming at the accessed page, and adding the language configuration file to the page in the form of a global variable.
2. The method for page loading configuration data of claim 1, wherein the directory retrieval process includes finding a current directory and/or a parent directory of keys of the language configuration file.
3. The method for page loading configuration data of claim 1, wherein the predetermined number is 8 and the last 8-bit character in the string is taken for renaming.
4. The method for page loading configuration data of claim 1, further comprising:
and storing the corresponding relation between each page and the renamed language configuration file represented by the key name in a Json format in a server.
5. A server storing the correspondence of each page generated according to the method of claim 1 with a language profile represented by a renamed key name.
6. An apparatus for loading configuration data for a page, comprising:
the search module is used for executing directory search processing on keys of the language configuration files contained in the analysis function through directory search symbols and searching for upward directories of the keys of the language configuration files, wherein the analysis function is packaged in advance and comprises the directory search symbols and the keys of the language configuration files, the language configuration files are defined by a user in advance and comprise keys for marking the attributes of the language configuration files and corresponding values, and the values are used for marking page display contents corresponding to the language configuration files;
the naming module translates the catalog search symbol in the analytic function into the name of the searched catalog, encrypts the content contained in the analytic function by using an encryption algorithm to generate a unique character string, takes a preset number of characters in the character string and renames the keys; traversing all language configuration files to perform the key renaming operation;
the page attribution module traverses the dependent file of the page, judges whether the dependent file contains renamed key names, if yes, attributions the key values corresponding to the keys to the page, and generates the corresponding relation between each page and the renamed language configuration file represented by the key names in the mode;
and the additional module is used for searching the language configuration file represented by the renamed key name according to the corresponding relation aiming at the accessed page, and adding the language configuration file to the page in the form of a global variable.
7. The apparatus for page loading configuration data of claim 6, wherein the retrieval module looks for a current directory and/or a parent directory of keys of the language configuration file.
8. The device for page loading configuration data of claim 6, wherein the predetermined number is 8 and the naming module takes the last 8-bit character in the string to rename.
9. A computing device, comprising:
at least one processor and a memory storing program instructions;
the program instructions, when read and executed by the processor, cause the computing device to perform the method for page loading configuration data as recited in any one of claims 1-4.
10. A readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method for page loading configuration data of any of claims 1-4.
CN202210033650.0A 2022-01-12 2022-01-12 Method and device for loading configuration data on page and server Active CN114489839B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210033650.0A CN114489839B (en) 2022-01-12 2022-01-12 Method and device for loading configuration data on page and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210033650.0A CN114489839B (en) 2022-01-12 2022-01-12 Method and device for loading configuration data on page and server

Publications (2)

Publication Number Publication Date
CN114489839A CN114489839A (en) 2022-05-13
CN114489839B true CN114489839B (en) 2023-08-01

Family

ID=81511526

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210033650.0A Active CN114489839B (en) 2022-01-12 2022-01-12 Method and device for loading configuration data on page and server

Country Status (1)

Country Link
CN (1) CN114489839B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115774990A (en) * 2023-02-10 2023-03-10 成都萌想科技有限责任公司 RESTful API comparison method, system, equipment and storage medium based on configuration file
CN116738252B (en) * 2023-07-12 2024-01-05 上海中汇亿达金融信息技术有限公司 Configuration loading method, device and application based on fuzzy matching

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714109A (en) * 2012-10-04 2014-04-09 柯尼卡美能达株式会社 Display method for webpage
CN104714968A (en) * 2013-12-16 2015-06-17 中国银联股份有限公司 Method and device for internationalizing web page
CN105993010A (en) * 2014-02-11 2016-10-05 德州仪器公司 Methods and apparatus to provide extended object notation data
CN107577925A (en) * 2017-08-11 2018-01-12 西北大学 Based on the virtual Android application program guard methods of dual ARM instruction
US10078504B1 (en) * 2015-09-16 2018-09-18 Amazon Technologies, Inc. Automated software internationalization and localization
JP2018148493A (en) * 2017-03-08 2018-09-20 日本放送協会 Key generator, intermediate encryption device, consignment encryption device, data retrieval device, decryption device, and programs therefor
CN109542555A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of international programming implementation method of realization educational applications and device
CN109740314A (en) * 2018-12-27 2019-05-10 杭州当虹科技股份有限公司 A kind of method that SWF obscures encryption
CN109976840A (en) * 2017-12-27 2019-07-05 航天信息股份有限公司 The method and system of multilingual automatic adaptation are realized under a kind of separation platform based on front and back
CN110580215A (en) * 2018-06-08 2019-12-17 西安邮电大学 web test case reduction optimization method based on user session
CN111381913A (en) * 2018-12-29 2020-07-07 广州市百果园信息技术有限公司 Front-end multi-language loading adaptation method and device, computer equipment and storage medium
CN112257086A (en) * 2020-10-23 2021-01-22 华云数据控股集团有限公司 User privacy data protection method and electronic equipment
CN112487334A (en) * 2020-11-30 2021-03-12 深圳壹账通智能科技有限公司 Method, apparatus, computer device and medium for front end page language translation
CN113139390A (en) * 2020-01-17 2021-07-20 北京沃东天骏信息技术有限公司 Language conversion method and device applied to code character strings
CN113553601A (en) * 2020-04-23 2021-10-26 上海云盾信息技术有限公司 Webpage content encryption method and equipment
CN113609077A (en) * 2021-06-28 2021-11-05 山东云海国创云计算装备产业创新中心有限公司 File retrieval method, system, storage medium and equipment
KR102328597B1 (en) * 2020-09-09 2021-11-18 주식회사 알파비트 Filter module for excuting encryption function
CN113792020A (en) * 2021-08-02 2021-12-14 惠州Tcl云创科技有限公司 Data processing method, device, terminal and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9063749B2 (en) * 2011-05-27 2015-06-23 Qualcomm Incorporated Hardware support for hashtables in dynamic languages
US9465799B2 (en) * 2011-10-10 2016-10-11 Red Hat, Inc. Server-side internationalization and localization of web applications using a scripting language
US10339029B2 (en) * 2016-11-01 2019-07-02 Ca, Inc. Automatically detecting internalization (i18n) issues in source code as part of static source code analysis

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103714109A (en) * 2012-10-04 2014-04-09 柯尼卡美能达株式会社 Display method for webpage
CN104714968A (en) * 2013-12-16 2015-06-17 中国银联股份有限公司 Method and device for internationalizing web page
CN105993010A (en) * 2014-02-11 2016-10-05 德州仪器公司 Methods and apparatus to provide extended object notation data
US10078504B1 (en) * 2015-09-16 2018-09-18 Amazon Technologies, Inc. Automated software internationalization and localization
JP2018148493A (en) * 2017-03-08 2018-09-20 日本放送協会 Key generator, intermediate encryption device, consignment encryption device, data retrieval device, decryption device, and programs therefor
CN107577925A (en) * 2017-08-11 2018-01-12 西北大学 Based on the virtual Android application program guard methods of dual ARM instruction
CN109976840A (en) * 2017-12-27 2019-07-05 航天信息股份有限公司 The method and system of multilingual automatic adaptation are realized under a kind of separation platform based on front and back
CN110580215A (en) * 2018-06-08 2019-12-17 西安邮电大学 web test case reduction optimization method based on user session
CN109542555A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of international programming implementation method of realization educational applications and device
CN109740314A (en) * 2018-12-27 2019-05-10 杭州当虹科技股份有限公司 A kind of method that SWF obscures encryption
CN111381913A (en) * 2018-12-29 2020-07-07 广州市百果园信息技术有限公司 Front-end multi-language loading adaptation method and device, computer equipment and storage medium
CN113139390A (en) * 2020-01-17 2021-07-20 北京沃东天骏信息技术有限公司 Language conversion method and device applied to code character strings
CN113553601A (en) * 2020-04-23 2021-10-26 上海云盾信息技术有限公司 Webpage content encryption method and equipment
KR102328597B1 (en) * 2020-09-09 2021-11-18 주식회사 알파비트 Filter module for excuting encryption function
CN112257086A (en) * 2020-10-23 2021-01-22 华云数据控股集团有限公司 User privacy data protection method and electronic equipment
CN112487334A (en) * 2020-11-30 2021-03-12 深圳壹账通智能科技有限公司 Method, apparatus, computer device and medium for front end page language translation
CN113609077A (en) * 2021-06-28 2021-11-05 山东云海国创云计算装备产业创新中心有限公司 File retrieval method, system, storage medium and equipment
CN113792020A (en) * 2021-08-02 2021-12-14 惠州Tcl云创科技有限公司 Data processing method, device, terminal and storage medium

Also Published As

Publication number Publication date
CN114489839A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
CN114489839B (en) Method and device for loading configuration data on page and server
US9195644B2 (en) Short phrase language identification
US20050262440A1 (en) Localization of XML via transformations
JP6720626B2 (en) Removal of outdated items in curated content
Rani et al. Enhancing Levenshtein’s edit distance algorithm for evaluating document similarity
US10936667B2 (en) Indication of search result
US20210319039A1 (en) Extraction of a nested hierarchical structure from text data in an unstructured version of a document
CN112328548A (en) File retrieval method and computing device
WO2021201953A1 (en) Natural language code search
US8548989B2 (en) Querying documents using search terms
CN107526742B (en) Method and apparatus for processing multilingual text
US9495638B2 (en) Scalable, rule-based processing
CN113535642A (en) File searching method and computing device
US20180121410A1 (en) Regular expression searching
US10706124B2 (en) Storage and retrieval of structured content in unstructured user-editable content stores
WO2018208412A1 (en) Detection of caption elements in documents
CN113343718A (en) Multi-language implementation method, computing device and storage medium
US9208134B2 (en) Methods and systems for tokenizing multilingual textual documents
US20090150763A1 (en) Method and apparatus for a document annotation service
JP6194180B2 (en) Text mask device and text mask program
US11250084B2 (en) Method and system for generating content from search results rendered by a search engine
CN104376067A (en) Index file inputting method and retrieval method based on index file
US20170270127A1 (en) Category-based full-text searching
US11669555B2 (en) System and method of creating index
CN114610808A (en) Data storage method, data storage device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant