CN114969599A - Method, device and system for internationalizing webpage language - Google Patents

Method, device and system for internationalizing webpage language Download PDF

Info

Publication number
CN114969599A
CN114969599A CN202210522300.0A CN202210522300A CN114969599A CN 114969599 A CN114969599 A CN 114969599A CN 202210522300 A CN202210522300 A CN 202210522300A CN 114969599 A CN114969599 A CN 114969599A
Authority
CN
China
Prior art keywords
language
file
international
page
files
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
CN202210522300.0A
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.)
Shenzhen Dashi Cloud Technology Co ltd
Original Assignee
Shenzhen Dashi Cloud 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 Shenzhen Dashi Cloud Technology Co ltd filed Critical Shenzhen Dashi Cloud Technology Co ltd
Priority to CN202210522300.0A priority Critical patent/CN114969599A/en
Publication of CN114969599A publication Critical patent/CN114969599A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • 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

Landscapes

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

Abstract

The application discloses and provides a method, a device and a system for internationalizing a web page language, wherein the method comprises the following steps: initiating a website access request, receiving loading data of an accessed website, wherein the loading data comprises a JS page language file, and the JS page language file carries a default international language file and at least two different international language files; determining a current browser language; judging whether a language file with the same language as the current browser exists in at least two different international language files or not; if the current display page exists, rendering the current display page and loading language data in the corresponding international language file; if the browser does not exist, the current display page is rendered, the default language data in the default international language file is loaded, and the problems that in the prior art, the page with H5 separated from JS can be internationalized aiming at the content in JS only by using a frame and a plug-in are solved, and the research and development cost is high.

Description

Method, device and system for internationalizing webpage language
Technical Field
The invention relates to the technical field of webpage language processing, in particular to a webpage language internationalization method, device and system.
Background
In the process of developing the network station of the existing needle network station, one relatively troublesome thing is that an international configuration needs to be carried out on a page, namely the system needs to simultaneously support languages such as Chinese, English and Spanish.
At present, the front-end page is implemented by separating H5(Hierarchical Data Format, HDF5, version 5 of Hierarchical Data Format) from JS (JS file is a file written in javascript language with JS as an extension), and the H5 page renders the page and interacts with the back-end by referring to the corresponding JS file. If the content in the JS file cannot be internationalized on the premise of not using a frame and a plug-in, for example, a title of a dynamically generated form in the JS file, return information of a function, pop-up prompt information, and the like, a currently better scheme is to use an vue-i18n + vue frame, introduce vue-i18n (international plug-in of vue. JS) into the JS file, and then obtain an attribute of a corresponding JS file by setting a required language and render the JS file, but in this way, an additional plug-in needs to be introduced to implement internationalization of a web page language, and meanwhile, a developer needs to have a deep technical background, and if the demand for page internationalization is a later-stage increment demand, the developer needs to reconstruct the page, so that the research and development cost is increased.
Disclosure of Invention
Therefore, the technical problem to be solved by the present invention is to overcome the defects that in the prior art, a page separated from JS by H5 needs to use a frame and a plug-in to internationalize the content in JS, and the development cost is high, so as to provide a method, an apparatus, and a system for internationalizing web page language.
In order to solve the above technical problem, the disclosed embodiments of the present invention at least provide a method, an apparatus, and a system for internationalizing web page language.
In a first aspect, an embodiment of the present disclosure provides a method for internationalizing a web page language, including:
initiating a website access request, wherein the website access request comprises accessed website information;
receiving loading data of the accessed website, wherein the loading data comprise a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
determining a current browser language;
judging whether a language file with the same language as the current browser exists in the at least two different international language files or not;
if the international language file with the same language as the current browser language exists in the at least two different international language files, rendering a current display page and loading language data in the corresponding international language file;
and if the international language file with the same language as the current browser language does not exist in the at least two different international language files, rendering a current display page and loading default language data in the default international language file.
Optionally, before the determining the current browser language, the method further comprises: monitoring the language setting operation of a user; after monitoring the language setting operation of the user, judging whether the international language files with the same language set by the user exist in the at least two different international language files or not; the rendering of the current display page and the loading of the language data in the corresponding international language file are as follows: if the international language file with the same language set by the user exists in the at least two different international language files, rendering a current display page and loading language data in the corresponding international language file; the determining of the current browser language is: and if the international language file which is the same as the language set by the user does not exist in the at least two different international language files, or the language setting operation of the user is not monitored, determining the current browser language.
Optionally, the JS page language file comprises a JS page language setting file; after monitoring the language setting operation of the user, the step of judging whether the international language file with the same language set by the user exists in the at least two different international language files comprises the following steps: after the language setting operation of the user is monitored, modifying a global language variable in the JS page language setting file to enable the global language variable value to be a language identification corresponding to the language set by the user; and judging whether the international language files with the same language set by the user exist in the at least two different international language files according to the language identification.
Optionally, the JS page language file further includes a JS page language storage file, and the at least two different international language files are carried by the JS page language storage file; the step of judging whether the language file with the same language as the current browser language exists in the at least two different international language files is as follows: judging whether the international language file with the same language as the current browser language exists in the JS page language storage file or not; the step of judging whether the international language file with the same language set by the user exists in the at least two different international language files is as follows: and judging whether the international language file which is the same as the language set by the user exists in the JS page language storage file.
In a second aspect, an embodiment of the disclosure of the present invention further provides another method for internationalizing a web page language, including:
creating a JS page language file, wherein the JS page language file carries a default international language file and at least two different international language files, and the JS page language file is used for internationalized configuration of a website language;
receiving a website access request, wherein the website access request comprises accessed website information;
acquiring loading data of the accessed website according to the accessed website information, wherein the loading data comprises the JS page language file, so that a website request terminal loads language data in the corresponding international language file or the default international language file according to the JS page language file;
and sending the loading data of the accessed website according to the accessed website information.
In a third aspect, an embodiment of the disclosure of the present invention further provides an apparatus for internationalizing web page language, including:
the access request initiating module is used for initiating a website access request, and the website access request comprises accessed website information;
the loading data receiving module is used for receiving loading data of the accessed website, wherein the loading data comprise a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
the browser language determining module is used for determining the current browser language;
the international language judging module is used for judging whether a language file with the same language as the current browser language exists in the at least two different international language files;
the international language loading module is used for rendering a current display page and loading language data in the corresponding international language file if the international language file with the same language as the current browser exists in the at least two different international language files;
and the default language loading module is used for rendering a current display page and loading default language data in the default international language file if the international language file with the same language as the current browser does not exist in the at least two different international language files.
In a fourth aspect, an embodiment of the disclosure of the present invention further provides another device for internationalizing a web page language, including:
the language file creating module is used for creating a JS page language file, wherein the JS page language file carries a default international language file and at least two different international language files, and the JS page language file is used for internationalized configuration of a website language;
the access request receiving module is used for receiving a website access request, and the website access request comprises accessed website information;
the loading data acquisition module is used for acquiring loading data of the accessed website according to the accessed website information, wherein the loading data comprise the JS page language file, so that a website request terminal loads language data in the corresponding international language file or the default international language file according to the JS page language file;
and the loading data sending module is used for sending the loading data of the accessed website according to the accessed website information.
In a fifth aspect, an embodiment of the disclosure of the present invention further provides another web page language internationalization system, including:
the server is used for creating a JS page language file for internationalized configuration of the website language, wherein the JS page language file carries a default international language file and at least two different international language files, and receiving a website access request initiated by the client, wherein the website access request comprises accessed website information; acquiring loading data of the accessed website according to the accessed website information; sending the loading data to the client according to the accessed website information, wherein the loading data comprises the JS page language file;
the client initiates the website access request to the server, receives the loading data sent by the server and determines the current browser language; judging whether a language file with the same language as the current browser exists in the at least two different international language files or not; if the international language file with the same language as the current browser language exists in the at least two different international language files, rendering a current display page and loading language data in the corresponding international language file; and if the international language file with the same language as the current browser language does not exist in the at least two different international language files, rendering a current display page and loading default language data in the default international language file.
In a sixth aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a seventh aspect, the disclosed embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to perform the steps in the first aspect or any possible implementation manner of the first aspect.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the method comprises the steps that a JS file is created by a server and is specially used for language internationalization configuration of the JS file, when a website access request is initiated by a client, the server sends loading data carrying the JS file to the client to obtain the language of a browser, if the JS file supports the adaptation of the language of the browser, corresponding language data are obtained from the JS file to be loaded, and if not, default language data are loaded. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart illustrating a method for internationalizing web page languages according to an embodiment of the disclosure;
FIG. 2 is a flow chart illustrating another method for internationalization of web page languages according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a method for internationalization of web pages according to an embodiment of the disclosure;
FIG. 4 is a schematic structural diagram of an apparatus for internationalizing web page languages according to an embodiment of the disclosure;
FIG. 5 is a schematic structural diagram of another web page language internationalization apparatus according to an embodiment of the disclosure;
FIG. 6 is a schematic structural diagram of a web page language internationalization system according to an embodiment of the disclosure;
fig. 7 shows a schematic structural diagram of a computer device according to an embodiment of the disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
Example 1
As shown in fig. 1, a flowchart of a method for internationalizing web page languages according to an embodiment of the present disclosure includes:
s11: initiating a website access request, wherein the website access request comprises accessed website information;
s12: receiving loading data of an accessed website, wherein the loading data comprise a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
s13: determining a current browser language;
s14: judging whether a language file with the same language as the current browser exists in at least two different international language files, if the language file with the same language as the current browser exists in the at least two different international language files, executing a step S15, and if the language file with the same language as the current browser does not exist in the at least two different international language files, executing a step S16;
s15: rendering a current display page and loading language data in a corresponding international language file;
s16: rendering the current display page and loading default language data in the default international language file.
It can be understood that, according to the technical scheme provided by this embodiment, the server creates a JS file specially used for language internationalization configuration of the JS file, and when the client initiates a website access request, the server sends the loaded data carrying the JS file to the client to obtain the language of the browser, and if the JS file supports adaptation of the language of the browser, obtains corresponding language data from the JS file to load, otherwise, loads default language data. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
Example 2
As shown in fig. 2, a flowchart of another method for internationalizing web page language according to an embodiment of the disclosure of the present invention includes:
s21: initiating a website access request, wherein the website access request comprises accessed website information;
s22: receiving loading data of an accessed website, wherein the loading data comprise a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
s23: monitoring the language setting operation of a user;
s24: after monitoring the language setting operation of the user, determining whether an international language file which is the same as the language set by the user exists in at least two different international language files, if an international language file which is the same as the language set by the user exists in at least two different international language files, executing step S27, and if an international language file which is the same as the language set by the user does not exist in at least two different international language files, or if the language setting operation of the user (not shown in the figure) is not monitored, executing step S25;
s25: a current browser language is determined.
S26: judging whether a language file with the same language as the current browser language exists in at least two different international language files, if so, executing a step S27, and if not, executing a step S28;
s27: rendering a current display page and loading language data in a corresponding international language file;
s28: rendering the current display page and loading default language data in the default international language file.
In particular practice, the JS page language file comprises a JS page language setting file; step S24, after monitoring the language setting operation of the user, determining whether there is an international language file in the at least two different international language files that is the same as the language set by the user includes:
s241: after monitoring the language setting operation of the user, modifying a global language variable in the JS page language setting file to enable the global language variable value to be a language identifier corresponding to the language set by the user;
s242: and judging whether the international language file with the same language set by the user exists in at least two different international language files according to the language identification.
In specific practice, the JS page language file further comprises a JS page language storage file, and at least two different international language files are carried by the JS page language storage file;
step S28 is to determine whether there is a language file in the same language as the current browser in at least two different international language files: judging whether an international language file with the same language as the current browser language exists in the JS page language storage file or not;
step S29 is to determine whether there is an international language file in the same language as the language set by the user among at least two different international language files: and judging whether an international language file which is the same as the language set by the user exists in the JS page language storage file.
In particular practice, the client obtains the language of the browser through the Navigator object.
In a specific practice, a global variable language is defined in a JS page language setting file to store the language type of a webpage, in the page loading process, the language selected by a user is monitored according to a click event of the user, corresponding modification is carried out on the language value, different language values represent different language types, the webpage is reloaded, and if the user does not manually select the language, the language value is set to be null by default.
In specific practice, for a multi-page website, a plurality of JS page language storage files can be set, for example, a corresponding JS page language storage file can be created for each page, a global variable of which the page needs to be subjected to language internationalization attribute is defined in each JS page language storage file, in order to prevent global variable conflict, the global variable can be in a mode of adding a page name and an attribute name, the specific implementation can adopt the prior art well known to those skilled in the art, and the embodiment does not have excessive description.
In specific practice, writing an execution function during loading in a JS page language storage file, firstly judging whether the value of a global variable language of a webpage language is null, if not, directly setting the global variable in the JS page language setting file as the value of a corresponding language, if so, acquiring the language of a browser through a Navigator object, supposing that the website needs to support Chinese (default) and English, if the language of the browser is English, assigning the global variable as a corresponding English value, and if so, using the default Chinese.
In a specific practice, a corresponding JS page language storage file is introduced into a page, and because the HTML is executed from top to bottom, a JS page language setting file for setting a webpage language needs to be introduced at first, and then a JS page language storage file for internationalizing the corresponding webpage language is introduced, so that the rendering of the page can be completed.
It can be understood that, in the technical scheme provided by this embodiment, the server creates a JS file that is specially used for language internationalization configuration of the JS file, and under the condition of a large number of pages, creates a JS file for each page in order to facilitate management, defines a global variable that needs internationalization, acquires the language of the browser through the Navigator object, and modifies the value of the global variable to be the current language if the JS file supports adaptation of the language, otherwise, uses a default language. When a user accesses the website, the internationalized JS file is loaded firstly, the value of the corresponding global variable is obtained according to the browser language, and then the page is rendered. If the webpage language needs to be manually selected later, the js file provides a language manually selected by a function setting user, the international language file and the loading data are sent to the client together, the client does not need to interact with the back end in the page loading process, all operations are realized at the front end, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, is simple and easy to realize, and is convenient to modify and manage.
Example 3
As shown in figure 3 of the drawings,
the embodiment of the invention also provides a method for internationalizing the webpage language, which comprises the following steps:
s31: creating a JS page language file, wherein the JS page language file carries a default international language file and at least two different international language files, and the JS page language file is used for internationalized configuration of the website language;
s32: receiving a website access request, wherein the website access request comprises accessed website information;
s33: acquiring loading data of the accessed website according to the information of the accessed website, wherein the loading data comprises a JS page language file, so that the website request terminal loads language data in a corresponding international language file or a default international language file according to the JS page language file;
s34: and sending the loading data of the accessed website according to the accessed website information.
It can be understood that, according to the technical scheme provided by this embodiment, the server creates a JS file specially used for language internationalization configuration of the JS file, and when the client initiates a website access request, the server sends the loading data carrying the JS file to the client to obtain the language of the browser, and if the JS file supports adaptation of the language of the browser, obtains corresponding language data from the JS file to load the JS file, otherwise, loads default language data. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
Example 4
As shown in fig. 4, an embodiment of the present invention further provides a device for internationalizing web page languages, including:
an access request initiating module 41, configured to initiate a website access request, where the website access request includes accessed website information;
a loading data receiving module 42, configured to receive loading data of the accessed website, where the loading data includes a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
a browser language determining module 43, configured to determine a current browser language;
an international language judging module 44, configured to judge whether a language file that is the same as the language of the current browser exists in the at least two different international language files;
an international language loading module 45, configured to render a current display page and load language data in the corresponding international language file if the international language file with the same language as the current browser exists in the at least two different international language files;
a default language loading module 46, configured to render a current display page and load default language data in the default international language file if the international language file with the same language as the current browser does not exist in the at least two different international language files.
In a specific practice, as shown in phantom in fig. 4, the apparatus may further comprise:
a monitoring module 47, configured to monitor a language setting operation of a user;
a user setting judgment module 48, configured to judge whether the international language file in the same language as the language set by the user exists in the at least two different international language files after the language setting operation of the user is monitored;
the browser language determining module 43 determines that the current browser language is: if the international language file with the same language set by the user does not exist in the at least two different international language files, or the language setting operation of the user is not monitored, the browser language determining module 43 determines the current browser language.
In particular practice, the JS page language file comprises a JS page language setting file; after monitoring the language setting operation of the user, the user setting judgment module 48 judges whether the international language file with the same language set by the user exists in the at least two different international language files, including:
the variable modification submodule is used for modifying the global language variable in the JS page language setting file after monitoring the language setting operation of the user, so that the global language variable value is the language identification corresponding to the language set by the user;
and the identification judgment submodule is used for judging whether the international language files with the same language set by the user exist in the at least two different international language files according to the language identification.
In specific practice, the JS page language file also comprises a JS page language storage file, and the at least two different international language files are carried by the JS page language storage file;
the international language judging module 44 judges whether a language file having the same language as the current browser language exists in the at least two different international language files: an international language judging module 44 judges whether the international language file with the same language as the current browser language exists in the JS page language storage file;
the user setting judgment module 48 judges whether the international language file with the same language set by the user exists in the at least two different international language files: the user setting judgment module 48 judges whether the international language file which is the same as the language set by the user exists in the JS page language storage file.
It can be understood that, according to the technical scheme provided by this embodiment, the server creates a JS file specially used for language internationalization configuration of the JS file, and when the client initiates a website access request, the server sends the loaded data carrying the JS file to the client to obtain the language of the browser, and if the JS file supports adaptation of the language of the browser, obtains corresponding language data from the JS file to load, otherwise, loads default language data. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
Example 5
As shown in fig. 5, an embodiment of the present invention further provides another device for internationalizing a web page language, including:
the language file creating module 51 is used for creating a JS page language file, wherein the JS page language file carries a default international language file and at least two different international language files, and the JS page language file is used for internationalized configuration of website languages;
an access request receiving module 52, configured to receive a website access request, where the website access request includes information about an accessed website;
the loading data acquisition module 53 is configured to acquire loading data of the accessed website according to the information of the accessed website, where the loading data includes a JS page language file, so that the website request terminal loads language data in a corresponding international language file or a default international language file according to the JS page language file;
and the loading data sending module 54 is used for sending the loading data of the accessed website according to the accessed website information.
It can be understood that, according to the technical scheme provided by this embodiment, the server creates a JS file specially used for language internationalization configuration of the JS file, and when the client initiates a website access request, the server sends the loaded data carrying the JS file to the client to obtain the language of the browser, and if the JS file supports adaptation of the language of the browser, obtains corresponding language data from the JS file to load, otherwise, loads default language data. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
Example 6
As shown in fig. 6, an embodiment of the present invention further provides another web page language internationalization system, including:
the server 61 is used for creating a JS page language file for internationalized configuration of the website language, wherein the JS page language file carries a default international language file and at least two different international language files, and receiving a website access request initiated by a client, and the website access request comprises accessed website information; acquiring loading data of the accessed website according to the accessed website information; sending loading data to the client according to the accessed website information, wherein the loading data comprises a JS page language file;
the client 62 initiates a website access request to the server, receives the loading data sent by the server, and determines the current browser language; judging whether a language file with the same language as the current browser exists in at least two different international language files or not; if the international language file with the same language as the current browser language exists in at least two different international language files, rendering a current display page and loading language data in the corresponding international language file; and if the international language file with the same language as the current browser does not exist in the at least two different international language files, rendering the current display page and loading default language data in the default international language file.
In particular practice, client 62 also listens for user language setting operations before determining the current browser language; after monitoring the language setting operation of the user, judging whether an international language file with the same language set by the user exists in at least two different international language files; rendering the current display page and loading the language data in the corresponding international language file as follows: if the international language file with the same language set by the user exists in at least two different international language files, rendering a current display page and loading language data in the corresponding international language file; determining the current browser language as: and if the international language file which is the same as the language set by the user does not exist in the at least two different international language files, or the language setting operation of the user is not monitored, determining the current browser language.
In specific practice, the JS page language file comprises a JS page language setting file; after monitoring the language setting operation of the user, the client 62 determines whether an international language file identical to the language set by the user exists in at least two different international language files, including: after the language setting operation of the user is monitored, modifying a global language variable in the JS page language setting file to enable the global language variable to be a language identifier corresponding to the language set by the user; and judging whether the international language file with the same language set by the user exists in at least two different international language files according to the language identification.
In specific practice, the JS page language file further comprises a JS page language storage file, and at least two different international language files are carried by the JS page language storage file; the client 62 determines whether a language file having the same language as the current browser language exists in at least two different international language files: judging whether an international language file with the same language as the current browser language exists in the JS page language storage file or not; the client 62 determines whether there is an international language file in the same language as the language set by the user among at least two different international language files: and judging whether an international language file which is the same as the language set by the user exists in the JS page language storage file.
It can be understood that, according to the technical scheme provided by this embodiment, the server creates a JS file specially used for language internationalization configuration of the JS file, and when the client initiates a website access request, the server sends the loaded data carrying the JS file to the client to obtain the language of the browser, and if the JS file supports adaptation of the language of the browser, obtains corresponding language data from the JS file to load, otherwise, loads default language data. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
Example 7
Based on the same technical concept, an embodiment of the present application further provides a computer device, which includes a memory 1 and a processor 2, as shown in fig. 7, where the memory 1 stores a computer program, and the processor 2 implements any one of the methods for internationalizing web languages when executing the computer program.
The memory 1 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 1 may be an internal storage unit of the web page language internationalization system in some embodiments, such as a hard disk. The memory 1 may also be an external storage device of the web language internationalization system in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on. Further, the memory 1 may also include both an internal storage unit of the web page language internationalization system and an external storage device. The memory 1 may be used not only to store application software installed in the web language internationalization system and various types of data, such as codes of web language internationalization programs, etc., but also to temporarily store data that has been output or is to be output.
The processor 2 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 1 or Processing data, such as executing web page language internationalization programs.
It can be understood that, according to the technical scheme provided by this embodiment, the server creates a JS file specially used for language internationalization configuration of the JS file, and when the client initiates a website access request, the server sends the loaded data carrying the JS file to the client to obtain the language of the browser, and if the JS file supports adaptation of the language of the browser, obtains corresponding language data from the JS file to load, otherwise, loads default language data. Because the international language file and the loading data are sent to the client together, the client does not need to interact with the server in the page loading process, all operations are realized locally, the processing time is reduced, the delay is effectively reduced, the user experience is improved, and the method can be realized without introducing a plug-in, and is simple and easy to realize.
The disclosed embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the method for internationalizing web page language in the above method embodiment. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The computer program product of the web language internationalization method provided by the embodiment of the present disclosure includes a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the steps of the web language internationalization method described in the above method embodiment, which may be referred to in the above method embodiment specifically, and are not described herein again.
The embodiments disclosed herein also provide a computer program, which when executed by a processor implements any one of the methods of the preceding embodiments. The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK) or the like.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer-readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A method for internationalizing web page languages, comprising:
initiating a website access request, wherein the website access request comprises accessed website information;
receiving loading data of the accessed website, wherein the loading data comprise a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
determining a current browser language;
judging whether a language file with the same language as the current browser exists in the at least two different international language files or not;
if the international language file with the same language as the current browser language exists in the at least two different international language files, rendering a current display page and loading language data in the corresponding international language file;
and if the international language file with the same language as the current browser language does not exist in the at least two different international language files, rendering a current display page and loading default language data in the default international language file.
2. The method of internationalization of web page languages of claim 1, wherein prior to said determining a current browser language, said method further comprises:
monitoring the language setting operation of a user;
after monitoring the language setting operation of the user, judging whether the international language files with the same language set by the user exist in the at least two different international language files or not;
the rendering of the current display page and the loading of the language data in the corresponding international language file are as follows: if the international language file with the same language set by the user exists in the at least two different international language files, rendering a current display page and loading language data in the corresponding international language file;
the determining of the current browser language is: and if the international language file which is the same as the language set by the user does not exist in the at least two different international language files, or the language setting operation of the user is not monitored, determining the current browser language.
3. The method of internationalization of web page language of claim 2, wherein the JS page language file comprises a JS page language setting file; after monitoring the language setting operation of the user, judging whether the international language files with the same language set by the user exist in the at least two different international language files comprises the following steps:
after the language setting operation of the user is monitored, modifying a global language variable in the JS page language setting file to enable the global language variable value to be a language identification corresponding to the language set by the user;
and judging whether the international language files with the same language set by the user exist in the at least two different international language files according to the language identification.
4. The method of web page language internationalization according to claim 3, wherein the JS page language file further includes a JS page language storage file, the at least two different international language files being carried by the JS page language storage file;
the step of judging whether the language file with the same language as the current browser language exists in the at least two different international language files is as follows: judging whether the international language file with the same language as the current browser language exists in the JS page language storage file or not;
the step of judging whether the international language file with the same language set by the user exists in the at least two different international language files is as follows: and judging whether the international language file which is the same as the language set by the user exists in the JS page language storage file.
5. A method for internationalizing web page language, comprising:
creating a JS page language file, wherein the JS page language file carries a default international language file and at least two different international language files, and the JS page language file is used for internationalized configuration of a website language;
receiving a website access request, wherein the website access request comprises accessed website information;
acquiring loading data of the accessed website according to the accessed website information, wherein the loading data comprises the JS page language file, so that a website request terminal loads language data in the corresponding international language file or the default international language file according to the JS page language file;
and sending the loading data of the accessed website according to the accessed website information.
6. An apparatus for internationalizing web page language, comprising:
the access request initiating module is used for initiating a website access request, and the website access request comprises accessed website information;
the loading data receiving module is used for receiving loading data of the accessed website, wherein the loading data comprise a JS page language file, and the JS page language file carries a default international language file and at least two different international language files;
the browser language determining module is used for determining the current browser language;
the international language judging module is used for judging whether a language file with the same language as the current browser language exists in the at least two different international language files;
the international language loading module is used for rendering a current display page and loading language data in the corresponding international language file if the international language file with the same language as the current browser language exists in the at least two different international language files;
and the default language loading module is used for rendering a current display page and loading default language data in the default international language file if the international language file with the same language as the current browser does not exist in the at least two different international language files.
7. An apparatus for internationalizing web page language, comprising:
the language file creating module is used for creating a JS page language file, wherein the JS page language file carries a default international language file and at least two different international language files, and the JS page language file is used for internationalized configuration of a website language;
the access request receiving module is used for receiving a website access request, and the website access request comprises accessed website information;
the loading data acquisition module is used for acquiring loading data of the accessed website according to the accessed website information, wherein the loading data comprise the JS page language file, so that a website request terminal loads language data in the corresponding international language file or the default international language file according to the JS page language file;
and the loading data sending module is used for sending the loading data of the accessed website according to the accessed website information.
8. A system for internationalizing web page languages, comprising:
the server is used for creating a JS page language file for internationalized configuration of the website language, wherein the JS page language file carries a default international language file and at least two different international language files, and receiving a website access request initiated by the client, wherein the website access request comprises accessed website information; acquiring loading data of the accessed website according to the accessed website information; sending the loading data to the client according to the accessed website information, wherein the loading data comprises the JS page language file;
the client initiates the website access request to the server, receives the loading data sent by the server and determines the current browser language; judging whether a language file with the same language as the current browser exists in the at least two different international language files or not; if the international language file with the same language as the current browser language exists in the at least two different international language files, rendering a current display page and loading language data in the corresponding international language file; and if the international language file with the same language as the current browser language does not exist in the at least two different international language files, rendering a current display page and loading default language data in the default international language file.
9. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when a computer device is running, the machine-readable instructions when executed by the processor performing the method of web page language internationalization as recited in any of claims 1 to 5.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs a method of internationalizing web page languages according to any one of claims 1 to 5.
CN202210522300.0A 2022-05-13 2022-05-13 Method, device and system for internationalizing webpage language Pending CN114969599A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210522300.0A CN114969599A (en) 2022-05-13 2022-05-13 Method, device and system for internationalizing webpage language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210522300.0A CN114969599A (en) 2022-05-13 2022-05-13 Method, device and system for internationalizing webpage language

Publications (1)

Publication Number Publication Date
CN114969599A true CN114969599A (en) 2022-08-30

Family

ID=82983994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210522300.0A Pending CN114969599A (en) 2022-05-13 2022-05-13 Method, device and system for internationalizing webpage language

Country Status (1)

Country Link
CN (1) CN114969599A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101676904A (en) * 2008-09-19 2010-03-24 中兴通讯股份有限公司 Multilingual method of Web application system and device
CN102402432A (en) * 2010-09-16 2012-04-04 正文科技股份有限公司 Method for creating a multi-lingual web page
CN105138555A (en) * 2015-07-20 2015-12-09 新浪网技术(中国)有限公司 Webpage multi-language internationalization loading method and apparatus
CN108287880A (en) * 2018-01-05 2018-07-17 广东睿江云计算股份有限公司 A kind of international method and device of homepages language

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101676904A (en) * 2008-09-19 2010-03-24 中兴通讯股份有限公司 Multilingual method of Web application system and device
CN102402432A (en) * 2010-09-16 2012-04-04 正文科技股份有限公司 Method for creating a multi-lingual web page
CN105138555A (en) * 2015-07-20 2015-12-09 新浪网技术(中国)有限公司 Webpage multi-language internationalization loading method and apparatus
CN108287880A (en) * 2018-01-05 2018-07-17 广东睿江云计算股份有限公司 A kind of international method and device of homepages language

Similar Documents

Publication Publication Date Title
CN106294658B (en) Webpage quick display method and device
CN102567516B (en) Script loading method and device
CN107402938B (en) Page display method and device and client equipment
CN107704615B (en) Webpage font display method and system based on Chinese font subset
CN110618850A (en) UI (user interface) loading method and system and related device
CN111427596A (en) Software upgrading method and device and terminal equipment
CN105683957A (en) Style sheet speculative preloading
CN112559934A (en) Page popup display method and device
CN111737614A (en) Page display method and device, electronic equipment and storage medium
CN110377850A (en) Resource file loading method, device, electronic equipment and storage medium
US20030237052A1 (en) Method and an apparatus for styling a web service
CN106156291A (en) The caching method of static resource and system thereof based on Localstroage
CN111679828B (en) Data processing method and device, electronic equipment and storage medium
CN114969599A (en) Method, device and system for internationalizing webpage language
CN114327733B (en) Dynamic updating method, device, equipment and medium for starting-up interactive interface
CN108304169B (en) Implementation method, device and equipment for HTML5 application
CN112579938B (en) Page loading method and device, storage medium and electronic equipment
US20140237133A1 (en) Page download control method, system and program for ie core browser
US8615736B2 (en) Module facility for JAVASCRIPT language
CN111475748B (en) Picture display method and device
CN116107673A (en) Screen adaptation method, vehicle-mounted terminal and computer storage medium
US20240045701A1 (en) Method, device and system for loading page data
CN113886228B (en) Compatibility detection method and device, storage medium and electronic equipment
CN113722019B (en) Display method, device and equipment of platform program
CN110764792B (en) Application program installation method, device, equipment 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20220830