CN115373783A - Page language switching method and device - Google Patents

Page language switching method and device Download PDF

Info

Publication number
CN115373783A
CN115373783A CN202210957572.3A CN202210957572A CN115373783A CN 115373783 A CN115373783 A CN 115373783A CN 202210957572 A CN202210957572 A CN 202210957572A CN 115373783 A CN115373783 A CN 115373783A
Authority
CN
China
Prior art keywords
language
page
package
user
target
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
CN202210957572.3A
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.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech 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 China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202210957572.3A priority Critical patent/CN115373783A/en
Publication of CN115373783A publication Critical patent/CN115373783A/en
Pending legal-status Critical Current

Links

Images

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/451Execution arrangements for user interfaces
    • G06F9/454Multi-language systems; Localisation; Internationalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0482Interaction with lists of selectable items, e.g. menus
    • 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
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Machine Translation (AREA)

Abstract

The invention discloses a page language switching method and device, and relates to the technical field of data visualization. One embodiment of the method comprises: receiving an access operation of a user to a page, loading a multi-language package corresponding to the page, and executing a binding language switching event operation in response to the success of loading the multi-language package; responding to the selection operation of a user on a target language mark, and setting a target language corresponding to the target language mark as a current language based on the language switching event; and determining a target language package corresponding to the target language mark from the multi-language packages, and switching the content displayed in the page to the content of the target language by using the target language package. The implementation mode supports multi-language switching of the application page, provides a resource preloading mechanism, and can switch the interface display language according to the language sign selected by the user so as to improve the development efficiency of the application page.

Description

Page language switching method and device
Technical Field
The invention relates to the technical field of data visualization in the field of big data, in particular to a page language switching method and device.
Background
With the development of global economy, the front-end applications are gradually increased, and front-end application products and services in various industries are gradually diversified. Aiming at customers of different countries, the front-end application needs to rapidly switch different language display pages, so that developers need to develop multiple sets of interfaces, the development efficiency is low, heavy product requirements cannot be met in time, channel operation products cannot be updated in time, and business development is affected.
In order to solve the above problems, although a unified front-end page application multi-language layout method is provided in the prior art, the method lacks a mechanism for caching multi-language packets and a multi-language dynamic switching function, and a user cannot independently select a language displayed on a page, so that the rendering speed of the page is too slow, which affects experience.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for switching a page language, which can at least solve the problem that a user cannot autonomously select a language displayed on a page due to lack of a mechanism for caching multi-language packages and lack of a multi-language dynamic switching function in the prior art.
In order to achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a page language switching method, including:
receiving an access operation of a user to a page, loading a multi-language package corresponding to the page, and executing a language binding switching event operation in response to the success of loading the multi-language package;
in response to receiving a selection operation of a user on a target language mark, setting a target language corresponding to the target language mark as a current language based on the language switching event; and
and determining a target language packet corresponding to the target language sign from the multi-language packets, and switching the content displayed in the page into the content of the target language by using the target language packet.
Optionally, the loading the multi-language package corresponding to the page includes:
inquiring path information of the multi-language package from a configuration file of the page;
in response to the fact that the multi-language package is found in a local cache, determining that the page is not accessed for the first time, and loading the multi-language package from the local cache; or
And responding to the condition that the multi-language package does not exist in the local cache, determining that the page is accessed for the first time, downloading the multi-language package from the server, and storing the multi-language package into the local cache.
Optionally, the multi-language package includes a public multi-language package and a customized multi-language package corresponding to the page, and the path information includes path information corresponding to the public multi-language package and path information corresponding to the customized multi-language package.
Optionally, the public multi-language package comprises a public component language package and a public literal language package, and the user-defined multi-language package comprises a user-defined component language package and a user-defined literal language package;
the switching the content displayed in the page to the content in the target language using the language pack includes:
displaying the public characters and the user-defined characters displayed in the page by using the target language by using the public character language package and the user-defined character language package; and
and displaying the public components and the custom components displayed in the page by using the target language by using the public component language package and the custom component language package.
Optionally, the common multilingual package further includes a common method language package, and the method further includes:
and switching the calling result of the public method in the page into the target language representation by using the public method language package so as to display the calling result represented by using the target language when receiving a calling request for the public method.
Optionally, the customized multilingual package further includes a customized method language package, and the method further includes:
and switching the calling result of the custom method in the page into the target language representation by using the custom method language package so as to display the calling result represented by the target language when receiving a calling request for the custom method.
Optionally, after the receiving of the access operation of the user to the page, the method further includes: inquiring a basic language mark set for the page, and setting a basic language corresponding to the basic language mark as a current language;
the switching the content displayed in the page to the content in the target language using the target language package includes: and switching the content of the basic language displayed in the page into the content of the target language by using the target language package.
Optionally, the receiving an access operation of a user to a page, and querying a basic language flag set for the page includes:
receiving access operation of a user to an offline mechanism page, determining a mechanism cluster to which the offline mechanism belongs, and inquiring basic language signs configured for the mechanism cluster; or
Receiving the access operation of a user to the online application page, positioning the current position of the user, determining the area of the position, and inquiring the basic language sign configured to the area in advance.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a page language switching apparatus including:
the loading and binding module is used for receiving the access operation of a user to a page, loading the multi-language package corresponding to the page and executing the operation of binding a language switching event in response to the success of loading the multi-language package;
the language setting module is used for responding to the selection operation of a user on a target language mark and setting the target language corresponding to the target language mark as the current language based on the language switching event; and
and the language switching module is used for determining a target language package corresponding to the target language mark from the multi-language package and switching the content displayed in the page into the content of the target language by using the target language package.
Optionally, the load binding module is configured to:
inquiring the path information of the multi-language package from the configuration file of the page;
in response to the multi-language package being searched in the local cache, determining that the page is not accessed for the first time, and loading the multi-language package from the local cache; or
And responding to the condition that the multi-language package does not exist in the local cache, determining that the page is accessed for the first time, downloading the multi-language package from the server, and storing the multi-language package into the local cache.
Optionally, the multi-language packs include a public multi-language pack and a customized multi-language pack corresponding to the page, and the path information includes path information corresponding to the public multi-language pack and path information corresponding to the customized multi-language pack.
Optionally, the public multi-language package comprises a public component language package and a public literal language package, and the user-defined multi-language package comprises a user-defined component language package and a user-defined literal language package;
the language switching module is configured to:
displaying the public characters and the user-defined characters displayed in the page by using the target language by using the public character language package and the user-defined character language package; and
and displaying the public components and the custom components displayed in the page by using the target language by using the public component language package and the custom component language package.
Optionally, the public multi-language package further includes a public method language package, and the language switching module is further configured to:
and switching the calling result of the public device in the page to the target language representation by using the public method language package so as to display the calling result represented by the target language when receiving a calling request for the public device.
Optionally, the customized multilingual package further includes a customized method language package, and the language switching module is further configured to:
and switching the calling result of the user-defined device in the page to the target language representation by using the user-defined method language package so as to display the calling result represented by the target language when receiving a calling request for the user-defined device.
Optionally, the load binding module is further configured to: inquiring a basic language mark set for the page, and setting a basic language corresponding to the basic language mark as a current language;
the language switching module is configured to: and switching the content of the basic language displayed in the page into the content of the target language by using the target language package.
Optionally, the load binding module is further configured to:
receiving access operation of a user to an offline mechanism page, determining a mechanism cluster to which the offline mechanism belongs, and inquiring a basic language sign configured to the mechanism cluster; or
Receiving the access operation of a user to an online application page, positioning the current position of the user, determining the area of the position, and inquiring basic language signs pre-configured for the area.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a page language switching electronic device.
The electronic device of the embodiment of the invention comprises: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize any one of the page language switching methods.
To achieve the above object, according to a further aspect of the embodiments of the present invention, there is provided a computer readable medium having a computer program stored thereon, the computer program, when executed by a processor, implementing any one of the page language switching methods described above.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a computer program product. A computer program product according to an embodiment of the present invention includes a computer program, and when the computer program is executed by a processor, the computer program implements the page language switching method according to an embodiment of the present invention.
According to the scheme provided by the invention, one embodiment of the invention has the following advantages or beneficial effects: the method has the advantages that the multi-language part of the front-end application page is extracted to form the multi-language package, cross-page use can be supported, a resource cache and a preloading mechanism are set, corresponding multi-language packages can be directly loaded from a local cache after a user switches languages, each language package comprises a text language package, a component language package and a method language package, so that the text, the component and the calling result after the calling method in the page are comprehensively switched, the whole operation is simple and easy to operate, and the development efficiency of the application page is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic main flow chart of a page language switching method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating obtaining a common multi-lingual package and multi-lingual packages corresponding to a page according to an embodiment of the invention;
FIG. 3 is a schematic illustration of selecting a target language token;
FIG. 4 is a schematic flow diagram of the layout of a page using a target language package;
FIG. 5 is a flowchart illustrating a specific page language switching method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the main blocks of a page language switching apparatus according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
FIG. 8 is a schematic block diagram of a computer system suitable for use with a mobile device or server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. According to the technical scheme, the data (such as the personal information of the user) are acquired, stored, used, processed and the like according with relevant regulations of national laws and regulations, and the public order and good custom are not violated.
Referring to fig. 1, a main flowchart of a page language switching method provided by an embodiment of the present invention is shown, including the following steps:
s101: receiving an access operation of a user to a page, loading a multi-language package corresponding to the page, and executing a language binding switching event operation in response to the success of loading the multi-language package;
s102: in response to receiving a selection operation of a user on a target language mark, setting a target language corresponding to the target language mark as a current language based on the language switching event;
s103: and determining a language package corresponding to the target language sign from the multi-language packages, and switching the content displayed in the page to the content of the target language by using the language package.
In the above embodiment, with the rapid development of network devices, the front-end service needs are more and more, and different language pages are set for the needs of customers in different countries, so that the traditional development cannot meet the requirement of the frequently updated front-end service. The scheme mainly aims at the page language switching scene of front-end application, such as switching Chinese into English.
For step S101, the present solution may be applicable to an offline scene and an online scene, where for the offline scene, for example, a user goes to an offline mechanism website, and accesses a page using a device of the offline mechanism website, at this time, it is necessary to determine a mechanism cluster to which the offline mechanism belongs, and different basic language flags (i.e., default language flags) are set in advance for different mechanism clusters, for example, a mechanism cluster 1 — a basic language flag zh (representing chinese), and a mechanism cluster 2 — a basic language flag en (representing english).
For an online scene, for example, a user logs in an online application using a terminal such as a computer or a mobile phone, for example, an electronic bank, determines a current location, for example, a location a, of the user according to an IP (Internet Protocol) address of the terminal or a Global Positioning System (GPS) equipped therewith, and may first determine an area, for example, a location a-a, in which the location is located, and may also set different basic language signs, for example, a location a-zhu, and a location B-zhu, for different areas in order to simplify subsequent calculation.
The device responds to the operation of a user for accessing the page, firstly searches the basic language sign of the page, sets the language corresponding to the basic language sign as the current language, and if the basic language sign zh is found, sets Chinese as the current language, namely the default language.
The application may be provided with a plurality of pages, and the pages have common parts and different parts, so that a multi-language developer needs to set a common multi-language package for the page of the application, set a customized multi-language package for each page, and store the storage path information of the common multi-language package and the storage path information of the customized multi-language package into the configuration file of each page respectively. For example, the configuration file of page X includes the storage path information Y of the common multi-language package and the storage path information Z of its custom multi-language package. The multi-language package is a text file translated by different languages, such as a text file translated by the same language into languages of Chinese, english, korean, thai, japanese, german, french, and the like.
After it is monitored that the user has an access operation on the page, it is necessary to search the storage path information of the common multi-language package and the storage path information of the customized multi-language package from the configuration file of the page, and then search whether a corresponding multi-language package exists in the application local cache, as shown in fig. 2:
1) The application is used for the first time, so that the local cache does not have a public multi-language package or a custom multi-language package corresponding to the page, the public multi-language package and the custom multi-language package corresponding to the page need to be downloaded from the server respectively, and then the public multi-language package and the custom multi-language package are written into the local cache to facilitate subsequent access and direct use.
2) The application is not used for the first time, but the page is accessed for the first time, so that a public multi-language package exists in the local cache (the cleaning condition is not considered for the moment), but a user-defined multi-language package corresponding to the page does not exist, the user-defined multi-language package corresponding to the page needs to be downloaded from the server, and then the user-defined multi-language package is written into the local cache to facilitate subsequent access for direct use. Thus, this is the case where the public multi-lingual packages are retrieved from the local cache and the custom multi-lingual packages corresponding to the page are retrieved from the server.
3) The application is not used for the first time, and the page is not accessed for the first time, so that the public multi-language package and the user-defined multi-language package corresponding to the page exist in the local cache, and the two multi-language packages can be directly obtained from the local cache.
It should be noted that the language type in the public multi-lingual package is generally larger than the language type in the custom multi-lingual package. For example, the pages of the electronic bank may be laid out with languages such as chinese, english, korean, thai, japanese, german, french, and the like, and thus the public multi-language packages include language packages in languages such as chinese, english, korean, thai, japanese, german, french, and the like. Due to the use habits, supervision requirements and the like of the pages in different language regions, partial functions of the electronic bank are not open to some regions, and therefore some pages do not need to set the languages of the regions, for example, the page 1 only displays Chinese, english, korean, thai and Japanese, so that the customized multi-language bag only comprises language bags of Chinese, english, korean, thai and Japanese. Assuming that the user is accessing page 1, the final result is: the language switching system comprises a public language bag including Chinese, english, korean, thai, japanese, german, french and other languages and a self-defined language bag including Chinese, english, korean, thai and Japanese, and a user can only switch the Chinese, english, korean, thai and Japanese languages.
By the method, the public multi-language packages and the user-defined multi-language packages downloaded from the server when the page is accessed for the first time can be cached, the public multi-language packages and the user-defined multi-language packages are not required to be obtained from the server when the page is accessed for the subsequent time, the public multi-language packages and the user-defined multi-language packages can be obtained by directly requesting the local cache, the burden brought by network requests is reduced, and the page language switching speed is accelerated after a user switches languages.
For steps S102 and S103, the binding language switching event operation is executed only after the common multi-language package and the custom multi-language package corresponding to the page are successfully loaded. The languages that can be supported by the page can be presented in a list format, as shown in fig. 3, and the user clicks on the language sign bar and pulls down all the language signs that can be supported by the page. For example, if the basic language sign is zh, the user selects en as the target language sign, and the language switching event sets the english language as the current language.
The language sign is a key for searching the language pack, and only after the current language switching is monitored, the language switching event determines the language pack corresponding to the target language sign from the public multi-language pack and the user-defined multi-language pack obtained in the previous step, for example, determines the public language pack and the user-defined language pack corresponding to English, and the page is laid out based on the determined public language pack and the user-defined language pack.
The multi-language package in the scheme is mainly divided into two types: the language multi-language pack and the component multi-language pack are used, the common language pack can be set with a common method multi-language pack, the user-defined language pack can be set with a user-defined method multi-language pack, but the common method multi-language pack is mainly used. Assuming that the base language token is zh and the target language token is en, the page layout is explained specifically here, and specifically refer to fig. 4:
1. the common text contents displayed in chinese on the page are switched to the common text contents displayed in english using the common text language package corresponding to english, for example, "XX bank" is switched to "XX bank".
The common component language package corresponding to english is used to switch the common component displayed in chinese on the page to the common component displayed in english, where the component is mainly a UI (User Interface) component, for example, the "Name + input box" is switched to the "Name + input box".
2. The user-defined text language package corresponding to English is used to switch the user-defined text content displayed in Chinese to the user-defined text content displayed in English, for example, switching "today weather is very good" to "It's a nice day".
The user-defined component displayed in Chinese in the page is switched to the user-defined component displayed in English by using the user-defined component language package corresponding to English, and the components are mainly UI components, for example, the 'register' displayed in the 'register component' is switched to the 'register'.
3. In addition, the calling of the public method is supported, for example, when a user initiates a public transaction to request back-end data, a page pops up a prompt box 'loading in progress', and the 'loading in progress' is switched to 'loading' by using a public method language packet corresponding to English. For the request result, if failure prompt, the request result is switched to 'error', and if success prompt, the request result is switched to 'success'. However, if an abnormality occurs, the alarm is switched from "warning".
4. At present, a common method is used, which is generally applicable to a page in an application, but if a certain page has more functions and a function that cannot be covered by the common method is added, a custom method is required, for example, "exit confirmation" is switched to "Are you sure to get? ".
Compared with the prior art, the method provided by the embodiment has at least the following beneficial effects:
1. the multi-language part of the front-end application page is extracted to form a multi-language package which comprises a public part and a user-defined part, the public part can be used in a cross-page mode, the workload of developers for developing different languages aiming at the page is saved, the repeated development condition is avoided, the development time of application products and services is shortened, and the development efficiency is improved.
2. The resource caching and preloading mechanism is set, the multi-language package can be downloaded and cached to the local when the application and the page are accessed for the first time, the multi-language package in the local cache is directly used during subsequent access, the burden brought by network requests is reduced, the page rendering speed and the response speed can be accelerated after the user switches languages, and better experience is brought to the user.
3. And the languages displayed by dynamic switching are supported, and the language package of each language comprises a character language package, a component language package and a method language package so as to carry out comprehensive language switching on the characters, the components and the calling results after the method is called in the page.
Referring to fig. 5, a flowchart of a specific page language switching method according to an embodiment of the present invention is shown, including the following steps:
s501: receiving an access operation of a user to a page, inquiring a basic language mark set for the page, and setting a basic language corresponding to the basic language mark as a current language;
s502: inquiring path information of the multi-language package from the configuration file of the page;
s503: in response to the multi-language package being searched in the local cache, determining that the page is not accessed for the first time, and loading the multi-language package from the local cache;
s504: responding to the fact that the multi-language package does not exist in the local cache, determining that the page is accessed for the first time, downloading the multi-language package from the server, and storing the multi-language package into the local cache;
s505: in response to the success of loading the multi-language package, executing a binding language switching event operation;
s506: in response to receiving a selection operation of a user on a target language mark, setting a target language corresponding to the target language mark as a current language based on the language switching event;
s507: and determining a target language package corresponding to the target language mark from the multi-language packages, and switching the content of the basic language displayed in the page to the content of the target language by using the target language package.
The scheme can be realized based on a vue-i18n framework, a multi-language npm library and the like. vue-i18n, i18n is a short name of "internationalization", and for a program, corresponding interfaces can be displayed according to different languages and regions without modifying internal codes, and internationalization is particularly important in the global era because potential users of products may come from all corners of the world, and vue-i18n is an internationalized plug-in library used by vue. The multi-language packages are loaded to the local during application and page initialization, and are merged with the multi-language packages of components, transactions (such as a public method) and the like of the frame, the current language is set according to a target language mark selected by a user, and finally, the interface of the corresponding language is displayed on the page after vue-i18n compiling.
Referring to fig. 6, a schematic diagram illustrating main modules of a page language switching apparatus 600 according to an embodiment of the present invention is shown, including:
the loading and binding module 601 is configured to receive an access operation of a user on a page, load a multi-language package corresponding to the page, and execute a binding language switching event operation in response to a success in loading the multi-language package;
specifically, the method comprises the following steps:
inquiring the path information of the multi-language package from the configuration file of the page;
in response to the fact that the multi-language package is found in a local cache, determining that the page is not accessed for the first time, and loading the multi-language package from the local cache; or
And responding to the condition that the multi-language package does not exist in the local cache, determining that the page is accessed for the first time, downloading the multi-language package from the server, and storing the multi-language package into the local cache.
A language setting module 602, configured to set, in response to receiving a selection operation of a target language sign by a user, a target language corresponding to the target language sign as a current language based on the language switching event; and
a language switching module 603, configured to determine a target language package corresponding to the target language tag from the multi-language packages, and switch the content displayed in the page to the content in the target language using the target language package.
In the implementation device of the invention, the multi-language package comprises a public multi-language package and a self-defined multi-language package corresponding to the page, and the path information comprises path information corresponding to the public multi-language package and path information corresponding to the self-defined multi-language package.
In the implementation device, the public multi-language package comprises a public component language package and a public literal language package, and the user-defined multi-language package comprises a user-defined component language package and a user-defined literal language package;
the language switching module 603 is configured to:
displaying the public characters and the user-defined characters displayed in the page by using the target language by using the public character language package and the user-defined character language package; and
and displaying the public components and the custom components displayed in the page by using the target language by using the public component language package and the custom component language package.
In the implementation apparatus of the present invention, the common multi-language package further includes a common method language package, and the language switching module 603 is further configured to:
and switching the calling result of the public device in the page to the target language representation by using the public method language package so as to display the calling result represented by the target language when receiving a calling request for the public device.
In the implementation apparatus of the present invention, the customized multi-language package further includes a customized method language package, and the language switching module 603 is further configured to:
and switching the calling result of the user-defined device in the page into the target language representation by using the user-defined method language package so as to display the calling result represented by the target language when receiving a calling request for the user-defined device.
In the implementation apparatus of the present invention, the load binding module 601 is further configured to: inquiring a basic language mark set for the page, and setting a basic language corresponding to the basic language mark as a current language;
the language switching module is configured to 603: and switching the content of the basic language displayed in the page into the content of the target language by using the target language package.
In the implementation apparatus of the present invention, the load binding module 601 is further configured to:
receiving access operation of a user to an offline mechanism page, determining a mechanism cluster to which the offline mechanism belongs, and inquiring basic language signs configured for the mechanism cluster; or
Receiving the access operation of a user to an online application page, positioning the current position of the user, determining the area of the position, and inquiring basic language signs pre-configured for the area.
In addition, the detailed implementation of the apparatus in the embodiment of the present invention has been described in detail in the above method, so that the repeated description is not repeated here.
Fig. 7 shows an exemplary system architecture 700 to which embodiments of the invention may be applied, including terminal devices 701, 702, 703, a network 704 and a server 705 (by way of example only).
The terminal devices 701, 702, 703 may be various electronic devices having display screens and supporting web browsing, and are installed with various communication client applications, and users may interact with the server 705 through the network 704 using the terminal devices 701, 702, 703 to receive or send messages, and the like.
The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. The network 704 may include various connection types.
The server 705 may be a server providing various services, and it should be noted that the method provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use in implementing a terminal device of an embodiment of the present invention. The terminal device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, a computer system 800 includes a Central Processing Unit (CPU) 801 which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a loading binding module, a language setting module and a language switching module. Where the names of these modules do not in some cases constitute a limitation on the modules themselves, for example, a set language module may also be described as a "set current language module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform any of the page language switching methods described above.
The computer program product of the present invention includes a computer program, and when the computer program is executed by a processor, the computer program implements the page language switching method in the embodiment of the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (19)

1. A page language switching method is characterized by comprising the following steps:
receiving an access operation of a user to a page, loading a multi-language package corresponding to the page, and executing a language binding switching event operation in response to the success of loading the multi-language package;
in response to receiving a selection operation of a user on a target language mark, setting a target language corresponding to the target language mark as a current language based on the language switching event; and
and determining a target language packet corresponding to the target language sign from the multi-language packets, and switching the content displayed in the page into the content of the target language by using the target language packet.
2. The method of claim 1, wherein said loading the multi-language pack corresponding to the page comprises:
inquiring the path information of the multi-language package from the configuration file of the page;
in response to the fact that the multi-language package is found in a local cache, determining that the page is not accessed for the first time, and loading the multi-language package from the local cache; or
And responding to the condition that the multi-language package does not exist in the local cache, determining that the page is accessed for the first time, downloading the multi-language package from the server, and storing the multi-language package into the local cache.
3. The method of claim 1 or 2, wherein the multi-language packs include a common multi-language pack and a custom multi-language pack corresponding to the page, and wherein the path information includes path information corresponding to the common multi-language pack and path information corresponding to the custom multi-language pack.
4. The method of claim 3, wherein the common multilingual bundle includes a common component language bundle and a common literal language bundle, and the custom multilingual bundle includes a custom component language bundle and a custom literal language bundle;
the switching the content displayed in the page to the content in the target language using the language pack includes:
displaying the public characters and the user-defined characters displayed in the page by using the target language by using the public character language package and the user-defined character language package; and
and displaying the public components and the custom components displayed in the page by using the target language by using the public component language package and the custom component language package.
5. The method of claim 4, wherein the common multilingual bundle further comprises a common method language bundle, the method further comprising:
and switching the calling result of the public method in the page into the target language representation by using the public method language package so as to display the calling result represented by using the target language when receiving a calling request for the public method.
6. The method of claim 4 or 5, wherein the custom multi-language pack further comprises a custom method language pack, and wherein the method further comprises:
and switching the calling result of the custom method in the page into the target language representation by using the custom method language package so as to display the calling result represented by using the target language when receiving a calling request for the custom method.
7. The method according to claim 1 or 4, after receiving the access operation of the user to the page, further comprising: inquiring a basic language mark set for the page, and setting a basic language corresponding to the basic language mark as a current language;
the switching the content displayed in the page to the content in the target language using the target language package includes: and switching the content of the basic language displayed in the page into the content of the target language by using the target language package.
8. The method of claim 7, wherein the receiving of the user's access operation to the page, querying the basic language flag set for the page, comprises:
receiving access operation of a user to an offline mechanism page, determining a mechanism cluster to which the offline mechanism belongs, and inquiring a basic language sign configured to the mechanism cluster; or
Receiving the access operation of a user to the online application page, positioning the current position of the user, determining the area of the position, and inquiring the basic language sign configured to the area in advance.
9. A page language switching apparatus, comprising:
the loading and binding module is used for receiving the access operation of a user to a page, loading the multi-language package corresponding to the page and executing the operation of binding a language switching event in response to the success of loading the multi-language package;
the language setting module is used for responding to the selection operation of a user on a target language mark and setting the target language corresponding to the target language mark as the current language based on the language switching event; and
and the language switching module is used for determining a target language package corresponding to the target language mark from the multi-language package and switching the content displayed in the page into the content of the target language by using the target language package.
10. The apparatus of claim 9, wherein the load bind module is configured to:
inquiring the path information of the multi-language package from the configuration file of the page;
in response to the fact that the multi-language package is found in a local cache, determining that the page is not accessed for the first time, and loading the multi-language package from the local cache; or
And responding to the condition that the multi-language package does not exist in the local cache, determining that the page is accessed for the first time, downloading the multi-language package from the server, and storing the multi-language package into the local cache.
11. The apparatus of claim 9 or 10, wherein the multi-language packs comprise a common multi-language pack and a custom multi-language pack corresponding to the page, and wherein the path information comprises path information corresponding to the common multi-language pack and path information corresponding to the custom multi-language pack.
12. The apparatus of claim 11, wherein the common multilingual package comprises a common component language package and a common literal language package, and wherein the custom multilingual package comprises a custom component language package and a custom literal language package;
the language switching module is configured to:
displaying the public characters and the user-defined characters displayed in the page by using the target language by using the public character language package and the user-defined character language package; and
and displaying the public components and the custom components displayed in the page by using the target language by using the public component language package and the custom component language package.
13. The apparatus of claim 12, wherein the common multilingual package further comprises a common method language package, and wherein the language switching module is further configured to:
and switching the calling result of the public device in the page into the target language representation by using the public method language package so as to display the calling result represented by using the target language when receiving a calling request for the public device.
14. The apparatus of claim 12 or 13, wherein the custom multi-language pack further comprises a custom method language pack, and wherein the language switching module is further configured to:
and switching the calling result of the user-defined device in the page to the target language representation by using the user-defined method language package so as to display the calling result represented by the target language when receiving a calling request for the user-defined device.
15. The apparatus of claim 9 or 12, wherein the load binding module is further configured to: inquiring a basic language mark set for the page, and setting a basic language corresponding to the basic language mark as a current language;
the language switching module is configured to: and switching the content of the basic language displayed in the page into the content of the target language by using the target language package.
16. The apparatus of claim 15, wherein the load bind module is further configured to:
receiving access operation of a user to an offline mechanism page, determining a mechanism cluster to which the offline mechanism belongs, and inquiring a basic language sign configured to the mechanism cluster; or
Receiving the access operation of a user to the online application page, positioning the current position of the user, determining the area of the position, and inquiring the basic language sign configured to the area in advance.
17. An electronic device, comprising:
one or more processors;
a storage device to store one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
18. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-8.
19. A computer program product comprising a computer program, characterized in that the computer program realizes the method according to any of claims 1-8 when executed by a processor.
CN202210957572.3A 2022-08-10 2022-08-10 Page language switching method and device Pending CN115373783A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210957572.3A CN115373783A (en) 2022-08-10 2022-08-10 Page language switching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210957572.3A CN115373783A (en) 2022-08-10 2022-08-10 Page language switching method and device

Publications (1)

Publication Number Publication Date
CN115373783A true CN115373783A (en) 2022-11-22

Family

ID=84066281

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210957572.3A Pending CN115373783A (en) 2022-08-10 2022-08-10 Page language switching method and device

Country Status (1)

Country Link
CN (1) CN115373783A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115858985A (en) * 2023-01-29 2023-03-28 北京易思汇商务服务有限公司 Method for establishing multi-language environment and switching languages on same website

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115858985A (en) * 2023-01-29 2023-03-28 北京易思汇商务服务有限公司 Method for establishing multi-language environment and switching languages on same website

Similar Documents

Publication Publication Date Title
US11461111B2 (en) Method for running applets, and electronic device
US20150244670A1 (en) Browser and method for domain name resolution by the same
CN111796823A (en) Method and device for updating page and displaying page and page maintenance system
JP2022525831A (en) Page pre-rendering methods, devices, electronic devices, computer programs and storage media
CN110795649A (en) Target page display method, device and system and electronic equipment
US20210209526A1 (en) Landing page processing method, device and medium
US11294651B2 (en) Code execution method, device, and rendering apparatus
CN113076164B (en) Webpage language management method and device
CN110941779B (en) Page loading method and device, storage medium and electronic equipment
CN113760324A (en) Method and device for constructing micro front-end application
CN111294395A (en) Terminal page transmission method, device, medium and electronic equipment
CN113254043A (en) Web front-end project processing method and device, electronic equipment and storage medium
CN115373783A (en) Page language switching method and device
CN112905178A (en) Method, device, equipment and medium for generating business function page
CN112835568A (en) Project construction method and device
CN110888869A (en) Data processing method and device
CN112835671A (en) Application page scene switching method, device and equipment
CN116009863B (en) Front-end page rendering method, device and storage medium
US11126410B2 (en) Method and apparatus for building pages, apparatus and non-volatile computer storage medium
CN115495687A (en) Page caching method, device, equipment and storage medium
CN109710604A (en) Data processing method, device, system, computer readable storage medium
CN114969591A (en) Page rendering method and device, electronic equipment and readable storage medium
US10990750B2 (en) Dynamically bundling web page resources
CN113656041A (en) Data processing method, device, equipment and storage medium
CN111241852A (en) File translation method, device, terminal 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