CN106569793A - Node.js-based internationalization realization method - Google Patents

Node.js-based internationalization realization method Download PDF

Info

Publication number
CN106569793A
CN106569793A CN201610829968.4A CN201610829968A CN106569793A CN 106569793 A CN106569793 A CN 106569793A CN 201610829968 A CN201610829968 A CN 201610829968A CN 106569793 A CN106569793 A CN 106569793A
Authority
CN
China
Prior art keywords
internationalization
language
business datum
resource file
system user
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.)
Granted
Application number
CN201610829968.4A
Other languages
Chinese (zh)
Other versions
CN106569793B (en
Inventor
刘强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur General Software Co Ltd
Original Assignee
Jinan Inspur Hi Tech Investment and Development 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 Jinan Inspur Hi Tech Investment and Development Co Ltd filed Critical Jinan Inspur Hi Tech Investment and Development Co Ltd
Priority to CN201610829968.4A priority Critical patent/CN106569793B/en
Publication of CN106569793A publication Critical patent/CN106569793A/en
Application granted granted Critical
Publication of CN106569793B publication Critical patent/CN106569793B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • 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
    • 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)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Computational Linguistics (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a Node.js-based internationalization realization method and belongs to the field of software internationalization. The objective of the invention is to solve technical problems of how to meet language requirements in different regions, and extract required language and related culture elements from a system to form resource files which are processed and then return back to contest meeting requirements of system users. The realization method comprises steps of confirming a system language according to language setting of a system user; then, adopting a static resource file mode for page characters and operation prompt information, thereby achieving internationalization; and adopting a mode including a database index and the resource file for service data so as to buffer the resource file; and acquiring internationalization contents according to the database index, thereby achieving internationalization of the service data.

Description

A kind of internationalization implementation method based on Node.js
Technical field
The present invention relates to International Software field, specifically a kind of internationalization implementation method based on Node.js.
Background technology
Node.js is a Javascript running environment (runtime).Actually it is that Google V8 engines are entered Encapsulation is gone.The speed that V8 engines perform Javascript is very fast, and performance is very good.Node.js enters to some special cases Optimization is gone, there is provided the API of replacement so that V8 runs more preferably under non-browser environment.
Node.js is a platform set up when being run based on Chrome JavaScript, for easily building response Speed is fast, be easy to the network application of extension.Node.js uses event-driven, Non-Blocking I/O models and be able to light weight and height Effect, is highly suitable for the intensive real-time application of service data on distributed apparatus.
During software development, to enable it to tackle the access of different parts of the world and country simultaneously, and for different regions and The access of country, there is provided the page or data corresponding, that meet visitor's reading habit.In traditional software systems, process International mode is mostly that interface character is processed by the way of resource file, for the business datum for being stored in database is adopted With the pattern of database resource table, it would be desirable to which the different language form of international business datum is stored in resource table, in web Correlation inquiry when request, to database larger pressure can be formed so that inquiry becomes complicated loaded down with trivial details, is less convenient for Safeguard.
How the language requirement of different regions is met, the culture unit of the language and correlation needed for detaching from system It is technology present in currently available technology that element forms resource file and is acted upon returning to the content for meeting system user requirement Problem.
The content of the invention
The technical assignment of the present invention is for above weak point, there is provided a kind of internationalization realization side based on Node.js Method solving how to meet the language requirement of different regions, the culture of language and correlation needed for detaching from system Element forms resource file and is acted upon returning to the problem of the content for meeting system user requirement.
The technical solution adopted for the present invention to solve the technical problems is:A kind of internationalization realization side based on Node.js Method, the implementation method is to be arranged to confirm after system language, to adopt page character, operation prompt information according to the language of system user Internationalization is realized with the pattern of static resource file, business datum is added resource by the way of resource file using database index File cache, further according to database index internationalization content is obtained, and realizes the internationalization of business datum.
Preferably, the implementation method is comprised the following steps that:
(1), in the system development stage, the internationalized resources file for carrying out different language version is extracted, including system users end page The element of the different language text of face character, operation prompt information and server of the system business datum;Internationalized resources file Including static resource file and the class of business datum resource file two;
(2), increase when database table structure is designed index column, system uses the corresponding state of database index storage business datum Border resource key assignment, and associate with the content formation of internationalized resources file;
(3), when system starts, load business datum resource file, and business datum resource file is put into into caching server, Form internationalized resources cache pool;
(4), system the language that system user is selected is confirmed when receiving page request, first, further according to system client request The index of language and database purchase, reads corresponding internationalized resources file from caching server, will be satisfactory interior Appearance returns to system user;
(5), when Business Processing is carried out, system carries out traffic table inquiry, at the same retrieve business datum it is corresponding internationalization money Source key assignments;
(6), by service inquiry, system obtains business datum and corresponding internationalized resources key assignments, and slow to internationalized resources Deposit in the language and the corresponding internationalization of corresponding internationalized resources key assignments acquisition business datum arranged according to system user in pond Hold, then internationalization content is returned to into system client, realize the internationalization of business datum;
(7), after the completion of server of the system Business Processing, browser when the page is loaded, the language pair that loading system user is arranged The static resource file answered, is replaced to page character and operation prompt information, realizes page character and operation prompt information Internationalization;
(8), when business datum changes, static resource file, business datum resource file and database index are entered Row synchronized update, and the record in caching server is updated, smooth and replace the internationalization content for needing to update.
More preferably, the step(4)Middle system user includes following several situations:
If 1., system user is logged in, the language of extraction system user is arranged;
If 2., system user is not logged in, reads the system user last time language preserved in cookie and arrange;
If 3., there is no relative set in cookie, the default language arranged using browser;
If 4., information above is not present, arranged as the language of system user using the default language of system.
Preferably, the step(7)When business datum is preserved, server of the system preserves business number to middle server of the system According to the index of corresponding resource file.
Compared to the prior art the internationalization implementation method based on Node.js of the present invention, has the advantages that:
1st, arranged according to the language of user and confirmed after system language, to page character, operation prompt information using static resource text The pattern of part realizes internationalization, the internationalization to business datum, by the way of database index plus resource file, by resource File cache, according to index internationalization content is obtained, and realizes the internationalization of business datum, and omnibearing to meet user international Demand, improves the Consumer's Experience of system;
2nd, the language and correlation the invention aims to meet the language requirement of different regions, needed for detaching from system Cultural Elements form resource file and be acted upon returning to the content for meeting user's requirement, solve in traditional software systems In, it is general in the form of database resource table, institute's international character text in need is put in resource table, needing to return This resource table will be associated during the content for returning different language so that inquiry becomes complicated loaded down with trivial details problem.
Therefore the present invention is the features such as have reasonable in design, easy to use, one-object-many-purposes, thus, with promoting the use of well Value.
Description of the drawings
Below in conjunction with the accompanying drawings the present invention is further described.
Accompanying drawing 1 is the FB(flow block) based on the internationalization implementation method of Node.js.
Specific embodiment
Below in conjunction with the accompanying drawings the invention will be further described with specific embodiment.
Embodiment 1
The internationalization implementation method based on Node.js of the present invention, the implementation method is to arrange true according to the language of system user After recognizing system language, internationalization is realized using the pattern of static resource file to page character, operation prompt information, to business number Cache resource file by the way of resource file according to being added using database index, obtain in internationalization further according to database index Hold, realize the internationalization of business datum.
As shown in Figure 1, the implementation method is comprised the following steps that:
(1), in the system development stage, the internationalized resources file for carrying out different language version is extracted, including system users end page The element of the different language text of face character, operation prompt information and server of the system business datum;Internationalized resources file Including static resource file and the class of business datum resource file two;
(2), increase when database table structure is designed index column, system uses the corresponding state of database index storage business datum Border resource key assignment, and associate with the content formation of internationalized resources file;
(3), when system starts, load business datum resource file, and business datum resource file is put into into caching server, Form internationalized resources cache pool;
(4), system the language that system user is selected is confirmed when receiving page request, first, further according to system client request The index of language and database purchase, reads corresponding internationalized resources file from caching server, will be satisfactory interior Appearance returns to system user;
System user includes following several situations:
If 1., system user is logged in, the language of extraction system user is arranged;
If 2., system user is not logged in, reads the system user last time language preserved in cookie and arrange;
If 3., there is no relative set in cookie, the default language arranged using browser;
If 4., information above is not present, arranged as the language of system user using the default language of system;
(5), when Business Processing is carried out, system carries out traffic table inquiry, at the same retrieve business datum it is corresponding internationalization money Source key assignments;
(6), by service inquiry, system obtains business datum and corresponding internationalized resources key assignments, and slow to internationalized resources Deposit in the language and the corresponding internationalization of corresponding internationalized resources key assignments acquisition business datum arranged according to system user in pond Hold, then internationalization content is returned to into system client, realize the internationalization of business datum;
(7), after the completion of server of the system Business Processing, browser when the page is loaded, the language pair that loading system user is arranged The static resource file answered, is replaced to page character and operation prompt information, realizes page character and operation prompt information Internationalization;When business datum is preserved, server of the system preserves the rope of the corresponding resource file of business datum to server of the system Draw;
(8), when business datum changes, static resource file, business datum resource file and database index are entered Row synchronized update, and the record in caching server is updated, smooth and replace the internationalization content for needing to update.
Embodiment 2
The internationalization implementation method based on Node.js of the present invention, it includes page character, operation prompt information and business number According to the internationalization of page character and operation prompt information is realized using the method for static resource file, the internationalization of business datum Realized using the method for resource file plus database index.Specific implementation step is as follows:
(1), define resource file, carry power page character, operation prompt information, the content of business datum, there is provided different language Version;
Resource file externally exports the object of json forms using forms such as javascrpit, json;
The resource file citing of Chinese is presented herein below:
exports.i18n = {
”login”:" login "
}
The resource file of English:
exports.i18n = {
”login”:”login”
};
(2), set up associating for business datum and resource file, when database table structure is designed, increase resource index row, storage Resource key assignment;
(3), system is when starting, and loads resource file, is cached to caching server, forms resource pool;
(4), when user end to server requests for page, server inquires about corresponding index in service inquiry, from caching clothes Corresponding internationalization content is obtained in business device;
(5), most at last satisfactory character string display in Web page.
By specific embodiment above, the those skilled in the art can readily realize the present invention.But should Work as understanding, the present invention is not limited to above-mentioned two kind specific embodiment.On the basis of disclosed embodiment, the technology The technical staff in field can be combined different technical characteristics, so as to realize different technical schemes.
In addition to the technical characteristic described in specification, the known technology of those skilled in the art is.

Claims (4)

1. a kind of internationalization implementation method based on Node.js, it is characterised in that the implementation method is the language according to system user Speech is arranged and confirmed after system language, and internationalization is realized using the pattern of static resource file to page character, operation prompt information, Business datum is added using database index and cache resource file by the way of resource file, further according to database index state is obtained Border content, realizes the internationalization of business datum.
2. the internationalization implementation method based on Node.js according to claim 1, it is characterised in that the tool of the implementation method Body step is as follows:
(1), in the system development stage, the internationalized resources file for carrying out different language version is extracted, including system users end page The element of the different language text of face character, operation prompt information and server of the system business datum;Internationalized resources file Including static resource file and the class of business datum resource file two;
(2), increase when database table structure is designed index column, system uses the corresponding state of database index storage business datum Border resource key assignment, and associate with the content formation of internationalized resources file;
(3), when system starts, load business datum resource file, and business datum resource file is put into into caching server, Form internationalized resources cache pool;
(4), system the language that system user is selected is confirmed when receiving page request, first, further according to system client request The index of language and database purchase, reads corresponding internationalized resources file from caching server, will be satisfactory interior Appearance returns to system user;
(5), when Business Processing is carried out, system carries out traffic table inquiry, at the same retrieve business datum it is corresponding internationalization money Source key assignments;
(6), by service inquiry, system obtains business datum and corresponding internationalized resources key assignments, and slow to internationalized resources Deposit in the language and the corresponding internationalization of corresponding internationalized resources key assignments acquisition business datum arranged according to system user in pond Hold, then internationalization content is returned to into system client, realize the internationalization of business datum;
(7), after the completion of server of the system Business Processing, browser when the page is loaded, the language pair that loading system user is arranged The static resource file answered, is replaced to page character and operation prompt information, realizes page character and operation prompt information Internationalization;
(8), when business datum changes, static resource file, business datum resource file and database index are entered Row synchronized update, and the record in caching server is updated, smooth and replace the internationalization content for needing to update.
3. the internationalization implementation method based on Node.js according to claim 2, it is characterised in that the step(4)In System user includes following several situations:
If 1., system user is logged in, the language of extraction system user is arranged;
If 2., system user is not logged in, reads the system user last time language preserved in cookie and arrange;
If 3., there is no relative set in cookie, the default language arranged using browser;
If 4., information above is not present, arranged as the language of system user using the default language of system.
4. the internationalization implementation method based on Node.js according to claim 2, it is characterised in that the step(7)In When business datum is preserved, server of the system preserves the index of the corresponding resource file of business datum to server of the system.
CN201610829968.4A 2016-09-19 2016-09-19 Js internationalization implementation method based on node Active CN106569793B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610829968.4A CN106569793B (en) 2016-09-19 2016-09-19 Js internationalization implementation method based on node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610829968.4A CN106569793B (en) 2016-09-19 2016-09-19 Js internationalization implementation method based on node

Publications (2)

Publication Number Publication Date
CN106569793A true CN106569793A (en) 2017-04-19
CN106569793B CN106569793B (en) 2020-02-14

Family

ID=58531852

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610829968.4A Active CN106569793B (en) 2016-09-19 2016-09-19 Js internationalization implementation method based on node

Country Status (1)

Country Link
CN (1) CN106569793B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108287880A (en) * 2018-01-05 2018-07-17 广东睿江云计算股份有限公司 A kind of international method and device of homepages language
CN108885544A (en) * 2017-10-10 2018-11-23 深圳中兴力维技术有限公司 Front end page internationalization processing method, application server and computer readable storage medium
CN109582414A (en) * 2018-11-06 2019-04-05 福建天泉教育科技有限公司 Using international method, storage medium
CN109683998A (en) * 2017-10-19 2019-04-26 北京京东尚科信息技术有限公司 Internationalize implementation method, device and system
CN109976840A (en) * 2017-12-27 2019-07-05 航天信息股份有限公司 The method and system of multilingual automatic adaptation are realized under a kind of separation platform based on front and back
CN110673915A (en) * 2019-09-24 2020-01-10 四川天邑康和通信股份有限公司 Web management page language switching method for ONU
CN111488339A (en) * 2019-01-25 2020-08-04 上海哔哩哔哩科技有限公司 NoSQ L database based on node.JS, and establishing and processing method
CN113157354A (en) * 2020-01-07 2021-07-23 北京京东振世信息技术有限公司 Method, device, equipment and computer readable medium for processing data
CN114491359A (en) * 2021-12-28 2022-05-13 北京航天智造科技发展有限公司 Webpage internationalization processing method and device
CN115618887A (en) * 2022-10-17 2023-01-17 北京志凌海纳科技有限公司 Dynamic long text internationalization method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101894025A (en) * 2010-07-26 2010-11-24 沈阳酷洲软件开发有限公司 Dynamic electronic information internationalizing method
US20110264440A1 (en) * 2010-04-21 2011-10-27 Ling Zhou Methods and apparatus to display localized resources in process control applications
CN103544306A (en) * 2013-11-01 2014-01-29 广东威创视讯科技股份有限公司 Multi-language display supporting method and device of website
CN104375808A (en) * 2013-07-11 2015-02-25 携程计算机技术(上海)有限公司 Method and device for displaying interfaces
CN104714968A (en) * 2013-12-16 2015-06-17 中国银联股份有限公司 Method and device for internationalizing web page

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110264440A1 (en) * 2010-04-21 2011-10-27 Ling Zhou Methods and apparatus to display localized resources in process control applications
CN101894025A (en) * 2010-07-26 2010-11-24 沈阳酷洲软件开发有限公司 Dynamic electronic information internationalizing method
CN104375808A (en) * 2013-07-11 2015-02-25 携程计算机技术(上海)有限公司 Method and device for displaying interfaces
CN103544306A (en) * 2013-11-01 2014-01-29 广东威创视讯科技股份有限公司 Multi-language display supporting method and device of website
CN104714968A (en) * 2013-12-16 2015-06-17 中国银联股份有限公司 Method and device for internationalizing web page

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108885544A (en) * 2017-10-10 2018-11-23 深圳中兴力维技术有限公司 Front end page internationalization processing method, application server and computer readable storage medium
CN109683998A (en) * 2017-10-19 2019-04-26 北京京东尚科信息技术有限公司 Internationalize implementation method, device and system
CN109976840A (en) * 2017-12-27 2019-07-05 航天信息股份有限公司 The method and system of multilingual automatic adaptation are realized under a kind of separation platform based on front and back
CN109976840B (en) * 2017-12-27 2022-03-04 航天信息股份有限公司 Method and system for realizing multi-language automatic adaptation based on foreground and background separation platform
CN108287880A (en) * 2018-01-05 2018-07-17 广东睿江云计算股份有限公司 A kind of international method and device of homepages language
CN109582414A (en) * 2018-11-06 2019-04-05 福建天泉教育科技有限公司 Using international method, storage medium
CN111488339A (en) * 2019-01-25 2020-08-04 上海哔哩哔哩科技有限公司 NoSQ L database based on node.JS, and establishing and processing method
CN111488339B (en) * 2019-01-25 2023-10-27 上海哔哩哔哩科技有限公司 NoSQL database based on node.JS, establishing and processing method
CN110673915A (en) * 2019-09-24 2020-01-10 四川天邑康和通信股份有限公司 Web management page language switching method for ONU
CN113157354A (en) * 2020-01-07 2021-07-23 北京京东振世信息技术有限公司 Method, device, equipment and computer readable medium for processing data
CN113157354B (en) * 2020-01-07 2023-11-03 北京京东振世信息技术有限公司 Method, apparatus, device and computer readable medium for processing data
CN114491359A (en) * 2021-12-28 2022-05-13 北京航天智造科技发展有限公司 Webpage internationalization processing method and device
CN115618887A (en) * 2022-10-17 2023-01-17 北京志凌海纳科技有限公司 Dynamic long text internationalization method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN106569793B (en) 2020-02-14

Similar Documents

Publication Publication Date Title
CN106569793A (en) Node.js-based internationalization realization method
CN1284102C (en) Web page providing method and apparatus and program
CN103782294B (en) Remote browsing session management
CN105279224B (en) Information-pushing method and device
CN102193953B (en) System and method for migrating desktop applications
CN104317874B (en) A kind of method and apparatus of dynamic web page static
JP2017220205A (en) Method and system for dynamically rankings images to be matched with content in response to search query
CN103383687B (en) A kind of page processing method and device
CN101000623A (en) Method for image identification search by mobile phone photographing and device using the method
CN107784059A (en) For searching for and selecting the method and system and machine-readable medium of image
CN102651021B (en) Icon content updating method and device
CN107092639A (en) A kind of search engine system
CN103827778B (en) Enterprise tools strengthen
CN105302876A (en) Regular expression based URL filtering method
CN109815432A (en) A kind of method of the method and page static of whole station static
CN113946399B (en) Space data loading method and device
CN105518644A (en) Method for processing and displaying real-time social data on map
CN105550206A (en) Version control method and device for structured query language
CN108984641A (en) A kind of method for page jump based on WEB terminal
JP2017220204A (en) Method and system for matching images with content using whitelists and blacklists in response to search query
CN105897887A (en) Clouding computing-based remote sensing satellite big data processing system and method
CN102222108B (en) Scripting method and device
CN105204806A (en) Individual display method and device for mobile terminal webpage
CN110268388A (en) Postpone the call request to remote object
US10432702B1 (en) Separated device detection architecture

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200109

Address after: 250100 Ji'nan high tech Zone, Shandong, No. 1036 wave road

Applicant after: Tidal Group Co., Ltd.

Address before: 250100, Shandong, Ji'nan Province town of Sun Ke Road, No. 2877 R & D building on the first floor

Applicant before: Ji'nan wave high and New Technology Investment Development Co., Ltd.

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200902

Address after: 250100 Ji'nan high tech Zone, Shandong, No. 1036 wave road

Patentee after: INSPUR GENERAL SOFTWARE Co.,Ltd.

Address before: 250100 Ji'nan high tech Zone, Shandong, No. 1036 wave road

Patentee before: INSPUR GROUP Co.,Ltd.