1. Technical Field
The embodiments of the present disclosure relate to information processing technology, and particularly to a webpage conversion system and method.
2. Description of Related Art
A website may be displayed in different languages and for different people. For example, if the website is displayed in Chinese, the website may be for the people who know Chinese. If the website is displayed in English, the website may be for the people who know English. However, at present, most website establishes an independent page for each language, which may result in difficulty of maintaining the website. Therefore, there is room for improvement in the art.
The disclosure is illustrated by way of examples and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one.”
In general, the word “module”, as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, JAVA, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an EPROM. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable median include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives.
Each database 5 may store data corresponding to a specific language. The language may be, but is not limited to, Chinese, English, Japanese, or any other language. For example, if the computer 2 is connected to three databases 5, namely database A, database B, and database C. The database A may store data corresponding to Chinese, the database B may store data corresponding to English, and the database C may store data corresponding to Japanese.
The obtaining module 210 obtains language configuration in a browser. The language configuration corresponds to a language and includes an identifier of the language. The identifier of the language is predetermined by a user. For example, the identifier of Chinese is donated by letters “CN,” the identifier of English is donated by the letters “EN,” and the identifier of Japanese is donated by the letters “JP.” A user is capable of changing the language configuration. For example, the user may change the identifier from “EN” to “CN.”
The obtaining module 210 obtains language tags of a webpage in the browser. The language tags indicate positions in the webpage. For example, the language tags indicate where data (e.g., pictures or words) of the webpage is positioned in the webpage. The obtaining module 210 converts the webpage into a format of source code, and obtains the language tags from the source code of the webpage. The language tags may be, but are not limited to, a HTML tag including span elements. The language tags also include specific characters (e.g., “lang”), the obtaining module 210 obtains the language tags by searching the specific characters in the source code of the webpage. For example, one language tag is searched in the source code of the webpage, such as, “<span lang=“lang_spanusermail”> <span>” of the HTML syntax. The language tag may contain a piece of information. For example, the language tag “<span lang=“lang_spanusermail”> <span>” contains the piece of information “Email: a@b.com,” which is changed to “<span lang=“lang_spanusermail”> Email: a@b.com <span>.”
The search module 220 searches for a language file according to the language configuration. The language file may be but is not limited to, a TXT file, a WORD file, or a PDF file. The language file includes the language tags. The language file corresponds to language configuration, and the language tags in the language file also correspond to the language configuration. For example, if the language configuration corresponds to English, then the language file corresponds to English, and all pieces of information in the language file are also written in English. The language file is stored in the computer 2.
The display module 230 replaces the language tags in the webpage with the language tags in the language file.
The obtaining module 210 obtains the serial number of the database 5 according to the language configuration.
The display module 230 connects to the database 5 according to the serial number of the database 5 and displays data from the database 5 in the webpage.
The determination module 240 determines if the language configuration is reset. For example, assuming that the language configuration currently corresponds to English, if the user reset the language configuration from English to Chinese, the language configuration is reset.
The display module 230 replaces the language tags in the webpage using the language tags in the language file corresponding to the reset language configuration, and displays data corresponding to the reset language configuration, in response to a determination that the language configuration is reset. In one embodiment, if the language configuration is reset to Chinese from English, the display module 230 searches for the language file corresponding to Chinese, connects to the database 5 corresponding to Chinese, and displays the data corresponding to Chinese from the database 5 in the webpage.
In step S10, the obtaining module 210 obtains language configuration in a browser. For example, the identifier of Chinese is donated by letters “CN,” the identifier of English is donated by the letters “EN,” and the identifier of Japanese is donated by the letters “JP.”
In step S20, the obtaining module 210 obtains language tags of a webpage in the browser. The language tags indicate positions in the webpage. For example, the language tags indicate where data (e.g., pictures, or words) of the webpage is positioned in the webpage. The obtaining module 210 converts the webpage into a format of source code, and obtains the language tags from the source code of the webpage. The language tags may be, but are not limited to, a HTML tag including span elements. The language tags also include specific characters (e.g., “lang”), the obtaining module 210 obtains the language tags by searching the specific characters in the source code of the webpage. For example, one language tag is searched out in the source code of the webpage, such as, “<span lang=“lang_spanusermail”> <span>.” The language tag may contain a piece of information. For example, the language tag “<span lang=“lang_spanusermail”> <span>” contains the piece of information “Email: a@b.com,” which is changed to “<span lang=“lang_spanusermail”> Email: a@b.com <span>.”
In step S30, the search module 220 searches for a language file according to the language configuration. As mentioned above, if the language configuration corresponds to English, then the language file corresponds to English, and all pieces of information in the language file are also written in English. The language file may be also stored into the database 5 corresponding to the language. For example, if the language file corresponds to English, the language file is stored into the database 5 corresponding to English.
In step S40, the display module 230 replaces the language tags in the webpage with the language tags in the language file.
In step S50, the obtaining module 210 obtains the serial number of the database 5 according to the language configuration.
In step S60, the display module 230 connects to the database 5 according to the serial number of the database 5 and displays data from the database 5 in the webpage.
In step S70, the determination module 240 determines if the language configuration is reset. In one embodiment, if the language configuration is reset, the procedure goes to step S80. Otherwise, if the language configuration is not reset, the procedure ends.
In step S80, the display module 230 replaces the language tags in the webpage using the language tags in the language file corresponding to the reset language configuration, and displays data corresponding to the reset language configuration.
Although certain inventive embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
102102796 | Jan 2013 | TW | national |