TW202324140A - System for using target language corresponding to page language to displaying webpage and method thereof - Google Patents
System for using target language corresponding to page language to displaying webpage and method thereof Download PDFInfo
- Publication number
- TW202324140A TW202324140A TW110146124A TW110146124A TW202324140A TW 202324140 A TW202324140 A TW 202324140A TW 110146124 A TW110146124 A TW 110146124A TW 110146124 A TW110146124 A TW 110146124A TW 202324140 A TW202324140 A TW 202324140A
- Authority
- TW
- Taiwan
- Prior art keywords
- language
- page
- character string
- string
- module
- Prior art date
Links
Images
Abstract
Description
一種多語言網頁顯示系統及其方法,特別係指一種以對應頁面語種之目標語種顯示網頁頁面之系統及方法。A multilingual web page display system and method thereof, particularly a system and method for displaying web pages in a target language corresponding to the page language.
隨著企業產品、民族文化等在文化與經濟在國際間發展,資訊領域的發展主流之一為國際化,也就是讓網頁或應用程式與語言分離,藉以可以輕易地改變網頁或應用程式的語言而無須修改網頁或應用程式。With the international development of corporate products, national culture, etc. in culture and economy, one of the mainstream developments in the information field is internationalization, that is, to separate the webpage or application from the language, so that the language of the webpage or application can be easily changed without modifying web pages or applications.
在網頁專案中,目前讓網頁頁面呈現國際化的多語言方案主要是在頁面中需要呈現多語言的區域填入變數或鍵值,並為各種語言提供不同的資源檔。當客戶端發出頁面請求時,伺服端可以依據變數或鍵值由各個語言的資源檔中讀出對應的字串並以所讀出之字串取代網頁頁面中的變數或鍵值,使得網頁頁面支援多語言。In web projects, the current multilingual solution to make web pages internationalized is mainly to fill in variables or key values in areas that need to be multilingual on the page, and provide different resource files for each language. When the client sends a page request, the server can read the corresponding string from the resource file of each language according to the variable or key value and replace the variable or key value in the web page with the read string, so that the web page Supports multiple languages.
在上述實現方案中,與不提供多語言的網頁相比,開發人員需要先定義鍵值或變數的名稱,並在網頁頁面中的對應位置填入鍵值或變數,而後要收集所有的鍵值或變數並製作對應各種語言的資源檔,如此,增加了開發人員的工作量。同時,因為鍵值或變數需要特別彙整,因此,也容易發生某些網頁頁面中的鍵值或變數被開發人員遺漏而導致在客戶端顯示網頁頁面時鍵值或變數直接被顯示在網頁頁面中的情況。In the above implementation scheme, compared with web pages that do not provide multiple languages, developers need to first define the names of key values or variables, and fill in the key values or variables in the corresponding positions on the web page, and then collect all key values or variables and make resource files corresponding to various languages, thus increasing the workload of developers. At the same time, because the key values or variables need to be specially compiled, it is also easy to happen that the key values or variables in some web pages are omitted by the developer, resulting in the key values or variables being directly displayed in the web page when the client displays the web page Case.
綜上所述,可知先前技術中長期以來一直存在開發多語言網頁會增加開發人員工作量的問題,因此有必要提出改進的技術手段,來解決此一問題。To sum up, it can be seen that there has been a long-standing problem in the prior art that developing multilingual webpages will increase the workload of developers. Therefore, it is necessary to propose improved technical means to solve this problem.
有鑒於先前技術存在開發多語言網頁會增加開發人員工作量的問題,本發明遂揭露一種以對應頁面語種之目標語種顯示網頁頁面之系統及方法,其中:In view of the problem that the development of multilingual webpages in the prior art will increase the workload of developers, the present invention discloses a system and method for displaying webpages in the target language corresponding to the language of the page, wherein:
本發明所揭露之以對應頁面語種之目標語種顯示網頁頁面之系統,至少包含:資料載入模組,用以載入網頁頁面;語種判斷模組,用以判斷判斷網頁頁面之頁面語種與目標語種是否相同,資料載入模組更用以於頁面語種與目標與種不同時,載入語言資源檔;頁面剖析模組,用以剖析網頁頁面之原始碼,並取得網頁頁面所包含之特定網頁元素中之第一字串;字串取代模組,用以由語言資源檔中取得與第一字串對應且為目標語種之第二字串,並於網頁頁面中以第二字串取代第一字串;頁面顯示模組,用以顯示字串取代後之網頁頁面。The system for displaying web pages in the target language corresponding to the page language disclosed by the present invention at least includes: a data loading module for loading web pages; a language judgment module for judging the language and target of the web pages Whether the language is the same, the data loading module is used to load the language resource file when the language of the page is different from the target type; the page analysis module is used to analyze the source code of the web page and obtain the specific information contained in the web page The first character string in the web page element; the character string replacement module is used to obtain the second character string corresponding to the first character string and the target language from the language resource file, and replace it with the second character string in the web page The first string; a page display module, used to display the web page after the string is replaced.
本發明所揭露之以對應頁面語種之目標語種顯示網頁頁面之方法,其步驟至少包括:載入網頁頁面;判斷網頁頁面之頁面語種與目標語種不同時,載入語言資源檔;剖析網頁頁面之原始碼,並取得網頁頁面所包含之特定網頁元素中之第一字串;由語言資源檔中取得與第一字串對應且為目標語種之第二字串;於網頁頁面中以第二字串取代第一字串;顯示字串取代後之網頁頁面。The method for displaying a web page in a target language corresponding to the page language disclosed by the present invention, the steps at least include: loading the web page; judging that the page language of the web page is different from the target language, loading the language resource file; analyzing the content of the web page Source code, and obtain the first character string in the specific web page element contained in the web page; obtain the second character string corresponding to the first character string and the target language from the language resource file; use the second character string in the web page String to replace the first string; display the web page after the string is replaced.
本發明所揭露之系統與方法如上,與先前技術之間的差異在於本發明透過判斷網頁頁面之頁面語種與目標語種不同時載入語言資源檔,並取得網頁頁面所包含之特定網頁元素中之第一字串後,由語言資源檔中取得與第一字串對應且為目標語種之第二字串,於網頁頁面中以第二字串取代第一字串,藉以解決先前技術所存在的問題,並可以達成降低開發人員工作量的技術功效。The system and method disclosed in the present invention are as above, and the difference between it and the prior art is that the present invention loads the language resource file at the same time by judging that the page language of the web page is different from the target language, and obtains the specific web page elements included in the web page. After the first string, obtain the second string corresponding to the first string and the target language from the language resource file, and replace the first string with the second string in the web page, so as to solve the problems existing in the prior art problems, and can achieve the technical effect of reducing the workload of developers.
以下將配合圖式及實施例來詳細說明本發明之特徵與實施方式,內容足以使任何熟習相關技藝者能夠輕易地充分理解本發明解決技術問題所應用的技術手段並據以實施,藉此實現本發明可達成的功效。The features and implementation methods of the present invention will be described in detail below in conjunction with the drawings and embodiments, the content is enough to enable anyone familiar with the relevant art to easily and fully understand the technical means used to solve the technical problems of the present invention and implement them accordingly, thereby realizing The effect that the present invention can achieve.
本發明可以依據網頁頁面的頁面語種將網頁頁面中的文字內容取代為目標語種的同義文字。其中,目標語種通常為使用者的第一語言或慣用語言,但本發明並不以此為限。According to the page language of the web page, the present invention can replace the text content in the web page with the synonymous text of the target language. Wherein, the target language is usually the user's first language or customary language, but the present invention is not limited thereto.
以下先以「第1圖」本發明所提之以對應頁面語種之目標語種顯示網頁頁面之系統架構圖來說明本發明的系統運作。如「第1圖」所示,本發明之系統應用在客戶端100中,含有資料載入模組110、語種判斷模組120、頁面剖析模組130、字串取代模組150、頁面顯示模組160,及可附加的資料傳輸模組170。其中,要說明的是,客戶端100可以是習知的網頁瀏覽程式,如此,資料載入模組110與頁面顯示模組160為客戶端100的原有功能,語種判斷模組120、頁面剖析模組130、字串取代模組150、資料傳輸模組170等模組則可以由客戶端100之外掛程式或擴充元件所提供,但本發明並不以此為限,客戶端100也可以是包含本發明之語種判斷模組120、頁面剖析模組130、字串取代模組150、資料傳輸模組170等模組的新網頁瀏覽程式。The system operation of the present invention will be described below with "Fig. 1", a system architecture diagram of displaying webpages in the target language corresponding to the page language mentioned in the present invention. As shown in "Fig. 1", the system of the present invention is applied in the
資料載入模組110負責載入網頁頁面(webpage)。一般而言,網頁頁面是向伺服端200請求而取得,但本發明並不以此為限,例如,資料載入模組110也可以直接載入儲存於客戶端100上的網頁頁面。The
資料載入模組110也負責載入語言資源檔。一般而言,資料載入模組110可以在語種判斷模組120產生資源載入訊息時或語種判斷模組120所產生之語種判斷結果表示語種不同時,載入與語種判斷模組120所判斷出之頁面語種對應的語言資源檔,但資料載入模組110判斷載入語言資源檔之時機並不以上述為限。資料載入模組110所載入的語言資源檔中可以記載以頁面語種呈現之各種單字、單詞與句子在以目標語種所呈現之同意的文字及目標語種的語種識別資料。例如,若頁面語種為中文,目標語種為英文,則語言資源檔中可以包含以頁面語種呈現的單詞「使用者帳號」、目標語種的語種識別資料「en-us」、及以目標語種呈現之相同意義的單詞「account」。The
語種判斷模組120負責判斷資料載入模組110所載入之網頁頁面的頁面語種。舉例來說,語種判斷模組120可以取得網頁頁面的頁面內碼(codepage),並依據頁面內碼得知網頁頁面的頁面語種;語種判斷模組120也可以依據儲存網頁頁面所使用的編碼得知網頁頁面的頁面語種;語種判斷模組120也可以依據網頁頁面中之字符所屬的字元集得知網頁頁面的頁面語種,但語種判斷模組120取得網頁頁面之頁面語種的方式並不以上述為限。The
語種判斷模組120也負責判斷所取得之網頁頁面的頁面語種與目標語種是否相同,並負責在判斷頁面語種與目標語種不同時通知資料載入模組110,例如,語種判斷模組120可以在判斷頁面語種與目標語種不同時產生資源載入訊息並可以將資源載入訊息提供給資料載入模組110,也可以產生頁面語種與目標語種是否相同的語種判斷結果並將語種判斷結果提供給資料載入模組110,但本發明並不以此為限。其中,語種判斷模組120可以提供設定目標語種。The
頁面剖析模組130負責剖析(phase)資料載入模組110所載入之網頁頁面的原始碼。由於剖析網頁頁面之原始碼的方式已為習知,如習知網頁瀏覽程式所使用之方式,故本發明不再贅述。The
頁面剖析模組130也負責依據資料載入模組110所載入之網頁頁面的剖析結果取得網頁頁面所包含的各種網頁元素,並負責由所取得之特定的網頁元素(在本發明中也可能以「特定網頁元素」表示)中取出元素內容,在本發明中被頁面剖析模組130所取出的元素內容也被稱為「第一字串」。其中,特定網頁元素為能夠在網頁頁面中呈現元素內容的網頁元素,包含但不限於p元素、div元素、span元素、lable元素等容器元素。The
頁面剖析模組130也可以先判斷特定網頁元素的屬性是否滿足替換條件,並可以在特定網頁元素之屬性滿足替換條件時才由特定網頁元素中取出第一字串。其中,替換條件可以是特定網頁元素之屬性為特定字串或特定屬性之資料為特定字串等,但本發明所提之替換條件並不以上述為限。The
字串取代模組150負責判斷資料載入模組110所載入之語言資源檔中是否包含頁面剖析模組130所取得之第一字串。字串取代模組150也負責在語言資源檔中包含第一字串時,由語言資源檔中取得與第一字串及與目標語種之語種識別資料對應的第二字串,也就是取得與第一字串同意且以目標語種呈現的第二字串。字串取代模組150並負責將資料載入模組110所載入之網頁頁面中的第一字串取代為第二字串。The
頁面顯示模組160負責顯示字串取代模組150將第一字串取代為第二字串後的網頁頁面。The
資料傳輸模組170可以在字串取代模組150判斷資料載入模組110所載入之語言資源檔中沒有包含頁面剖析模組130所取得的第一字串時,將第一字串及目標語種的語種識別資料傳送給伺服端200。在部分的實施例中,字串取代模組150可以透過非同步方法(
Asynchronous Method)將第一字串傳送給伺服端200,但本發明並不以此為限。
The
伺服端200可以提供網頁頁面及語言資源檔。伺服端200更可以如「第2圖」之元件示意圖所示,包含網路服務模組210、資料處理模組220、字串產生模組230、資料編輯模組240、資源更新模組250。The
網路服務模組210可以傳送客戶端100所請求的網頁頁面與語言資源檔,並可以接收客戶端100所傳送的第一字串及語種識別資料。其中,網路服務模組210可以包含網頁伺服元件(圖中未示),網頁伺服元件可以提供網頁頁面與語言資源檔給客戶端100,並可以提供應用程式介面(API)給客戶端100上傳第一字串,但本發明並不以此為限,例如,網路服務模組210也可以包含提供網頁頁面與語言資源檔的網頁伺服元件及提供應用程式介面的資料接收元件。The
資料處理模組220可以儲存網路服務模組210所接收到的第一字串及語種識別資料。舉例來說,資料處理模組220可以將第一字串與語種識別資料儲存到待辦資源檔中。在部分的實施例中,資料處理模組220也可以在接收到第一字串時通知管理者。The
字串產生模組230可以取得與資料處理模組220所儲存之第一字串對應的第二字串。例如,字串產生模組230可以先依據資料處理模組220所儲存之語種識別資料取得對應的目標語種,再產生包含目標語種與資料處理模組220所儲存之第一字串的翻譯請求,並可以將所產生之翻譯請求傳送給外部伺服器(圖中未示),及可以接收外部伺服器依據目標語種翻譯第一字串所產生之翻譯結果,其中,字串產生模組230所接收到之翻譯結果即為第二字串;又如,字串產生模組230也可以使用執行伺服端200之計算設備中的翻譯資料庫查詢第一字串在與語種識別資料對應之目標語種所呈現的文字。但字串產生模組230取得與第一字串對應之第二字串的方式並不以上述為限。The
資料編輯模組240可以提供輸入與資料處理模組220所儲存之第一字串對應的第二字串。資料編輯模組240可以在執行伺服端200之計算設備上提供使用者介面,使得開發管理人員透過使用者介面輸入以目標語種呈現之與第一字串同意的第二字串;資料編輯模組240也可以透過網路服務模組210提供使用者介面給管理端(圖中未示),使得開發維護人員可以操作管理端在使用者介面中輸入以目標語種呈現之與第一字串同意的第二字串並將第二字串傳送到伺服端200,藉以讓資料編輯模組240透過網路服務模組210取得第二字串。但資料編輯模組240取得與第一字串對應之第二字串的方式並不以上述為限。其中,資料編輯模組240所提供之使用者介面能夠顯示第一字串及提示與資料處理模組220所儲存之語種識別資料所表示之目標語種。The
在部分的實施例中,資料編輯模組240也可以檢核被輸入之第二字串是否為與資料處理模組220所儲存之語種識別資料對應的目標語種。In some embodiments, the
資源更新模組250可以將資料處理模組220所儲存之語種識別資料及字串產生模組230或資料編輯模組240所取得的第二字串加入提供給客戶端100的語言資源檔中。舉例來說,資源更新模組250可以開啟與第一字串之語種對應的語言資源檔中,並可以在語言資源檔中搜尋第一字串。若有搜尋到第一字串,則資源更新模組250可以將語種識別資料與第二字串依照預定的格式加入記載第一字串的段落中,藉以將語種識別資料與第二字串寫入語言資源檔中;而若資源更新模組250沒有搜尋到第一字串,則資源更新模組250可以將第一字串、語種識別資料及第二字串依照預定的格式寫入語言資源檔的最後段落或符合排序(如依筆畫或部首排序)的段落。The
資源更新模組250也可以依據開發維護人員所管理之資源整合檔產生與一種或多種語種對應的語言資源檔。一般而言,資源整合檔包含多個鍵值及與各個鍵值對應的語言資料。其中,資源整合檔中的鍵值不會重複,但可能與不同語種的鍵值具有相同的意義,例如,資源整合檔中可以同時存在「使用者帳號」與「Account」兩個鍵值;每一個鍵值可以對應一筆或多筆語言資料,每一筆語言資料可以包含特定語種的語種識別資料及以特定語種呈現之與鍵值相同意義的文字。The
資源更新模組250可以由資源整合檔中分別取出鍵值之語種相同的語言資料,並分別將所取出之語言資料儲存為與被取出之語言資料之語種對應的語言資源檔,藉以產生與各語種對應的語言資源檔;資源更新模組250也可以由資源整合檔中取出鍵值之為特定語種的語言資料,並將所取出之語言資料儲存為與該特定語種對應的語言資源檔。The
但資源更新模組250產生語言資源檔的方式並不以上述為限,例如,資源更新模組250也可以依據資源整合檔產生同時與兩種語種對應的語言資源檔,例如,產生同時與頁面語種與目標語種對應的語言資源檔,更詳細的,資源更新模組250可以由資源整合檔中取出鍵值為頁面語種且包含以目標語種呈現之文字的語言資料,如此,資源更新模組250便可以產生包含第一字串與第二字串之與頁面語種及目標語種對應的語言資源檔。However, the way the
資源更新模組250可以在判斷語言資源檔不存在時依據資源整合檔產生語言資源檔。例如,資源更新模組250可以在伺服端200被啟動時檢查與各個語種對應的語言資源檔是否存在或可以在特定語種對應的語言資源檔被開啟時先檢查與該語種對應的語言資源檔是否存在。若有語言資源檔不存在,則資源更新模組250可以產生相對應的語言資源檔。The
要特別說明的是,客戶端100與伺服端200通常可以被安裝在不同的計算設備上執行,分別執行客戶端100與伺服端200的計算設備可以透過有線或無線網路相互傳遞資料或訊號。但本發明並不限於將客戶端100與伺服端200安裝在兩個不同的計算設備上執行,客戶端100與伺服端200也可以安裝在同一個計算設備上執行,在此情況下,客戶端100的資料傳輸模組170可以不存在,字串取代模組150可以將第一字串直接提供給網路服務模組220或資料處理模組220。It should be noted that the
接著以一個實施例來解說本發明的運作系統與方法,並請參照「第3A圖」本發明所提之以對應頁面語種之目標語種顯示網頁頁面之方法流程圖。Next, an embodiment is used to illustrate the operating system and method of the present invention, and please refer to "FIG. 3A" for the flow chart of the method for displaying web pages in the target language corresponding to the page language in the present invention.
當網頁開發人員使用本發明開發多語言網頁時,網頁開發人員可以操作客戶端100瀏覽欲測試的網頁,使得客戶端100中的資料載入模組110由伺服端200載入網頁頁面(步驟310)。在本實施例中,不論客戶端100與伺服端200是在相同的計算設備中執行或分別在透過網路連接的不同計算設備中執行,資料載入模組110都可以向伺服器200的網路服務模組210請求下載網頁並在完成網頁下載後載入網頁頁面。When a webpage developer uses the present invention to develop a multilingual webpage, the webpage developer can operate the
在客戶端100的資料載入模組110載入網頁頁面(步驟310)後,客戶端100的語種判斷模組120可以判斷被載入之網頁頁面的頁面語種是否與目標語種相同。在本實施例中,若客戶端100為習知之瀏覽器程式,網頁開發人員可以在客戶端100中安裝支援本發明的外掛程式或擴充元件,使得客戶端100在外掛程式或擴充元件被執行後包含本發明的各個模組;網頁開發人員也可以在欲測試的網頁中加入載入支援本發明之腳本檔案的語法,使得客戶端110在載入網頁頁面後繼續載入並執行腳本檔案而產生本發明的語種判斷模組120、頁面剖析模組130、字串取代模組150等模組。After the
若客戶端100的語種判斷模組120判斷資料載入模組110所載入之網頁頁面的頁面語種與目標語種相同,則字串取代模組150不會取代網頁頁面中的任何字串,頁面顯示模組160可以依據資料載入模組110所載入之網頁頁面的原始碼顯示網頁頁面的網頁內容;而若客戶端100的語種判斷模組120判斷資料載入模組110所載入之網頁頁面的頁面語種與目標語種不同,則資料載入模組110可以載入語言資源檔(步驟320)。在本實施例中,假設頁面語種為中文,目標語種為英文,則語種判斷模組120可以產生包含下載路徑的資源載入訊息,資料載入模組110可以依據下載路徑載入與頁面語種對應的語言資源檔或資源整合檔。If the
實務上,在伺服端200被執行時,或在資料載入模組請求下載與所載入之網頁頁面之頁面語種對應的語言資源檔時,伺服端200的資源更新模組250可以如「第3B圖」之流程所示,依據單一語種或任意兩語種之組合由資源整合檔中取出語言資料以產生相對應的語言資源檔(步驟390),例如,資源更新模組250可以由資源整合檔中取出鍵值之語種為中文的語言資料以產生與中文對應的語言資源檔,相似的,資源更新模組250也可以由資源整合檔中分別取出鍵值之語種為英文、日文、或西文的語言資料並產生分別與英文、日文、或西文等單一語種對應的語言資源檔;資源更新模組250也可以由資源整合檔中取出鍵值之語種為中文且語種識別資料表示為英文之語言資料,相似的,資源更新模組250也可以由資源整合檔中取出鍵值之語種為中文且語種識別資料表示為日文/西文之語言資料,且由資源整合檔中取出鍵值之語種為英文且語種識別資料表示為中文/日文/西文之語言資料,藉以產生分別與中文及英文(或日文、或西文)、英文及中文(或日文、或西文)等兩種語種對應的語言資源檔。In practice, when the
同樣在客戶端100的資料載入模組110載入網頁頁面(步驟310)後,客戶端100的頁面剖析模組130可以剖析被載入之網頁頁面的原始碼,並取得網頁頁面所包含之特定網頁元素中的第一字串(步驟330)。在本實施例中,假設頁面剖析模組130可以如「第3C圖」之流程所示,在剖析網頁頁面(步驟331)後,可以取得網頁頁面中的所有網頁元素(步驟333),並可以由所取得之網頁元素中篩選出容器元素。其中,頁面剖析模組130更可以逐一判斷所取得之網頁元素(容器元素)的屬性是否滿足替換條件(步驟335),若否,則頁面剖析模組130將繼續判斷其他未判斷過是否滿足替換條件的網頁元素(步驟339),而若頁面剖析模組130判斷網頁元素的屬性滿足替換條件,例如網頁元素存在「noi18n」的屬性,或網頁元素的某個屬性值為「noi18n」,則頁面剖析模組130可以由網頁元素中取得元素內容作為第一字串(步驟337),並持續判斷是否還有未判斷是否滿足替換條件的網頁元素(步驟339),直到所有取得的網頁元素都經過判斷為止。Also after the
在客戶端100的頁面剖析模組130取得資料載入模組110所載入之網頁頁面所包含之特定網頁元素中的第一字串(步驟330)後,客戶端100的字串取代模組150可以由資料載入模組110所載入之語言資源檔中取得與第一字串對應且為目標語種的第二字串(步驟350),並可以在網頁頁面中使用所取得之第二字串取代第一字串(步驟360)。在本實施例中,假設字串取代模組150可以由與網頁頁面之頁面語種對應的語言資源檔中取得鍵值為第一字串且與種識別資料表示為目標語種的第二字串,並可以將網頁頁面中的第一字串取代為第二字串,例如,第一字串為「使用者帳號」,第二字串為「Account」。After the
在客戶端100的字串取代模組150在網頁頁面中以所取得之第二字串取代第一字串(步驟360)後,客戶端100的頁面顯示模組160可以顯示第一字串被第二字串取代的網頁頁面(步驟370)。在本實施例中,中文的網頁頁面將被頁面顯示模組160顯示為英文的網頁頁面。After the character
另外,在客戶端100的字串取代模組150由資料載入模組110所載入之語言資源檔中取得與第一字串對應且為目標語種的第二字串(步驟350)時,字串取代模組150可以如「第3D圖」之流程所示,先判斷語言資源檔是否包含第一字串(步驟351),若是,則字串取代模組150可以由語言資源檔中取得與第一字串對應且為目標語種的第二字串(步驟355),並可以在資料載入模組110所載入之網頁頁面中使用所取得的第二字串取代第一字串(步驟360);而若字串取代模組150無法由語言資源檔中取得第二字串,也就是語言資源檔中沒有包含第一字串,則伺服端200的資料處理模組220可以儲存第一字串與目標語種的語種識別資料(步驟381)。在本實施例中,若客戶端100與伺服端200由不同的計算設備執行,則客戶端100的資料傳輸模組170可以將第一字串與目標語種的語種識別資料傳送給伺服端200的網路服務模組210;而若客戶端100與伺服端200由相同的計算設備執行,則字串取代模組150或資料傳輸模組170可以將第一字串與語種識別資料提供給網路服務模組210。如此,資料處理模組220可以將網路服務模組210所接收到的第一字串與語種識別資料儲存到待辦資源檔中。In addition, when the character
在伺服端200的資料處理模組220儲存第一字串與目標語種的語種識別資料(步驟381)後,字串產生模組230或資料編輯模組240可以取得與第一字串對應的第二字串(步驟383),資源更新模組250可以將第一字串與第二字串加入語言資源檔中(步驟385),或是加入資源整合檔中,並如「第3B圖」所示,依據頁面語種或頁面語種與目標語種由資源整合檔中取出包含第一字串與第二字串的語言資料以產生與頁面語種對應的語言資源檔(步驟390)。After the
如此,透過本發明,可以依照網頁開發人員的慣用語言或第一語言開發多語言網頁,不再需要以變數產生多語言網頁。In this way, through the present invention, multilingual webpages can be developed according to the customary language or the first language of the webpage developers, and it is no longer necessary to generate multilingual webpages with variables.
綜上所述,可知本發明與先前技術之間的差異在於具有判斷網頁頁面之頁面語種與目標語種不同時載入語言資源檔,並取得網頁頁面所包含之特定網頁元素中之第一字串後,由語言資源檔中取得與第一字串對應且為目標語種之第二字串,於網頁頁面中以第二字串取代第一字串之技術手段,藉由此一技術手段可以來解決先前技術所存在開發多語言網頁導致工作量增加的問題,進而達成降低開發人員工作量之技術功效。In summary, it can be seen that the difference between the present invention and the prior art lies in the ability to load the language resource file when judging that the page language of the web page is different from the target language, and obtain the first character string in the specific web element included in the web page Afterwards, obtain the second word string corresponding to the first word string and being the target language from the language resource file, and replace the first word string with the second word string in the web page, by means of this technical means can be Solve the problem of increased workload caused by developing multilingual web pages in the previous technology, and then achieve the technical effect of reducing the workload of developers.
再者,本發明之以對應頁面語種之目標語種顯示網頁頁面之方法,可實現於硬體、軟體或硬體與軟體之組合中,亦可在電腦系統中以集中方式實現或以不同元件散佈於若干互連之電腦系統的分散方式實現。Furthermore, the method for displaying web pages in the target language corresponding to the page language of the present invention can be implemented in hardware, software, or a combination of hardware and software, and can also be implemented in a centralized manner in a computer system or distributed with different components Implemented in a decentralized manner over several interconnected computer systems.
雖然本發明所揭露之實施方式如上,惟所述之內容並非用以直接限定本發明之專利保護範圍。任何本發明所屬技術領域中具有通常知識者,在不脫離本發明所揭露之精神和範圍的前提下,對本發明之實施的形式上及細節上作些許之更動潤飾,均屬於本發明之專利保護範圍。本發明之專利保護範圍,仍須以所附之申請專利範圍所界定者為準。Although the embodiments disclosed in the present invention are as above, the content described is not intended to directly limit the scope of protection of the present invention. Anyone with ordinary knowledge in the technical field of the present invention, without departing from the spirit and scope disclosed in the present invention, makes some changes and modifications to the form and details of the implementation of the present invention, all of which belong to the patent protection of the present invention scope. The scope of patent protection of the present invention shall still be defined by the scope of the attached patent application.
100:客戶端 110:資料載入模組 120:語種判斷模組 130:頁面剖析模組 150:字串取代模組 160:頁面顯示模組 170:資料傳輸模組 200:伺服端 210:網路服務模組 220:資料處理模組 230:字串產生模組 240:資料編輯模組 250:資源更新模組 步驟310:載入網頁頁面 步驟320:判斷網頁頁面之頁面語種與目標語種不同時載入語言資源檔 步驟330:剖析網頁頁面之原始碼,並取得網頁頁面所包含之特定網頁元素中之第一字串 步驟331:剖析網頁頁面 步驟333:取得網頁元素 步驟335:判斷網頁元素之屬性是否滿足替換條件 步驟337:由網頁元素中取得元素內容作為第一字串 步驟339:是否還有未判斷標籤 步驟350:由語言資源檔中取得與第一字串對應且為目標語種之第二字串 步驟351:判斷語言資源檔中是否包含第一字串 步驟355:由語言資源檔中取得與第一字串對應且為目標語種之第二字串 步驟360:於網頁頁面中以第二字串取代第一字串 步驟370:顯示字串取代後之網頁頁面 步驟381:儲存第一字串 步驟383:取得與第一字串對應之第二字串 步驟385:將第一字串及第二字串加入語言資源檔 步驟390:依據頁面語種或頁面語種與目標語種由資源整合檔中取出語言資料以產生語言資源檔 100: client 110: Data loading module 120:Language judgment module 130:Page analysis module 150: String Replacement Module 160: Page display module 170:Data transmission module 200: server side 210:Network service module 220: Data processing module 230: String generation module 240: Data editing module 250: Resource update module Step 310: load the web page Step 320: Load the language resource file when judging that the page language of the web page is different from the target language Step 330: Analyze the source code of the web page, and obtain the first character string in the specific web element included in the web page Step 331: analyze the web page Step 333: Obtain web page elements Step 335: determine whether the attribute of the web page element satisfies the replacement condition Step 337: Obtain the element content from the webpage element as the first character string Step 339: Whether there are undetermined labels Step 350: Obtain the second character string corresponding to the first character string and being the target language from the language resource file Step 351: determine whether the first character string is included in the language resource file Step 355: Obtain the second character string corresponding to the first character string and being the target language from the language resource file Step 360: Replace the first string with the second string in the web page Step 370: Display the web page after the string replacement Step 381: Store the first character string Step 383: Obtain the second character string corresponding to the first character string Step 385: Add the first character string and the second character string to the language resource file Step 390: Take out the language data from the resource integration file according to the page language or the page language and the target language to generate a language resource file
第1圖為本發明所提之以對應頁面語種之目標語種顯示網頁頁面之客戶端之元件示意圖。 第2圖為本發明所提之以對應頁面語種之目標語種顯示網頁頁面之伺服端之元件示意圖。 第3A圖為本發明所提之以對應頁面語種之目標語種顯示網頁頁面之方法流程圖。 第3B圖為本發明所提之產生語言資源檔之方法流程圖。 第3C圖為本發明所提之取得第一字串之方法流程圖。 第3D圖為本發明所提之取得第二字串之方法流程圖。 FIG. 1 is a schematic diagram of components of a client terminal for displaying a web page in a target language corresponding to the language of the page proposed by the present invention. FIG. 2 is a schematic diagram of the components of the server end for displaying web pages in the target language corresponding to the page language proposed by the present invention. FIG. 3A is a flowchart of a method for displaying a webpage in a target language corresponding to the page language proposed by the present invention. FIG. 3B is a flow chart of the method for generating language resource files proposed by the present invention. FIG. 3C is a flow chart of the method for obtaining the first character string proposed by the present invention. FIG. 3D is a flow chart of the method for obtaining the second character string proposed by the present invention.
步驟310:載入網頁頁面 Step 310: load the web page
步驟320:判斷網頁頁面之頁面語種與目標語種不同時載入語言資源檔 Step 320: Load the language resource file when judging that the page language of the web page is different from the target language
步驟330:剖析網頁頁面之原始碼,並取得網頁頁面所包含之特定網頁元素中之第一字串 Step 330: Analyze the source code of the web page, and obtain the first character string in the specific web element included in the web page
步驟350:由語言資源檔中取得與第一字串對應且為目標語種之第二字串 Step 350: Obtain the second character string corresponding to the first character string and being the target language from the language resource file
步驟360:於網頁頁面中以第二字串取代第一字串 Step 360: Replace the first string with the second string in the web page
步驟370:顯示字串取代後之網頁頁面 Step 370: Display the web page after the string replacement
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110146124A TW202324140A (en) | 2021-12-09 | 2021-12-09 | System for using target language corresponding to page language to displaying webpage and method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW110146124A TW202324140A (en) | 2021-12-09 | 2021-12-09 | System for using target language corresponding to page language to displaying webpage and method thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
TW202324140A true TW202324140A (en) | 2023-06-16 |
Family
ID=87803590
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW110146124A TW202324140A (en) | 2021-12-09 | 2021-12-09 | System for using target language corresponding to page language to displaying webpage and method thereof |
Country Status (1)
Country | Link |
---|---|
TW (1) | TW202324140A (en) |
-
2021
- 2021-12-09 TW TW110146124A patent/TW202324140A/en unknown
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10628152B2 (en) | Automatic generation of microservices based on technical description of legacy code | |
US20210406033A1 (en) | Method for running applets, and electronic device | |
EP2808790B1 (en) | Migration assessment for cloud computing platforms | |
US8713530B2 (en) | Test framework of visual components in a multitenant database environment | |
US8347287B2 (en) | System and method for localizing a server application using a client-side translator | |
US8423978B2 (en) | Configurable java server pages processing framework | |
CN104375808B (en) | interface display method and device | |
JP4023803B2 (en) | Web application development support apparatus, data processing method, and program | |
US7865481B2 (en) | Changing documents to include changes made to schemas | |
US11741002B2 (en) | Test automation systems and methods using logical identifiers | |
CN115599386A (en) | Code generation method, device, equipment and storage medium | |
CN114995859A (en) | Page hot updating method, device, equipment and storage medium | |
US8607201B2 (en) | Augmenting visualization of a call stack | |
TW202324140A (en) | System for using target language corresponding to page language to displaying webpage and method thereof | |
CN115640279A (en) | Method and device for constructing data blood relationship | |
CN110599112A (en) | Method and device for developing and maintaining network page | |
CN107077484B (en) | Generating a web browser view of an application | |
US20220300404A1 (en) | Qualifying impacts of third-party code changes on dependent software | |
US20190095538A1 (en) | Method and system for generating content from search results rendered by a search engine | |
US10599740B1 (en) | Program code streaming | |
Sharma et al. | Mat: A migration assessment toolkit for paas clouds | |
CN116186436A (en) | System and method for displaying web pages in target languages corresponding to page languages | |
CN116775030B (en) | Method and device for creating security baseline | |
US11960560B1 (en) | Methods for analyzing recurring accessibility issues with dynamic web site behavior and devices thereof | |
CN113515326B (en) | Data conversion method, device, electronic equipment and storage medium |