CN106776584A - Character displaying method, translation table generating method, document translation method and device - Google Patents

Character displaying method, translation table generating method, document translation method and device Download PDF

Info

Publication number
CN106776584A
CN106776584A CN201611057783.2A CN201611057783A CN106776584A CN 106776584 A CN106776584 A CN 106776584A CN 201611057783 A CN201611057783 A CN 201611057783A CN 106776584 A CN106776584 A CN 106776584A
Authority
CN
China
Prior art keywords
character string
language
represented
character
translation table
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
CN201611057783.2A
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201611057783.2A priority Critical patent/CN106776584A/en
Publication of CN106776584A publication Critical patent/CN106776584A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/42Data-driven translation

Abstract

The invention discloses a kind of character displaying method, comprise the following steps:When monitoring application program is in the process of running, it is necessary to when showing word to user, detect word to be presented;When the first character string represented by source language is included in detecting the word, the second character string represented by object language corresponding with first character string is inquired about in the translation table of current loading;Wherein, the translation table includes the character string and the corresponding character string represented by object language that are represented by source language;The first character string in the word is replaced with into corresponding second character string, and word to the display screen sent after replacing is shown.The invention also discloses a kind of document translation method and device, translation table generating method and device, user terminal, service end, the maintenance of application program can be facilitated.

Description

Character displaying method, translation table generating method, document translation method and device
Technical field
Turned over the present invention relates to word interaction field, more particularly to a kind of character displaying method, translation table generating method, file Translate method and device.
Background technology
When application development is carried out, it is sometimes desirable to for the corresponding version of language development of application program distribution country This.By taking the game in China's exploitation as an example, when the game of non-Chinese version (such as Korean) is developed, game developer makes first Written in code is carried out with mother tongue (simplified form of Chinese Character), the simplified form of Chinese Character for then needing to show user by the inside of playing is given to specialty Translator, is directly write in game identification code using object language (such as Korean) or is filled out in configuration file upon translation Write.
But game developer is typically to be ignorant of object language, they cannot judge that written in code or configuration are filled in Correctness.Additionally, object language is directly write in code and being also resulted in and cannot be used different targets in portion code Language, it is therefore desirable to often form a individually code release for a different language so that code, the maintenance of configuration become It is difficult.
In order to solve the above problems, in existing solution, such as the exploitation of the APP of Android, there is provided The configuration file of String.xml, it leaves word concentratedly, and being retrieved as docuterm using constant definition needs display Word, when APP needs to enter into other countries, it is only necessary to replace corresponding String.xml, it is not necessary to enter to code Row modification.
The content of the invention
But String.xml is to use constant definition as docuterm, on the one hand, programmer when safeguarding still Need to search corresponding word by docuterm, compare and lose time;On the other hand, String.xml is also in itself configuration text One kind of part, so simply solving the translation of related text in code, the word that can not be solved in other configurations file is turned over Translate, other configurations file still needs directly to be filled in using object language, equally increased the difficulty safeguarded and update.
Regarding to the issue above, it is an object of the invention to provide a kind of character displaying method, translation table generating method, file Interpretation method and device, facilitate the maintenance of application program.
The invention provides a kind of character displaying method, comprise the following steps:
When monitoring application program is in the process of running, it is necessary to when showing word to user, detect word to be presented;
When the first character string represented by source language is included in detecting the word, in the translation of current loading The second character string represented by object language corresponding with first character string is inquired about in table;Wherein, the translation table includes The character string and the corresponding character string represented by object language represented by source language;
The first character string in the word is replaced with into corresponding second character string, and sends the word after replacing Shown to display screen.
In the present invention, character string directly is write using the usual source language of developer in program file, aobvious When showing the user to other countries, then corresponding object language is converted into by translation table.On the one hand, for country variant Game version, developer is very convenient when game Maintenance Development is carried out, it is not necessary to consider the adaptability problem of language, greatly The big time and efforts for reducing development process expends;On the other hand, by additionally one translation table of increase, non-usage is configured File is translated so that the function of character translation can also be used in some configuration files in program file, without Object language is used in configuration file, the exploitation for facilitating game is safeguarded.
Preferably, when monitoring application program is in the process of running, it is necessary to when showing word to user, detect to be presented Before word, also include:
Obtain the current application language of user terminal;
The current application language is set to the object language of the user terminal, and is loaded and the object language pair The translation table answered.
Preferably, it is described when the first character string represented by source language is included in detecting described information, working as The second character string represented by object language corresponding with first character string is inquired about in the translation table of preceding loading, specially:
When the character represented by source language is included in detecting described information, each section of interception is by source language table The first character string that the character for showing continuously is constituted, and inquire about corresponding with first character string in the translation table of current loading The second character string represented by object language;Wherein, when the latter character positioned at the character represented by source language is predetermined Termination accord with when, character is discontinuous.
The present invention also provides a kind of character displaying method, comprises the following steps:
When monitoring in operation, it is necessary to during to client transmissions word, detect word waiting for transmission;
When the first character string represented by source language is included in detecting the word, with the client pair The second character string represented by object language corresponding with first character string is inquired about in the translation table answered;Wherein, it is described to turn over Translating table includes the character string and the corresponding character string represented by object language that are represented by source language;
The first character string in the word is replaced with into corresponding second character string, and transmits the word after replacing Shown to the client.
In the present invention, directly character is write using the usual source language of developer in the program file of service end String, when the user of other countries is shown to, then is converted into corresponding object language by corresponding translation table.One side Face, for the game version of country variant, developer is very convenient when game Maintenance Development is carried out, it is not necessary to consider language Adaptability problem, greatly reduce development process time and efforts expend;On the other hand, a translation is increased by extra Table and non-usage configuration file is translated so that in some configuration files in program file can also be using character translation Function, without using object language in configuration file, the exploitation for facilitating game is safeguarded.
Preferably, when monitoring in operation, it is necessary to during to client transmissions word, before detecting word waiting for transmission, Also include:
Language queries are sent to client, and receives the sheet that the client is stated according to the language queries Ground language;
Whether inquiry has translation table corresponding with the native language of client statement;
If so, the translation table then is allocated into the client;
If it is not, translation table corresponding with default language then is allocated into the client.
The present invention also provides a kind of document translation method, comprises the following steps:
The original document of the table format to reading is parsed, and generates the code of key-value pair form;
Extract the first character string represented by source language in the value part of the key-value pair;
The second character string represented by object language corresponding with first character string is inquired about in selected translation table, And replace corresponding first character string using second character string is inquired;Wherein, the translation table is included by original Character string and the corresponding character string represented by object language that language is represented;
The file of the code format that output can run.
Generally, for the game plan of XProgrammer, the file (such as Excel file) of table format is conveniently to check With editor, game plan typically directly fills in choice of topics in the file of table format.But for program, table Data in the file of sound of laughing formula are binary formats, if operationally carrying out dissection process, can take certain operand, Make program efficiency low.
In the present invention, the original document of table format is being converted to and operationally can be directly being made by executable code During the file (such as Python/lua) of code format, in the file by translation table by table format by original The first character string that language is represented replaces with the second character string represented by object language, on the one hand, carried out when reducing operation The operand that dissection process takes, on the other hand, planning can be practised when the original document of the table format is edited with oneself The used source language for using and file format enter edlin, and need not consider the applicable sex chromosome mosaicism of language and form, facilitate plan Draw and safeguarded and changed.
The present invention also provides a kind of translation table generating method, it is characterised in that comprise the following steps:
Character string in search program file;
Filtering obtains including the first character string of the source language not comprising the character string for having source language;
The second character represented by object language corresponding with first character string is searched from target language data storehouse String;
According to first character string and the translation corresponding with the object language of corresponding second text string generation Table.
In the present invention, content to be translated in automatic search program file, and automatic translation generates translation table, thus Be not in the problem of careless omission or mistake, greatly improve operating efficiency, and due to that directly need not be turned over program file The personnel of translating see, thus improve confidentiality and security.
Preferably, described program file is program code or configuration file.
Preferably, after the character string in search program file, in filtering not comprising the character string for having source language, obtain To before the first character string represented by the source language, also include:
Character string of the filtering in notes content.
Preferably, the filtering obtains first represented by the source language not comprising the character string for having source language Character string, specially:
Each character in traversal character string, is filtrated to get the character string for including source language;
In the character string being filtrated to get, continuous the first character for constituting of each section of character represented by source language of interception String;Wherein, when the latter character positioned at the character represented by source language is that predetermined termination is accorded with, character is discontinuous.
The present invention also provides a kind of user terminal, including:
Detection unit, for when monitoring application program is in the process of running, it is necessary to when showing word to user, detect and wait to open up The word for showing;
Query unit, for when the first character string represented by source language is included in detecting the word, The second character string represented by object language corresponding with first character string is inquired about in the translation table of current loading;Wherein, The translation table includes the character string and the corresponding character string represented by object language that are represented by source language;
Replacement unit, for the first character string in the word to be replaced with into corresponding second character string, concurrently Word to the display screen after replacing is sent to be shown.
Preferably, also include:
Current application language acquiring unit, the current application language for obtaining user terminal;
Translation table loading unit, the object language for the current application language to be set to the user terminal, and Loading translation table corresponding with the object language.
Preferably, the query unit in described information is detected specifically for including what is represented by source language During character, continuous the first character string for constituting of each section of character represented by source language of interception, and in the translation of current loading The second character string represented by object language corresponding with first character string is inquired about in table;Wherein, when positioned at by original language When latter character for saying the character for representing is that predetermined termination is accorded with, character is discontinuous.
The present invention also provides a kind of service end, including:
Text detection unit, for when monitoring in operation, it is necessary to during to client transmissions word, detect text waiting for transmission Word;
Character string query unit, for including the first character string represented by source language in the word is detected When, inquired about in translation table corresponding with the client it is corresponding with first character string represented by object language second Character string;Wherein, the translation table includes the character string represented by source language and the corresponding character represented by object language String;
Character string replacement unit, for the first character string in the word to be replaced with into corresponding second character Go here and there, and word to the client transmitted after replacing is shown.
Preferably, also include:
Inquiry request transmitting element, for sending language queries to client, and receives the client according to institute State the native language of language queries statement;
Searching unit, for searching whether translation table corresponding with the native language of client statement;
First loading unit, for after translation table corresponding with the native language of client statement is found, inciting somebody to action The translation table is allocated to the client;
Second loading unit, for after the corresponding translation table of native language stated with the client is not found, The translation table of acquiescence is allocated to the client.
Present invention also offers a kind of document translation device, including:
Resolution unit, the original document for the table format to reading is parsed, and generates the code of key-value pair form;
First text string extracting unit, for the first word represented by source language in the value part for extracting the key-value pair Symbol string;
Inquiry replacement unit, for inquiring about corresponding by object language with first character string in selected translation table The second character string for representing, and replace corresponding first character string using second character string is inquired;Wherein, it is described Translation table includes the character string and the corresponding character string represented by object language that are represented by source language;
Output unit, the file for exporting the code format that can be run.
The present invention also provides a kind of translation table creating device, including:
String search unit, for the character string in search program file;
First filter element, for filtering not comprising the character string for having source language, obtains including the source language The first character string;
String searching unit, it is corresponding by target with first character string for being searched from target language data storehouse The second character string that language is represented;
Translation table generation unit, for according to first character string and corresponding second text string generation with it is described The corresponding translation table of object language.
Preferably, described program file is program code or configuration file.
Preferably, after the character string in search program file, also include:
Second filter element, for filtering the character string in notes content.
Preferably, first filter element is specifically included:
Spider module, for traveling through each character in character string, is filtrated to get the character string for including source language;
Interception module, in the character string being filtrated to get, each section of interception is continuous by the character that source language is represented The first character string for constituting;Wherein, when the latter character positioned at the character represented by source language is that predetermined termination is accorded with, Character is discontinuous.
Brief description of the drawings
In order to illustrate more clearly of technical scheme, the accompanying drawing to be used needed for implementation method will be made below Simply introduce, it should be apparent that, drawings in the following description are only some embodiments of the present invention, general for this area For logical technical staff, on the premise of not paying creative work, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is the flow chart of the character displaying method that first embodiment of the invention is provided.
Fig. 2 is the flow chart of the character displaying method that second embodiment of the invention is provided.
Fig. 3 is the flow chart of the document translation method that third embodiment of the invention is provided.
Fig. 4 is the flow chart of the translation table generating method that fourth embodiment of the invention is provided.
Fig. 5 is the structural representation of the user terminal that fifth embodiment of the invention is provided.
Fig. 6 is the structural representation of the service end that sixth embodiment of the invention is provided.
Fig. 7 is the structural representation of the document translation device that seventh embodiment of the invention is provided.
Fig. 8 is the structural representation of the translation table creating device that eighth embodiment of the invention is provided.
Specific embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under the premise of creative work is not made Embodiment, belongs to the scope of protection of the invention.
Fig. 1 is referred to, first embodiment of the invention provides a kind of character displaying method, and it can be held by user terminal OK, and at least comprise the following steps:
S101, when monitoring application program is in the process of running, it is necessary to when showing word to user, detect text to be presented Word.
In embodiments of the present invention, user terminal is performing application program, such as during execution game application, it is sometimes desirable to Show word to user, such as pop-up dialogue box provides a user with the dialog information of the personage in game, or provides a user with religion Tutorial message is learned, or the attribute information equipped to user's displaying etc..Wherein, these literature records are in advance program file In program code or configuration file, and it is defined as the form (such as being defined by string) of character string.When application program is being performed During the corresponding condition of itself logical triggering, this partial function will be performed, word will be shown to user.
S102, when the first character string represented by source language is included in detecting the word, loads currently Translation table in inquire about the second character string represented by object language corresponding with first character string;Wherein, the translation Table includes the character string and the corresponding character string represented by object language that are represented by source language.
In embodiments of the present invention, these words in program file may include the first character represented by source language String.Here source language is generally understood as the mother tongue of the nationality of developer or the usual language of developer.For example, right In the game that Chinese or Chinese companies develop, source language here refers generally to Chinese, and for American or u s company The game of exploitation, source language here refers generally to English.
In embodiments of the present invention, the first character string represented by source language is included in the word is detected When, user terminal inquired about in the translation table of current loading it is corresponding with first character string represented by object language second Character string.Wherein, goal language is generally understood as the usual language or mother tongue of the user of user terminal or international logical Use language.For example, for Japanese user, its object language is usually Japanese, and for U.S. user, its object language is usually English.
In embodiments of the present invention, the translation table includes the character string that is represented by source language and corresponding by target language Say the character string for representing, its data form for generally using Hash table, the character string represented by source language with by object language The character string of expression has unique corresponding relation, thus can obtain unique second character by first string searching String.
It should be noted that in embodiments of the present invention, in loading application programs first, it is necessary to obtain user terminal Current application language confirms the object language of user, to load corresponding translation table.Wherein, can carry out by the following method really Recognize:
1st, package_name (the application bag of Android is identified) or bundle_id is read when application program is enabled (the application bag of IOS is identified) selection target language.
For example, when package_name is read for com.efun.mxxc.tw, then it is Taiwan to represent its distribution area, because This optional Taiwan Chinese-traditional (being different from Hong Kong Chinese-traditional) loads corresponding translation table as object language.
2nd, for the area for having multilingual same demand packet, one of which language current application language by default is used.
For example, for the game in the area such as America and Europe, it will usually select several language such as English, French, German to be put into same In individual installation kit, to be applicable more players simultaneously.
3rd, using system language as user terminal current application language
The system language of such as user terminal is French, then load translation table corresponding with French as current translation Table.
Additionally, may also provide selectable language list selected for user, using the language of user's selection as object language, And load corresponding translation table.
S103, corresponding second character string is replaced with by the first character string in the word, and after sending replacement Word to display screen shown.
In embodiments of the present invention, after finding and obtaining corresponding second character string, by the first character in the word String replaces with corresponding second character string, the word after being replaced, and the word after replacement is sent to display screen Row display.
In the embodiment of the present invention, directly character is write using the usual source language of developer in program file String, when the user of other countries is shown to, then is converted into corresponding object language by translation table.On the one hand, for The game version of country variant, developer is very convenient when game Maintenance Development is carried out, it is not necessary to consider the adaptation of language Sex chromosome mosaicism, the time and efforts for greatly reducing development process expends;On the other hand, by additionally increase a translation table rather than Translated using configuration file so that the function of character translation can also be used in some configuration files in program file, Without using object language in configuration file, the exploitation for facilitating game is safeguarded.
Preferably, step S102 is specifically included:
When the character represented by source language is included in detecting described information, each section of interception is by source language table The first character string that the character for showing continuously is constituted, and inquire about corresponding with first character string in the translation table of current loading The second character string represented by object language;Wherein, when the latter character positioned at the character represented by source language is predetermined Termination accord with when, character is discontinuous.
Because some sentences in the word in application program may be reused.For example, it is assumed that current word is: " congratulate player!You have successfully reached XX grades.”.Here, " congratulations player " four words may be reused in other scenes Arrive, for example, in some scenarios, in fact it could happen that " congratulate player!You have reached XX achievements " or occur " congratulating player!You are Obtain XX equipments.”.If in translation table, storage form is:Congratulate player!You have successfully reached XX grades:Object language. To so cause " congratulating player " to duplicate the problem of storage in different places, cause the data volume of translation table excessive, shadow The experience of user is rung.
Therefore, in the preferred embodiment, the character string that the character combination for continuously being represented by source language can be formed Individually definition, for example:In translation table, " congratulating player " can individually have corresponding second character string, and " you have successfully reached XX grades." also can individually there is corresponding second character string.In the process of running, when need display " congratulate player!You are Successfully reach XX grades." when, (such as question mark, word, exclamation mark etc.) can be accorded with by predetermined termination word is segmented, and The first character string to every section carries out lookup replacement successively.Namely in this section of example, inquiring "!" when, in meeting Only following inquiry, and directly " player will be congratulated!" go corresponding second character string of translation table search as the first character string.So Afterwards again by " you have successfully reached XX grades." go corresponding second character string of translation table search as another first character string.
In the preferred embodiment, although may increased time and the work of lookup by carrying out segmentation to character string Make, but the data volume of translation table and the workload of translator will be greatly reduced, and the mode of segmented is also allowed for subsequently Maintenance and renewal, reduce safeguard update difficulty.
Fig. 2 is referred to, second embodiment of the invention provides the character displaying method in a kind of application program, and it is by servicing Hold to perform, and at least comprise the following steps:
S201, when monitoring in operation, it is necessary to during to client transmissions word, detect word waiting for transmission.
S202, when the first character string represented by source language is included in detecting the word, with the visitor The second character string represented by object language corresponding with first character string is inquired about in the corresponding translation table in family end;Wherein, The translation table includes the character string and the corresponding character string represented by object language that are represented by source language.
S203, corresponding second character string is replaced with by the first character string in the word, and after transmitting replacement Word to the client shown.
In embodiments of the present invention, the game for interacting is produced with service end for online game or needs, is also usually needed Word is sent from service end to client.And in actual application, multiple countries being might have, the player of multilingual exists Same server is played, then at this time, it may be necessary to be directed to country variant and language to send corresponding word.
Specifically, in client loading application programs first, service end can send language queries to client, and Receive the native language that the client is stated according to the language queries.Hereafter, service end inquiry whether have with The corresponding translation table of native language of the client statement;If so, the translation table then is allocated into the client;If It is no, then translation table corresponding with default language is allocated to the client.
When in use, when service end is needed to client transmissions word, word waiting for transmission is detected, it is described when detecting When including the first character string represented by source language in word, the translation table of client configuration can be loaded as, then from Corresponding the second character string represented by object language is inquired about in the translation table of loading, then by the first character in the word String replaces with corresponding second character string, and word to the client transmitted after replacing is shown.
If it should be noted that corresponding less than with the native language that the client the is stated translation table of inquiry, automatically The translation table of acquiescence is loaded, wherein, default language is generally international language, such as English, to ensure the experience of user.
In the embodiment of the present invention, directly write using the usual source language of developer in the program file of service end Enter character string, when the user of other countries is shown to, then corresponding object language is converted into by corresponding translation table. On the one hand, for the game version of country variant, developer is very convenient when game Maintenance Development is carried out, it is not necessary to consider The adaptability problem of language, the time and efforts for greatly reducing development process expends;On the other hand, one is increased by extra Translation table and non-usage configuration file is translated so that can also be turned over using word in some configuration files in program file The function of translating, without using object language in configuration file, the exploitation for facilitating game is safeguarded.
Fig. 3 is referred to, third embodiment of the invention additionally provides a kind of document translation method, comprises the following steps:
S301, the original document of the table format to reading is parsed, and generates the code of key-value pair form.
In embodiments of the present invention, for the game plan of XProgrammer, using table format file (such as Excel file) enter edlin be eaily, therefore in general, mostly game plan be all directly in table format Filling in for game content is carried out in file.But for program, Excel is binary format, if operationally carried out Dissection process, can take certain operand, make program efficiency low.Therefore need to be used before program operation and be converted into The code file form that program can directly read.Wherein, after parsing, can obtain key-value pair (Key/Value) form can be with The code (such as python/lua codes) for directly reading.
S302, the first character string represented by source language in the value part for extracting the key-value pair.
In embodiments of the present invention, key section (Key parts) is done retrieval and is used to code, typically numeral or simple English character string etc. as unique mark, so directly output need not be carried out translating.
And retrieved using key section for value part, when due to retrieval, thus will not have in code execution Whether physical examination measured value part includes the character represented by source language, thus need in advance by value part by source language table The character for showing is converted to the character represented by object language.
Specifically, for value part (Value parts), its type is first determined whether, if simple types (such as numeral), Then directly judge whether it includes the first character string represented by source language;If complicated type (such as dictionary), then The data structure is traveled through, all the first character strings represented by source language in the value part are obtained successively.
S303, the second word represented by object language corresponding with first character string is inquired about in selected translation table Symbol string, and replace corresponding first character string using second character string is inquired;Wherein, the translation table include by Character string and the corresponding character string represented by object language that source language is represented.
For majority of case, corresponding second character string can be found in the translation table, for can not find correspondence The part of translation, then directly export the first character string to ensure the integrality of file.
S304, the file of the code format that output can run.
The file of code format is output as after final content is arranged, wherein, the file after output be able to can be held Line code is operationally directly used.
In the present invention, the original document of table format is being converted to and operationally can be directly being made by executable code During the file (such as Python/lua) of code format, in the file by translation table by table format by original The first character string that language is represented replaces with the second character string represented by object language, on the one hand, carried out when reducing operation The operand that dissection process takes, on the other hand, planning can be practised when the original document of the table format is edited with oneself The used source language for using and file format enter edlin, and need not consider the applicable sex chromosome mosaicism of language and form, facilitate plan Draw and safeguarded and changed.
Fig. 4 is referred to, fourth embodiment of the invention also provides a kind of translation table generating method, and it can be generated by translation table and filled Put to perform, and comprise the following steps:
S401, the character string in search program file.
S402, filtering obtains including the first character string of the source language not comprising the character string for having source language.
S403, searched from target language data storehouse it is corresponding with first character string represented by object language second Character string.
S404, it is corresponding with the object language according to first character string and corresponding second text string generation Translation table.
When translation table is generated, by need by program file the character string that represents of useful source language all Sort out and, an another translation, if Manual arranging, the problem of omission or mistake easily occurs.
In embodiments of the present invention, translation can be automatically generated by translating table creating device (hereinafter referred to as device) Table.Specifically, it (can be program's code file, configuration file or other codes text that described device reads program file to be translated Part etc.), the then character string (typically being defined by string) in search program file, then by traveling through each in character string Character, filtering obtains including the first character string of the source language not comprising the character string for having source language.Again from target The second character string represented by object language corresponding with first character string is searched in language database.Finally, according to institute State the first character string and corresponding second text string generation translation table corresponding with the object language.
Wherein, in search procedure, can first judge that whether the record for having had corresponding first character string in translation table is believed Breath, if so, need not then repeat to translate and record, so as to reduce the data volume of translation table.
Wherein, after lookup obtains the first character string, if not corresponding with the first character string in target language data storehouse Second character string, then exportable first character string, after being translated by corresponding translator, is then added to object language In database, target language data storehouse can be reused and constantly update according to demand.
In the embodiment of the present invention, content to be translated in automatic search program file, and automatic translation generates translation Table, thus be not in the problem of careless omission or mistake, greatly improve operating efficiency.And due to not needing program text directly Part is seen to translator, it is also possible to improve confidentiality and security.
It should be noted that in order to reduce workload, after step S301, also including:
Character string of the filtering in notes content.
Here the character string in code is likely to be the annotation to code, and this partial content is checked to developer, User will not be showed, therefore need not be translated.For example, for Python code, the single file code of # beginnings can be considered as note Release;Again for example, for lua codes, -- the single file code of beginning can be considered as annotation.
In the embodiment of the present invention, by character string of the filtering in the notes content, needed for reducing generation translation table Time and workload, improve efficiency.
Preferably, step S402 is specially:
S4021, each character in traversal character string, is filtrated to get the character string for including source language;
S4022, in the character string being filtrated to get, each section of character represented by source language of interception be continuous constitute the One character string;Wherein, when the latter character positioned at the character represented by source language is that predetermined termination is accorded with, character does not connect It is continuous.
In this preferred embodiment, when translation table is generated, accorded with by predetermined termination and character string is segmented, from And avoid some character strings and repeat translation and cause to repeat problem of the storage in translation table, reduce the data of translation table Amount.
Fig. 5 is referred to, fourth embodiment of the invention additionally provides a kind of user terminal 500, including:
Detection unit 510, for when monitoring application program is in the process of running, it is necessary to when showing word to user, detect Word to be presented;
Query unit 520, for when the first character string represented by source language is included in detecting the word, The second character string represented by object language corresponding with first character string is inquired about in the translation table of current loading;Its In, the translation table includes the character string and the corresponding character string represented by object language that are represented by source language;
Replacement unit 530, for the first character string in the word to be replaced with into corresponding second character string, and Word to the display screen after replacing is sent to be shown.
In the embodiment of the present invention, directly character is write using the usual source language of developer in program file String, when the user of other countries is shown to, then is converted into corresponding object language by translation table.On the one hand, for The game version of country variant, developer is very convenient when game Maintenance Development is carried out, it is not necessary to consider the adaptation of language Sex chromosome mosaicism, the time and efforts for greatly reducing development process expends;On the other hand, by additionally increase a translation table rather than Translated using configuration file so that the function of character translation can also be used in some configuration files in program file, Without using object language in configuration file, the exploitation for facilitating game is safeguarded.
Preferably, also include:
Current language acquiring unit 540, the current application language for obtaining user terminal;
Translation table loading unit 550, the object language for the current application language to be set to the user terminal, And load translation table corresponding with the object language.
Preferably, the query unit 520 in described information is detected specifically for including and being represented by source language Character when, continuous the first character string for constituting of each section of character represented by source language of interception, and turning in current loading Translate and inquire about the second character string represented by object language corresponding with first character string in table;Wherein, when positioned at by original When latter character of the character that language is represented is that predetermined termination is accorded with, character is discontinuous.
Fig. 6 is referred to, fifth embodiment of the invention additionally provides a kind of service end 600, including:
Text detection unit 610, for when monitoring in operation, it is necessary to during to client transmissions word, detect to be transmitted Word;
Character string query unit 620, for including the first word represented by source language in the word is detected During symbol string, inquire about with first character string corresponding being represented by object language in translation table corresponding with the client Second character string;Wherein, the translation table includes the character string that is represented by source language and corresponding is represented by object language Character string;
Character string replacement unit 630, for the first character string in the word to be replaced with into corresponding second word Symbol is gone here and there, and word to the client transmitted after replacing is shown.
In the embodiment of the present invention, directly character is write using the usual source language of developer in program file String, when the user of other countries is shown to, then is converted into corresponding object language by translation table.On the one hand, for The game version of country variant, developer is very convenient when game Maintenance Development is carried out, it is not necessary to consider the adaptation of language Sex chromosome mosaicism, the time and efforts for greatly reducing development process expends;On the other hand, by additionally increase a translation table rather than Translated using configuration file so that the function of character translation can also be used in some configuration files in program file, Without using object language in configuration file, the exploitation for facilitating game is safeguarded.
Preferably, also include:
Inquiry request transmitting element 640, for client send language queries, and receive the client according to The native language of the language queries statement;
Searching unit 650, for searching whether translation table corresponding with the native language of client statement;
First loading unit 660, for after the corresponding translation table of native language stated with the client is found, The translation table is allocated to the client;
Second loading unit 670, for not finding translation table corresponding with the native language of client statement Afterwards, the translation table of acquiescence is allocated to the client
Fig. 7 is referred to, seventh embodiment of the invention also provides a kind of document translation device 700, including:
Resolution unit 710, the original document for the table format to reading is parsed, and generates the generation of key-value pair form Code;
First text string extracting unit 720, for represented by source language in the value part for extracting the key-value pair One character string;
Inquiry replacement unit 730, for inquiring about corresponding by target with first character string in selected translation table The second character string that language is represented, and replace corresponding first character string using second character string is inquired;Wherein, The translation table includes the character string and the corresponding character string represented by object language that are represented by source language;
Output unit 740, the file for exporting the code format that can be run.
In the present invention, the original document of table format is being converted to and operationally can be directly being made by executable code During the file (such as Python/lua) of code format, in the file by translation table by table format by original The first character string that language is represented replaces with the second character string represented by object language, on the one hand, carried out when reducing operation The operand that dissection process takes, on the other hand, planning can be practised when the original document of the table format is edited with oneself The used source language for using and file format enter edlin, and need not consider the applicable sex chromosome mosaicism of language and form, facilitate plan Draw and safeguarded and changed.
Fig. 8 is referred to, eighth embodiment of the invention also provides a kind of translation table creating device 800, including:
String search unit 810, for the character string in search program file;
First filter element 820, for filtering not comprising the character string for having source language, obtains including the original language First character string of speech;
String searching unit 830, for searched from target language data storehouse it is corresponding with first character string by The second character string that object language is represented;
Translation table generation unit 840, for according to first character string and corresponding second text string generation with The corresponding translation table of the object language.
Preferably, described program file is program code or configuration file.
Preferably, also include:
Second filter element 850, for filtering the character string in notes content.
Preferably, first filter element 820 is specifically included:
Spider module 821, for traveling through each character in character string, is filtrated to get the character for including source language String;
Interception module 822, in the character string being filtrated to get, each section of character represented by source language of interception to connect Continuous the first character string for constituting;Wherein, when the latter character positioned at the character represented by source language is predetermined termination symbol When, character is discontinuous.
In the embodiment of the present invention, content to be translated in automatic search program file, and automatic translation generates translation Table, thus be not in the problem of careless omission or mistake, greatly improve operating efficiency.And due to not needing program text directly Part is seen to translator, thus improves confidentiality and security.
Above disclosed is only a kind of preferred embodiment of the invention, can not limit the power of the present invention with this certainly Sharp scope, one of ordinary skill in the art will appreciate that realizing all or part of flow of above-described embodiment, and weighs according to the present invention Profit requires made equivalent variations, still falls within the covered scope of invention.
One of ordinary skill in the art will appreciate that all or part of flow in realizing above-described embodiment method, can be The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..

Claims (20)

1. a kind of character displaying method, it is characterised in that comprise the following steps:
When monitoring application program is in the process of running, it is necessary to when showing word to user, detect word to be presented;
When the first character string represented by source language is included in detecting the word, in the translation table of current loading Inquiry the second character string represented by object language corresponding with first character string;Wherein, the translation table is included by original Character string and the corresponding character string represented by object language that beginning language is represented;
The first character string in the word is replaced with into corresponding second character string, and sends the word after replacing to aobvious Display screen is shown.
2. character displaying method according to claim 1, it is characterised in that when monitoring application program in running In, it is necessary to when showing word to user, before detecting word to be presented, also include:
Obtain the current application language of user terminal;
The current application language is set to the object language of the user terminal, and is loaded corresponding with the object language Translation table.
3. character displaying method according to claim 1, it is characterised in that described to include in it detect described information During the first character string represented by source language, inquired about in the translation table of current loading it is corresponding with first character string by The second character string that object language is represented, specially:
When the character represented by source language is included in detecting described information, what each section of interception was represented by source language The first character string that character is continuously constituted, and inquire about corresponding by mesh with first character string in the translation table of current loading The second character string that poster speech is represented;Wherein, in being predetermined positioned at latter character of the character represented by source language When only according with, character is discontinuous.
4. a kind of character displaying method, it is characterised in that comprise the following steps:
When monitoring in operation, it is necessary to during to client transmissions word, detect word waiting for transmission;
When the first character string represented by source language is included in detecting the word, corresponding with the client The second character string represented by object language corresponding with first character string is inquired about in translation table;Wherein, the translation table Including the character string and the corresponding character string represented by object language that are represented by source language;
The first character string in the word is replaced with into corresponding second character string, and transmits the word after replacing to institute Client is stated to be shown.
5. character displaying method according to claim 4, it is characterised in that when monitoring in operation, it is necessary to client During the transmission word of end, before detecting word waiting for transmission, also include:
Language queries are sent to client, and receives the local language that the client is stated according to the language queries Speech;
Whether inquiry has translation table corresponding with the native language of client statement;
If so, the translation table then is allocated into the client;
If it is not, translation table corresponding with default language then is allocated into the client.
6. a kind of document translation method, it is characterised in that comprise the following steps:
The original document of the table format to reading is parsed, and generates the code of key-value pair form;
Extract the first character string represented by source language in the value part of the key-value pair;
The second character string represented by object language corresponding with first character string, and profit are inquired about in selected translation table Corresponding first character string is replaced with second character string is inquired;Wherein, the translation table is included by source language The character string of expression and the corresponding character string represented by object language;
The file of the code format that output can run.
7. it is a kind of to translate table generating method, it is characterised in that to comprise the following steps:
Character string in search program file;
Filtering obtains including the first character string of the source language not comprising the character string for having source language;
The second character string represented by object language corresponding with first character string is searched from target language data storehouse;
According to first character string and corresponding second text string generation translation table corresponding with the object language.
8. translation table generating method according to claim 7, it is characterised in that described program file be program code or Configuration file.
9. translation table generating method according to claim 7, it is characterised in that character string in search program file it Afterwards, before obtaining the first character string represented by the source language, also wrapped not comprising the character string for having source language in filtering Include:
Character string of the filtering in notes content.
10. translation table generating method according to claim 7, it is characterised in that the filtering is not comprising there is source language Character string, obtain the first character string represented by the source language, specially:
Each character in traversal character string, is filtrated to get the character string for including source language;
In the character string being filtrated to get, continuous the first character string for constituting of each section of character represented by source language of interception; Wherein, when the latter character positioned at the character represented by source language is that predetermined termination is accorded with, character is discontinuous.
A kind of 11. user terminals, it is characterised in that including:
Detection unit, for when monitoring application program is in the process of running, it is necessary to when showing word to user, detect to be presented Word;
Query unit, for when the first character string represented by source language is included in detecting the word, current The second character string represented by object language corresponding with first character string is inquired about in the translation table of loading;Wherein, it is described Translation table includes the character string and the corresponding character string represented by object language that are represented by source language;
Replacement unit, for the first character string in the word to be replaced with into corresponding second character string, and transmission is replaced Word to display screen after changing is shown.
12. user terminals according to claim 11, it is characterised in that also include:
Current application language acquiring unit, the current application language for obtaining user terminal;
Translation table loading unit, for the current application language to be set into the object language of the user terminal, and loads Translation table corresponding with the object language.
13. user terminals according to claim 11, it is characterised in that the query unit is specifically for when detecting When including the character represented by source language in described information, each section of character represented by source language of interception is continuously constituted The first character string, and inquire about in the translation table of current loading and corresponding with first character string to be represented by object language Second character string;Wherein, when the latter character positioned at the character represented by source language is that predetermined termination is accorded with, character is not Continuously.
A kind of 14. service ends, it is characterised in that including:
Text detection unit, for when monitoring in operation, it is necessary to during to client transmissions word, detect word waiting for transmission;
Character string query unit, for when the first character string represented by source language is included in detecting the word, The second word represented by object language corresponding with first character string is inquired about in translation table corresponding with the client Symbol string;Wherein, the translation table includes the character string and the corresponding character string represented by object language that are represented by source language;
Character string replacement unit, for the first character string in the word to be replaced with into corresponding second character string, and Word to the client after transmission is replaced is shown.
15. service ends according to claim 14, it is characterised in that also include:
Inquiry request transmitting element, for sending language queries to client, and receives the client according to institute's predicate The native language of speech inquiry request statement;
Searching unit, for searching whether translation table corresponding with the native language of client statement;
First loading unit, for after translation table corresponding with the native language of client statement is found, by described in Translation table is allocated to the client;
Second loading unit, for that after translation table corresponding with the native language of client statement is not found, will write from memory The translation table recognized is allocated to the client
A kind of 16. document translation devices, it is characterised in that including:
Resolution unit, the original document for the table format to reading is parsed, and generates the code of key-value pair form;
First text string extracting unit, for the first character represented by source language in the value part for extracting the key-value pair String;
Inquiry replacement unit, corresponding with first character string is represented for being inquired about in selected translation table by object language The second character string, and replace corresponding first character string using second character string is inquired;Wherein, the translation Table includes the character string and the corresponding character string represented by object language that are represented by source language;
Output unit, the file for exporting the code format that can be run.
A kind of 17. translation table creating devices, it is characterised in that including:
String search unit, for the character string in search program file;
First filter element, for filtering not comprising there is the character string of source language, obtains including the of the source language One character string;
String searching unit, it is corresponding by object language with first character string for being searched from target language data storehouse The second character string for representing;
Translation table generation unit, for according to first character string and corresponding second text string generation and the target The corresponding translation table of language.
18. translation table creating devices according to claim 17, it is characterised in that described program file be program code or Person's configuration file.
19. translation table creating devices according to claim 17, it is characterised in that the character string in search program file Afterwards, also include:
Second filter element, for filtering the character string in notes content.
20. translation table creating devices according to claim 17, it is characterised in that first filter element is specifically wrapped Include:
Spider module, for traveling through each character in character string, is filtrated to get the character string for including source language;
Interception module, in the character string being filtrated to get, each section of character represented by source language of interception continuously to be constituted The first character string;Wherein, when the latter character positioned at the character represented by source language is that predetermined termination is accorded with, character Discontinuously.
CN201611057783.2A 2016-11-24 2016-11-24 Character displaying method, translation table generating method, document translation method and device Pending CN106776584A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611057783.2A CN106776584A (en) 2016-11-24 2016-11-24 Character displaying method, translation table generating method, document translation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611057783.2A CN106776584A (en) 2016-11-24 2016-11-24 Character displaying method, translation table generating method, document translation method and device

Publications (1)

Publication Number Publication Date
CN106776584A true CN106776584A (en) 2017-05-31

Family

ID=58912544

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611057783.2A Pending CN106776584A (en) 2016-11-24 2016-11-24 Character displaying method, translation table generating method, document translation method and device

Country Status (1)

Country Link
CN (1) CN106776584A (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107346303A (en) * 2017-06-19 2017-11-14 上海青橙实业有限公司 string data translation processing method and device
CN107357568A (en) * 2017-06-12 2017-11-17 北京天健通泰科技有限公司 A kind of original language replacement method based on multi-lingual label
CN107451128A (en) * 2017-08-04 2017-12-08 深圳Tcl新技术有限公司 Multilingual code adaptation method, equipment and storage medium
CN109284145A (en) * 2018-08-28 2019-01-29 北京城市网邻信息技术有限公司 The generation of multilingual configuration file and methods of exhibiting and device, equipment and medium
CN109471618A (en) * 2018-11-16 2019-03-15 北京金和网络股份有限公司 Program integrates multilingual chemical industry tool
CN109669742A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Methods of exhibiting, device, terminal device and the storage medium of website
CN109861904A (en) * 2019-02-19 2019-06-07 天津字节跳动科技有限公司 Nametags display methods and device
CN110110073A (en) * 2018-01-26 2019-08-09 北京高德云图科技有限公司 A kind of text methods of exhibiting and device
CN110210039A (en) * 2018-04-23 2019-09-06 深圳市腾讯网络信息技术有限公司 Translate content inspection method, device, system and computer equipment
CN110674644A (en) * 2018-07-03 2020-01-10 深圳Tcl数字技术有限公司 Auxiliary translation method and system
CN111160045A (en) * 2019-12-27 2020-05-15 苏州亿歌网络科技有限公司 Game resource file translation method, device and equipment
CN111367595A (en) * 2018-12-25 2020-07-03 阿里巴巴集团控股有限公司 Data processing method, program running method, device and processing equipment
CN112328739A (en) * 2020-10-13 2021-02-05 成都安易迅科技有限公司 Character query method and device, computer equipment and computer readable storage medium
CN112988292A (en) * 2019-12-17 2021-06-18 青岛海信传媒网络技术有限公司 Multi-language translation file generation method and terminal
CN113139390A (en) * 2020-01-17 2021-07-20 北京沃东天骏信息技术有限公司 Language conversion method and device applied to code character strings
CN114201248A (en) * 2020-09-17 2022-03-18 福建天泉教育科技有限公司 Method and system for judging whether component needs to be translated

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1474312A (en) * 2003-06-04 2004-02-11 无敌科技(西安)有限公司 Device capable of supporting multiple languages and its display method
CN1702621A (en) * 2004-04-22 2005-11-30 微软公司 Language localization using tables

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1474312A (en) * 2003-06-04 2004-02-11 无敌科技(西安)有限公司 Device capable of supporting multiple languages and its display method
CN1702621A (en) * 2004-04-22 2005-11-30 微软公司 Language localization using tables

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107357568A (en) * 2017-06-12 2017-11-17 北京天健通泰科技有限公司 A kind of original language replacement method based on multi-lingual label
CN107346303A (en) * 2017-06-19 2017-11-14 上海青橙实业有限公司 string data translation processing method and device
CN107346303B (en) * 2017-06-19 2020-10-16 上海青橙实业有限公司 Character string data translation processing method and device
CN107451128A (en) * 2017-08-04 2017-12-08 深圳Tcl新技术有限公司 Multilingual code adaptation method, equipment and storage medium
CN107451128B (en) * 2017-08-04 2021-09-28 深圳Tcl新技术有限公司 Multi-language code adaptation method, device and storage medium
CN110110073A (en) * 2018-01-26 2019-08-09 北京高德云图科技有限公司 A kind of text methods of exhibiting and device
CN110210039A (en) * 2018-04-23 2019-09-06 深圳市腾讯网络信息技术有限公司 Translate content inspection method, device, system and computer equipment
CN110674644A (en) * 2018-07-03 2020-01-10 深圳Tcl数字技术有限公司 Auxiliary translation method and system
CN109284145A (en) * 2018-08-28 2019-01-29 北京城市网邻信息技术有限公司 The generation of multilingual configuration file and methods of exhibiting and device, equipment and medium
CN109669742A (en) * 2018-09-26 2019-04-23 深圳壹账通智能科技有限公司 Methods of exhibiting, device, terminal device and the storage medium of website
CN109471618A (en) * 2018-11-16 2019-03-15 北京金和网络股份有限公司 Program integrates multilingual chemical industry tool
CN111367595B (en) * 2018-12-25 2024-03-26 阿里巴巴集团控股有限公司 Data processing method, program running method, device and processing equipment
CN111367595A (en) * 2018-12-25 2020-07-03 阿里巴巴集团控股有限公司 Data processing method, program running method, device and processing equipment
CN109861904A (en) * 2019-02-19 2019-06-07 天津字节跳动科技有限公司 Nametags display methods and device
US11283740B2 (en) 2019-02-19 2022-03-22 Tianjin Bytedance Technology Co., Ltd. Name label display method and apparatus
CN112988292A (en) * 2019-12-17 2021-06-18 青岛海信传媒网络技术有限公司 Multi-language translation file generation method and terminal
CN111160045B (en) * 2019-12-27 2021-03-23 苏州亿歌网络科技有限公司 Game resource file translation method, device and equipment
CN111160045A (en) * 2019-12-27 2020-05-15 苏州亿歌网络科技有限公司 Game resource file translation method, device and equipment
CN113139390A (en) * 2020-01-17 2021-07-20 北京沃东天骏信息技术有限公司 Language conversion method and device applied to code character strings
CN114201248A (en) * 2020-09-17 2022-03-18 福建天泉教育科技有限公司 Method and system for judging whether component needs to be translated
CN114201248B (en) * 2020-09-17 2023-10-20 福建天泉教育科技有限公司 Method and system for judging whether component needs translation
CN112328739A (en) * 2020-10-13 2021-02-05 成都安易迅科技有限公司 Character query method and device, computer equipment and computer readable storage medium
CN112328739B (en) * 2020-10-13 2023-11-03 成都安易迅科技有限公司 Character query method, device, computer equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN106776584A (en) Character displaying method, translation table generating method, document translation method and device
US9652454B2 (en) Phrase-based dictionary extraction and translation quality evaluation
US9507698B2 (en) Test code generation based on test documentation
US10621211B2 (en) Language tag management on international data storage
US8903710B2 (en) Synchro translation verification test for software applications
US20150127324A1 (en) Natural language parsers to normalize addresses for geocoding
US8468494B2 (en) In-line editor
JP2009534743A (en) How to parse unstructured resources
CN101667118A (en) Method and device for multi-language version development and replacement
CN113312108B (en) SWIFT message verification method and device, electronic equipment and storage medium
CN104516727A (en) Method and system for changing resource in resource file
CN102402505B (en) Delta language translation method and system
CN111729313A (en) Language configuration method and device, storage medium and electronic device
CN103761095B (en) Method for generating universal upgrade file head data information
CN115080406A (en) Code log generation method, device, equipment and storage medium
JP6952967B2 (en) Automatic translator
CN112363706A (en) Nested combination preprocessing method and equipment
CN110414010A (en) The processing method of internationalized resources file translation text, readable storage medium storing program for executing
CN114385679A (en) Meter structure inspection method, meter structure inspection device and electronic equipment
CN109947711A (en) A kind of multilingual file automating management method in pair of IOS project development process
JP6056489B2 (en) Translation support program, method, and apparatus
CN107077365A (en) Selectively load the head and/or its part of precompile
CN106648618B (en) Text information generation method and device for virtual application
CN112699642B (en) Index extraction method and device for complex medical texts, medium and electronic equipment
CN101425087A (en) Method and system for constructing dictionary

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

Application publication date: 20170531

RJ01 Rejection of invention patent application after publication