CN115858985A - Method for establishing multi-language environment and switching languages on same website - Google Patents

Method for establishing multi-language environment and switching languages on same website Download PDF

Info

Publication number
CN115858985A
CN115858985A CN202310043733.2A CN202310043733A CN115858985A CN 115858985 A CN115858985 A CN 115858985A CN 202310043733 A CN202310043733 A CN 202310043733A CN 115858985 A CN115858985 A CN 115858985A
Authority
CN
China
Prior art keywords
language
website
parameters
same website
switching
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.)
Pending
Application number
CN202310043733.2A
Other languages
Chinese (zh)
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.)
Beijing Yisihui Business Service Co ltd
Original Assignee
Beijing Yisihui Business Service 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 Beijing Yisihui Business Service Co ltd filed Critical Beijing Yisihui Business Service Co ltd
Priority to CN202310043733.2A priority Critical patent/CN115858985A/en
Publication of CN115858985A publication Critical patent/CN115858985A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a method for establishing a multi-language environment and switching languages on the same website, which comprises the steps of establishing a multi-language frame based on a node environment and a vue environment, using i18n as a plug-in, and setting an insertion function in the plug-in by adopting a frame mixing method; setting the current language and supported multi-language type of the website, creating a corresponding multi-language package file, returning the data in the corresponding language package to the website and displaying the data based on the parameter path by the plug-in, and reversely transmitting the replacement language data according to the switched language parameter path. The method and the device realize the function of carrying out multiple languages on the same website.

Description

Method for establishing multi-language environment and switching languages on same website
Technical Field
The application relates to the field of internet, in particular to a method for establishing a multilingual environment and switching languages on the same website.
Background
The internet is faced with world wide internet names, websites are displayed based on one language, for people with different languages, translation is needed, and in order to adapt to the international development trend, some websites can be displayed by adopting two or more languages.
The current multilingual display website is a website which is established with different languages, when different languages are switched, the website address is switched equivalently, contents of different languages on different websites are seen, so that different webpage contents can be caused, or when a webpage of one language can be visited and a webpage of another language cannot be visited for some reasons, a netizen of another language cannot view the webpage contents.
In order to meet the international requirement, how to switch different languages on the same website is a problem to be solved urgently at present.
Disclosure of Invention
The method comprises the steps of constructing a multi-language frame, setting a multi-language package, setting a life cycle in a plug-in, establishing the multi-language environment on the same website, processing parameters when the languages need to be switched, transmitting the multi-language package to a page through a parameter path, and switching the multi-language on the page, so that the multi-language switching on the same website is realized, and the requirements for different languages are met.
In a first aspect, the above object of the present invention is achieved by the following technical solutions:
a method for establishing a multi-language environment on the same website comprises the steps of constructing a multi-language framework based on node and vue environments, using i18n as a plug-in, adopting a framework mixing method, and setting an insertion function in the plug-in; setting the current language and supported multi-language type of the website, creating a corresponding multi-language package file, and returning and displaying data in the corresponding language package to the website by the plug-in based on the parameter path.
The application is further configured to: and simulating the life cycle of the frame in the insertion function, transmitting the corresponding language packet according to the parameter path in the life cycle, and replacing data in the website to realize multi-language conversion.
The application is further configured to: the framework lifecycle includes: judging the legality of the parameters, checking the legal parameters, setting the current language environment according to the parameters, introducing the required language package path, and storing the introduced language package in a cache.
The application is further configured to: different variables are set to distinguish different scenes according to different scenes using languages, and grammars are matched for the different scenes.
In a second aspect, the above object of the present invention is achieved by the following technical solutions:
a method for switching multiple languages on the same network address includes receiving parameter, judging legality of parameter, processing legal parameter, setting current language environment, introducing correspondent language packet and storing it in buffer memory, and reversely transmitting alternative language data according to parameter path.
The application is further configured to: and in the unloaded life cycle, judging whether the parameters are defined or not, if not, reporting an error, and if so, entering the loaded life cycle for parameter processing.
The application is further configured to: and in the loaded life cycle, judging whether the parameters are legal or not, checking legal parameters, setting the current language environment according to the parameters, introducing a corresponding language package according to a parameter path, analyzing the use scene of the language, matching corresponding grammar according to different scenes, and displaying the language package data of the current language on the website according to the parameter path.
The application is further configured to: and in the current language environment, if the language is required to be switched, acquiring a language packet of the switched language according to the switching parameter path, and displaying the data of the switched language packet on the website along the switching language parameter path.
The application is further configured to: and in the life cycle before destruction, removing the variables and the cache files at the last moment, and destroying the instance.
In a third aspect, the above object of the present invention is achieved by the following technical solutions:
a terminal for performing multi-language switching on the same website, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the method of the present application.
In summary, the present application includes at least one of the following beneficial technical effects:
1. according to the method and the device, the multi-language packet is returned in the original path according to the parameter path, so that multi-language switching on the same website is guaranteed;
2. furthermore, the multi-language environment is provided by setting a multi-language frame and a multi-language package, so that support is provided for multi-language switching;
3. furthermore, the frame life cycle is set in the plug-in, the parameters are processed according to different life cycles, and the accuracy and the singleness of parameter processing are guaranteed.
Drawings
FIG. 1 is a flowchart illustrating the processing of multiple language parameters according to an embodiment of the present application.
Detailed Description
The present application is described in further detail below with reference to the accompanying drawings.
The method for establishing the multi-language environment on the same website comprises the steps of setting a multi-language environment frame and a plug-in of the website, wherein a Node is a development platform for enabling JavaScript to run on a server side, vue is a set of progressive frames for constructing a user interface, the multi-language frame is constructed based on the Node and Vue environment, and multi-language packages are set and comprise required multi-language files for being adapted to display of multiple languages.
And setting an insertion function in the plug-in by adopting a framework mixing method by taking i18n as the plug-in. The plug-in is used for introducing the parameters into the multi-language framework so as to realize the multi-language website development in the multi-language framework without obstacles.
As shown in FIG. 1, the frame lifecycle is modeled in the plug-in function, and during the lifecycle, the parameters are processed. Setting the current language of the page, transmitting the current language package to the page, and displaying the page data.
When the page language needs to be switched, the language parameter needing to be switched is received, the plug-in transmits the corresponding language packet to the webpage in the original path according to the parameter path, so that the current language data in the website is replaced by the switched language, and multi-language conversion is realized.
The processing of the parameters comprises: in the unloaded lifecycle, judging to introduce parameter definition, if the parameter is not defined, indicating that the language type required by the parameter is not defined in the multi-language package, and performing error reporting processing, if the parameter is defined, indicating that the language type required by the parameter is in the multi-language package, and for the defined parameter, entering the loaded lifecycle to perform parameter processing, wherein the parameter processing comprises the following steps: judging the legality of the parameters, checking the path of the introduced language packet, matching the required language packet, reporting errors when the parameters are not legal, checking whether the path of the file of the language packet introduced with the parameters is matched or not when the parameters are legal, and reporting errors if the required language packet cannot be matched or the variable and the file are not in a single corresponding relation. And introducing the multi-language packet path for the parameters passing the verification, and storing the needed multi-language packet data in a cache after the introduction is successful, so that the data is convenient to read.
In the same language, grammars under different scenes are different, and variables are set for distinguishing the scenes so as to match the requirements of the different scenes on the grammars.
Specifically, the scenario includes: label inside, label attributes, functions.
In the life cycle before destruction, the defined variables, files and cache data are cleared to ensure the unicity of webpage display each time.
And when receiving the parameters for modifying the page language, selecting the corresponding language packet to store in the cache according to the parameter path, transmitting along the parameter path, replacing the current language of the page by the language to be switched, and displaying the page data.
The method comprises the steps of receiving input language parameters needing to be switched based on a multi-language environment of the same website, judging whether the language parameters are defined or not in an unloaded life cycle, giving an error signal when the language parameters are not defined, indicating that the needed languages do not include the needed languages, entering the loaded life cycle when the language parameters are defined, judging the legality of the parameters, similarly, giving an error signal when the parameters are illegal, checking a matching path of the multi-language package corresponding to the parameters when the parameters are legal, introducing the multi-language package path for supporting the parameters, storing the needed language package data into a cache after the introduction is successful, and giving error information if the introduction is failed or the parameters and the files do not accord with a single corresponding relation.
And for different scenes, acquiring the language to be set from the cached language packet according to the transmission path of the parameters in the scene, transmitting the acquired language to the website along the transmission path of the parameters, replacing data in the website, displaying the language data to be displayed, and finishing displaying the current language.
If the current language is to be modified, similarly, whether the language to be switched is defined or not and whether the language parameters are legal or not are judged, the matching path of the language parameters is checked, after all the language parameters are correct, the language packet to be switched is stored in a cache, the language packet in the cache is transmitted to a page along the path of the modified parameters, the current language is replaced by the switched language, and the language switching is completed.
The language parameters enter the plug-in of the multi-language frame from the page, the parameters are judged and processed through the plug-in function of the plug-in, the switched languages are transmitted to the page along the original path, and multi-language display on the same website is guaranteed.
The terminal device for performing multi-language switching on the same website provided by an embodiment of the present invention includes: a processor, a memory, and a computer program, such as a multi-language framework program, stored in the memory and executable on the processor, when executing the computer program, implements the multi-language display of the present application.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory and executed by the processor to implement the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program in the terminal equipment for performing multilingual handover on the same website. For example, the computer program may be divided into a plurality of modules.
The terminal device for performing multi-language switching on the same website can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing devices. The terminal device for performing multi-language switching on the same website may include, but is not limited to, a processor and a memory. It will be understood by those skilled in the art that the above examples are only examples of the terminal device for performing multi-language switching on the same website, and do not constitute a limitation to the terminal device for performing multi-language switching on the same website, and may include more or less components than those shown in the drawings, or some components in combination, or different components, for example, the terminal device for performing multi-language switching on the same website may further include an input-output device, a network access device, a bus, etc.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like, said processor being the control center of said terminal device for multilingual switching on the same website, and various interfaces and lines connecting the various parts of the whole of said terminal device for multilingual switching on the same website.
The memory may be configured to store the computer program and/or module, and the processor may implement various functions of the terminal device for performing multiple language switching on the same website by executing or executing the computer program and/or module stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The module/unit for integrating the multi-language switching terminal device on the same website can be stored in a computer readable storage medium if it is implemented in the form of a software functional unit and sold or used as an independent product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc.
The above embodiments are preferred embodiments of the present application, and the protection scope of the present application is not limited by the above embodiments, so: all equivalent changes made according to the structure, shape and principle of the present application shall be covered by the protection scope of the present application.

Claims (10)

1. A method for establishing multi-language environment on the same website is characterized in that: constructing a multi-language framework based on node and vue environments, and setting an insertion function in an insertion by using i18n as the insertion and adopting a framework mixing method; setting the current language and supported multi-language type of the website, creating a corresponding multi-language package file, and returning and displaying data in the corresponding language package to the website by the plug-in based on the parameter path.
2. The method for creating multilingual environments on the same website as in claim 1, wherein: and simulating the life cycle of the frame in the insertion function, transmitting the corresponding language packet according to the parameter path in the life cycle, and replacing data in the website to realize multi-language conversion.
3. The method for building multilingual environment on the same website as in claim 2, wherein: the framework lifecycle includes: judging the legality of the parameters, checking the legal parameters, setting the current language environment according to the parameters, introducing the required language package path, and storing the introduced language package in a cache.
4. The method for creating multilingual environments on the same website as in claim 1, wherein: according to different scenes using languages, different variables are set to distinguish different scenes, and grammars are matched for different scenes.
5. A method for multi-language switching on the same website is characterized in that: the method comprises the steps of receiving parameters, judging the legality of the parameters, processing the legal parameters, setting the current language environment, introducing corresponding language packets into a cache, and reversely transmitting replacement language data according to a parameter path.
6. The method of claim 5, wherein the multi-language switching is performed on the same website: and in the unloaded life cycle, judging whether the parameters are defined or not, if not, reporting an error, and if so, entering the loaded life cycle for parameter processing.
7. The method of claim 5, wherein the multi-language switching is performed on the same website: and in the loaded life cycle, judging whether the parameters are legal or not, checking legal parameters, setting the current language environment according to the parameters, introducing a corresponding language package according to a parameter path, analyzing the use scene of the language, matching corresponding grammar according to different scenes, and displaying the language package data of the current language on the website according to the parameter path.
8. The method of claim 7, wherein the multi-language switching is performed on the same website as the multi-language switching: and in the current language environment, if the language is required to be switched, acquiring a language packet of the switched language according to the switching parameter path, and displaying the data of the switched language packet on the website along the switching language parameter path.
9. The method of claim 5, wherein the multi-language switching is performed on the same website: and in the life cycle before destruction, removing the variables and the cache files at the last moment, and destroying the instance.
10. A terminal for performing multilingual handover on the same website, comprising a memory, a processor, and a computer program stored in said memory and executable on said processor, wherein: the processor, when executing the computer program, implements the method of any of claims 1-9.
CN202310043733.2A 2023-01-29 2023-01-29 Method for establishing multi-language environment and switching languages on same website Pending CN115858985A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310043733.2A CN115858985A (en) 2023-01-29 2023-01-29 Method for establishing multi-language environment and switching languages on same website

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310043733.2A CN115858985A (en) 2023-01-29 2023-01-29 Method for establishing multi-language environment and switching languages on same website

Publications (1)

Publication Number Publication Date
CN115858985A true CN115858985A (en) 2023-03-28

Family

ID=85657332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310043733.2A Pending CN115858985A (en) 2023-01-29 2023-01-29 Method for establishing multi-language environment and switching languages on same website

Country Status (1)

Country Link
CN (1) CN115858985A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110157620A1 (en) * 2009-12-31 2011-06-30 Kurt Nathan Nordback Systems and methods for stochastic regression testing of page description language processors
CN108363703A (en) * 2018-01-30 2018-08-03 福建天泉教育科技有限公司 The multilingual solution of front end applications, storage medium
CN111427641A (en) * 2020-02-27 2020-07-17 深圳壹账通智能科技有限公司 Multi-language adaptation method, device, system, computer equipment and storage medium
CN115373783A (en) * 2022-08-10 2022-11-22 中国建设银行股份有限公司 Page language switching method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110157620A1 (en) * 2009-12-31 2011-06-30 Kurt Nathan Nordback Systems and methods for stochastic regression testing of page description language processors
CN108363703A (en) * 2018-01-30 2018-08-03 福建天泉教育科技有限公司 The multilingual solution of front end applications, storage medium
CN111427641A (en) * 2020-02-27 2020-07-17 深圳壹账通智能科技有限公司 Multi-language adaptation method, device, system, computer equipment and storage medium
CN115373783A (en) * 2022-08-10 2022-11-22 中国建设银行股份有限公司 Page language switching method and device

Similar Documents

Publication Publication Date Title
CN111428462B (en) Communication protocol template construction method and terminal equipment
CN109117209B (en) Serialization and deserialization method and device
CN108427731B (en) Page code processing method and device, terminal equipment and medium
CN109684008B (en) Card rendering method, device, terminal and computer readable storage medium
CN107404418B (en) Internet product testing method, device, equipment and storage medium
CN110955409B (en) Method and device for creating resources on cloud platform
US10802939B2 (en) Method for scanning cache of application and electronic device
CN107479868B (en) Interface loading method, device and equipment
US20190107929A1 (en) Method and device for loading content of page, and electronic device
CN111209736A (en) Text file analysis method and device, computer equipment and storage medium
CN110750440A (en) Data testing method and terminal equipment
CN112541313A (en) Method and device for configuring trigger expression for logic analysis state
US10503430B2 (en) Method and device for clearing data and electronic device
CN111367799B (en) Method, device, medium and electronic equipment for locating source code breakdown position
CN109324838B (en) Execution method and execution device of single chip microcomputer program and terminal
CN111385661B (en) Method, device, terminal and storage medium for voice control of full screen playing
CN115858985A (en) Method for establishing multi-language environment and switching languages on same website
CN110647371A (en) Multi-language resource file analysis method and system based on service configuration
CN107071553B (en) Method, device and computer readable storage medium for modifying video and voice
CN111949510B (en) Test processing method, device, electronic equipment and readable storage medium
CN111242731B (en) Service execution method and device
CN114385124A (en) Independent page jumping method, device and equipment based on Vue framework
CN110007984B (en) Function call relation backtracking method and system based on Xtensa DSP
CN111125605B (en) Page element acquisition method and device
CN113377376A (en) Data packet generation method, data packet generation device, electronic device, and storage 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20230328

RJ01 Rejection of invention patent application after publication