WO2020186904A1 - 文本适配显示方法、装置、电子设备、服务器及存储介质 - Google Patents

文本适配显示方法、装置、电子设备、服务器及存储介质 Download PDF

Info

Publication number
WO2020186904A1
WO2020186904A1 PCT/CN2020/070718 CN2020070718W WO2020186904A1 WO 2020186904 A1 WO2020186904 A1 WO 2020186904A1 CN 2020070718 W CN2020070718 W CN 2020070718W WO 2020186904 A1 WO2020186904 A1 WO 2020186904A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
filled
parameter
displayed
client
Prior art date
Application number
PCT/CN2020/070718
Other languages
English (en)
French (fr)
Inventor
郑佳丽
Original Assignee
北京字节跳动网络技术有限公司
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 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2020186904A1 publication Critical patent/WO2020186904A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the embodiments of the present disclosure relate to the technical field of computer software application, for example, to a text adaptation display method, device, electronic equipment, server, and storage medium.
  • One method is to store text content in multiple languages in the server, and the client requests the text content in the target language from the server through the Application Programming Interface (API).
  • API Application Programming Interface
  • the sent request contains the location and / Or language (locale/language) parameter, the server will send the corresponding target language text content to the client for display according to the locale/language parameter.
  • Another method is to translate the text needed during the use of the App into text in multiple languages and embed it in the App as a local copy. When the client is used, the text content in the corresponding language can be directly obtained for analysis and display.
  • both of the above two methods have corresponding drawbacks and are not flexible enough to use.
  • the first method when the server actively pushes a text message to the client or cannot normally obtain the locale/language parameter in the client text request, the target adaptation language cannot be determined, and the message push cannot be completed normally.
  • the second method the workload of embedding all relevant copywriting in multiple languages is large. When the embedded copywriting of the application needs to be changed or updated, a new App version needs to be released. The usability is not high and the dynamic changes cannot be displayed on the client side. Text.
  • the embodiments of the present disclosure provide a text adaptation display method, device, electronic equipment, server, and storage medium, so as to realize that in a variety of business scenarios, the client does not need to embed the copy of the client, and the client dynamically sends the copy of the server to the client. End local language adaptation.
  • an embodiment of the present disclosure provides a text adaptation display method, which is applied to a client, and the method includes:
  • the parameter to be filled is filled into the text to be displayed according to the parameter filling format, and the text filled according to the parameter to be filled is displayed.
  • an embodiment of the present disclosure provides a text adaptation display method applied to a server, and the method includes:
  • the text keyword of the text to be displayed and the parameters to be filled are sent to the client, so that after the client matches the text to be displayed corresponding to the text keyword in the target language package, Parse the parameter filling format of the text to be displayed, fill the parameter to be filled into the text to be displayed according to the parameter filling format, and display the text filled according to the parameter to be filled.
  • the embodiment of the present disclosure further provides a text adaptation display device, which is configured in the client, and the device includes:
  • the language pack obtaining module is set to obtain the target language pack from the server
  • the to-be-displayed text matching module is configured to match the to-be-displayed text corresponding to the text keyword in the target language package when a text keyword and a parameter to be filled are received;
  • a text parsing module configured to parse the parameter filling format of the text to be displayed
  • the text display module is configured to fill the parameters to be filled into the text to be displayed according to the parameter filling format, and display the text filled according to the parameters to be filled.
  • the embodiment of the present disclosure further provides a text adaptation display device, which is configured on the server side, and the device includes:
  • the language package sending module is set to send the target language package to the client in response to the client's target language package request;
  • the data sending module is configured to send the text keyword of the text to be displayed and the parameters to be filled to the client when text display is required, so that the client can match the text keyword in the target language package
  • the parameter filling format of the text to be displayed is parsed, the parameters to be filled are filled into the text to be displayed according to the parameter filling format, and the text filled according to the parameters to be filled is displayed .
  • an embodiment of the present disclosure further provides an electronic device, which includes:
  • One or more processing devices are One or more processing devices;
  • Storage device set to store one or more programs
  • the one or more processing devices When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the text adaptation display method applied to the client according to any embodiment of the present disclosure.
  • the embodiment of the present disclosure further provides a server, which includes:
  • One or more processing devices are One or more processing devices;
  • Memory set to store one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the text adaptation display method applied to the server as described in any embodiment of the present disclosure.
  • the embodiment of the present disclosure also provides a computer storage medium, and the computer storage medium stores a computer program.
  • the computer program is executed by a processor, the application of any embodiment of the present disclosure to the client or The text adaptation display method of the server.
  • FIG. 1a is a flowchart of a text adaptation display method applied to a client according to Embodiment 1 of the present disclosure
  • FIG. 1b is a schematic diagram of the parsing process of the to-be-displayed text provided in the first embodiment of the present disclosure
  • Fig. 2 is a flowchart of a text adaptation display method applied to a client provided in the second embodiment of the present disclosure
  • FIG. 3 is a flowchart of a text adaptation display method applied to a server according to a third embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of a text adaptation display device configured on a client according to a fourth embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of a text adaptation display device configured on a server according to Embodiment 5 of the present disclosure
  • Fig. 6 is a schematic structural diagram of an electronic device and/or a server provided in the sixth embodiment of the present disclosure.
  • FIG. 1a shows a flowchart of a text adaptation display method applied to a client provided by Embodiment 1 of the present disclosure.
  • the embodiment of the present disclosure is applicable to the case of adapting text to be displayed in applications of different languages.
  • the method can be implemented by a text adaptation display device configured on the client, and can be implemented by software and/or hardware in an electronic device.
  • the text adaptation display method applied to the client includes:
  • the server is a server that is business-related with the APP used by the user and provides data for the APP
  • the target language package is the language data package corresponding to the language type used by the user after starting the APP.
  • Each language data package contains the text to be displayed translated into the corresponding language type, where the text to be displayed can be a complete sentence, a sentence that needs to be filled with parameters, or a word.
  • the APP when the APP sends a target language package request to the server, it will carry locale information, the existing language package version number, and/or language type in the request.
  • the target language package request only contains location information
  • the acquired target language package is the language package corresponding to the language type used by the location indicated by the location information.
  • the target language pack request contains an existing language pack version number
  • the obtained language pack version number is the language pack of the latest version number determined after the version number comparison.
  • only the language pack is updated In the version of, you can use the incremental update method, only update the places that need to be updated, you can get the target language pack more quickly, reducing the amount of data processing.
  • the target language package request contains language type information
  • the obtained language package is the language package corresponding to the language type indicated by the language type information, and the language is used
  • the package replaces the existing language package.
  • the server when the server pushes a message to the client, it essentially pushes text keywords and parameters to be filled. Therefore, the client can match the corresponding text to be displayed in the target language package according to the text keyword. For clients that use language packs of different languages, for the same push message, each client receives the same text keyword and parameters to be filled. For example, there are three users’ APP clients, and the application languages are Chinese, English and German respectively. When the server pushes messages to the three users’ clients, the text keywords received by the three clients are all KEY-1. And the received parameters to be filled are Param-1, Param-2 and Param-3.
  • the text to be displayed includes parameter labels and parameter index information.
  • the parameter tag can indicate the type of parameter, where the parameter type can be customized according to the business requirements of the APP application. For example, in the live broadcast room of the APP that can be broadcast live, the text displayed is "User A sent two "A rose", you can define the name of user A as a user parameter, and the rose as a gift parameter; the parameter index refers to the character position of the parameter in the text to be displayed. In different languages, The position of the same parameter in the text to be displayed is different, which is determined by the language structure of different languages. For example, the word order structure between Chinese and English is different.
  • parsing the parameter filling format of the text to be displayed includes: determining the type of the parameter to be filled according to the parameter label and index information in the text to be displayed, and each parameter to be filled in the text to be displayed The filling position.
  • the comment area of the live broadcast room of the APP that can be broadcast live it is necessary to display the interaction between the host and the audience during the live broadcast.
  • the keyword KEY-1 and the parameters to be filled Param-1, Param-2, and Param-3 of the client push message of the user sending content in the live broadcast room.
  • the client matches the text to be displayed according to the keyword KEY-1:
  • the parsing process of the text to be displayed can refer to the parsing process shown in FIG. 1b, where TextPiece represents different types of parameters to be displayed.
  • S140 Fill the parameter to be filled into the text to be displayed according to the parameter filling format, and display the text after the parameter is filled.
  • the parameter to be filled is filled into the text to be displayed according to the parameter filling format, and the text filled according to the parameter to be filled is displayed.
  • the parameter to be filled can be filled into the text to be displayed according to the parsing result, and the text filled with the parameters can be displayed. For example, fill in the parameter Param-1 to be filled in the position (0: user), fill the parameter Param-2 in the position (1:string), and fill the parameter Param-3 in the position (2:gift) to get a complete display text.
  • the parameter-filled text may also be rendered before the parameter-filled text is displayed.
  • the rendering setting method can refer to the following content:
  • PieceType type 1
  • the parameters delivered by the server can be the custom-set parameter NULL, which means that no parameters need to be filled in the message pushed this time.
  • the embodiment of the present disclosure provides a text adaptation display method applied to a client.
  • the client obtains a language package from the server, and after receiving the text keyword and the parameters to be filled from the server, the text keyword is displayed on the target according to the text keyword.
  • the language pack matches the text to be displayed, so as to parse out the format of the text to be displayed, fill in the parameters to be filled in the corresponding position in the text to be displayed, and generate and display the final text, which solves the problem that the client cannot be determined on the server side.
  • the problem of inability to complete the adaptation in language realizes the adaptation and decoupling of application language and application business logic without depending on the location information of the client, making language adaptation more flexible.
  • FIG. 2 is a flowchart of a text adaptive display method applied to a client according to a second embodiment of the disclosure. This embodiment is based on multiple alternative solutions in the foregoing embodiment. As shown in FIG. 2, the text adaptation display method applied to the client provided in the embodiment of the present disclosure includes the following steps:
  • the APP For any APP software program used by the user, when the APP is started, or after the user sets the language type, the APP will request the target language package from the server to update the database of the client.
  • S220 Send a data request to the server, where the request includes request keywords and request parameters that are associated with the text keywords and the parameters to be filled.
  • the user In the process of using an APP, the user usually interacts with the server and requests target data from the server, such as the real-time votes of popular star XXX in a competition, the countdown of major programs, or the most popular food in a region And so on.
  • the request sent by the client includes request keywords and request parameters associated with the parameters to be filled.
  • the request keyword in the request can be KEY-2 .
  • the server determines the text keywords and parameters to be displayed (also called parameters to be filled) to be sent to the client according to the received request keywords and request parameters.
  • the server when the server pushes a message to the client, it essentially pushes text keywords and parameters to be filled. Therefore, the client can match the corresponding text to be displayed in the target language package according to the text keyword.
  • the method when the parameter to be filled does not match the language type of the target language package, before the parameter to be filled is filled into the text to be displayed according to the parameter filling format, the method also includes:
  • the filling the parameters to be filled into the text to be displayed according to the parameter filling format includes:
  • each client receives the same text keyword and parameters to be filled. Therefore, there are several situations for the parameters to be filled.
  • the first case is that the parameters to be filled are internationally accepted representations, such as Arabic numerals, proper nouns, and abbreviations of proper nouns. This type of parameters to be filled can be directly filled in The corresponding position of the text to be displayed; the second case is that the parameter to be filled does not match the language used by a client, but the parameter to be filled is the target data requested by the user, and no translation is required.
  • the filling parameter is directly filled into the text to be displayed;
  • the third case is that the parameter to be filled does not match the language used by a client, and the parameter to be filled needs to be replaced with the translated text corresponding to the language used by the client, and then
  • the translated parameters to be filled are filled into the text to be displayed.
  • the optional translation method is: pre-set identification labels for the parameters to be displayed in the third case, and embed the translated text with the same identification labels in the language pack, when the client receives the text sent by the server When keywords and parameters to be filled, you can directly search for the corresponding translated text in the target language package according to the identification tags of the parameters to be displayed. If the parameter to be displayed is an identification label, it means that the parameter to be displayed can be directly filled into the corresponding position of the text to be displayed.
  • S250 Fill the parameter to be filled into the text to be displayed according to the parameter filling format, and display the text after the parameter is filled.
  • the parameter to be filled is the parameter to be filled delivered by the server itself, or the translation text corresponding to the parameter to be filled delivered by the server in the target language package.
  • the parameter to be filled can be filled into the text to be displayed according to the parsing result, and the text filled with the parameters can be displayed.
  • the parameter-filled text may also be rendered before the parameter-filled text is displayed. For example, highlight keywords in the text filled with parameters, change the color and font of the text, etc., which can be set separately according to business needs.
  • the embodiment of the present disclosure provides a text adaptation display method applied to the client.
  • the client obtains a language package from the server, and sends a data request during the interaction with the server, and receives the data request determined by the server.
  • the text keywords and parameters to be filled in and then match the text to be displayed in the target language package according to the text keywords, so as to parse the format of the text to be displayed, and fill the parameters to be filled or the translated text of the parameters to be filled into the text to be displayed.
  • the corresponding position in the text, the final text is generated and displayed, which solves the problem that the adaptation cannot be completed when the server cannot determine the language used by the client, and realizes the completion of the application language and the language without relying on the client’s location information.
  • the adaptation and decoupling of application business logic makes language adaptation more flexible.
  • FIG. 3 shows a flowchart of a text adaptation display method applied to the server provided by the third embodiment of the present disclosure.
  • the embodiment of the present disclosure is applicable to the case of adapting the text to be displayed in applications of different language types.
  • the method can be implemented by a text adaptation display device configured on the server, and can be implemented by software and/or hardware in the server.
  • the text adaptation display method applied to the server provided by the embodiment of the present disclosure includes:
  • S310 In response to the client's request for the target language package, send the target language package to the client.
  • the APP will send the target language package request information to the server.
  • the request information carries the location (locale) information and the existing Language pack version number and/or language type.
  • the server determines the target language package based on the locale information, the existing language package version number and/or language type, and delivers the target language package to the client, thereby maintaining a language package interface that can be incrementally updated .
  • the server When the target language package request contains only location information, the server will send the language package corresponding to the language type used at the location indicated by the location information as the target language package to the client.
  • the server When the target language package request contains the existing language package version number, the server will compare the client’s existing language version number with the current latest language version number to determine whether they are consistent, and if they are inconsistent, the language package of the latest version number will be used. Distributed to the client.
  • the incremental update method can be used. Only the places that need to be updated are updated, which can obtain the target language pack more quickly and reduce the amount of data processing. .
  • the target language package request includes language type information, if the language type indicated by the language type information is different from the currently used language type, the server sends the language package corresponding to the language type indicated by the language type information to the client.
  • the server When the server actively pushes a message to the client, it is achieved by pushing the relevant text keyword and the parameters to be filled to the client, so that the client can match the text to be displayed corresponding to the text keyword in the target language package. Analyze the parameter filling format of the text to be displayed, fill the parameter to be filled into the text to be displayed according to the parsed parameter filling format, and display the filled text of the parameter.
  • the server receives the data request sent by the client, where the data request includes the request keyword and the request parameter. Furthermore, the client determines the text keywords to be sent to the client and the parameters to be filled according to the request keywords and request parameters. Among them, there are mainly two cases in the process of determining the parameters to be filled. One case is to directly determine the parameters to be displayed according to the requested parameters. For example, if the data requested by the client is to query the name of a TV show, then the determined parameters to be displayed are The name of the TV series does not require additional processing; another situation is that the server needs to calculate the parameters to be displayed based on the request parameters under the preset calculation logic. For example, the data requested by the client is a countdown to the start of an activity.
  • the server will calculate the countdown time under preset calculation logic and rules according to the request parameters, and feedback it to the client in real time until the user leaves the interface that displays the countdown on the client.
  • the text displayed on the client can be dynamically updated.
  • the language pack matching the APP when the APP has a new function module, correspondingly, the language pack matching the APP will add text content corresponding to the new function module, and the server will send the added text to the text translation in a preset format. Platform and obtain the multilingual translation results of the added text; update the translation results to the corresponding language packs respectively.
  • the text translation platform in the embodiment of the present disclosure is not limited. Any translation platform with translation function can be used in this embodiment. Generally, each application development company has a partner with each application development company. The translation platform completes the designated translation work.
  • the embodiment of the present disclosure provides a text adaptation display method applied to the server.
  • the server provides a language package to the client, and sends the text keyword and the parameters to be filled to the client, so that the client can follow the text keyword Match the text to be displayed in the language pack, parse out the format of the text to be displayed, fill in the parameters to be filled into the corresponding position in the text to be displayed, generate and display the final text, which solves the problem that the client cannot be determined on the server side
  • the problem of inability to complete the adaptation in language realizes that the server can complete the adaptation and decoupling of application language and application business logic without relying on the location information of the client, making language adaptation more flexible.
  • FIG. 4 shows a schematic structural diagram of a text adaptation display device configured on a client provided by the fourth embodiment of the present disclosure.
  • the embodiment of the present disclosure is applicable to the case of adapting text to be displayed in applications of different languages .
  • the text adaptation display device in the embodiment of the present disclosure includes: a language package acquisition module 410, a text matching module 420 to be displayed, a text analysis module 430, and a text display module 440.
  • the language package acquisition module 410 is configured to acquire the target language package from the server; the to-be-displayed text matching module 420 is configured to match the target language package with the The text to be displayed corresponding to the text keyword; the text parsing module 430 is configured to parse the parameter filling format of the text to be displayed; the text display module 440 is configured to fill the parameter to be filled in the parameter filling format according to the parameter filling format. In the text to be displayed, the text filled according to the parameters to be filled is displayed.
  • the client obtains the language package from the server, and after receiving the text keyword and the parameters to be filled from the server, the text to be displayed is matched in the language package according to the text keyword, thereby The format of the text to be displayed is parsed and the parameters to be filled are filled into the corresponding position in the text to be displayed, and the final text is generated and displayed.
  • the text adaptation display device configured on the client further includes a data request module configured to send a data request to the server before receiving the text keyword and the parameters to be filled, the data request including the text Keywords and request keywords and request parameters associated with the parameters to be filled.
  • a data request module configured to send a data request to the server before receiving the text keyword and the parameters to be filled, the data request including the text Keywords and request keywords and request parameters associated with the parameters to be filled.
  • the text to be displayed includes parameter labels and parameter index information. Accordingly, the text parsing module 430 is set to:
  • the type of the parameter to be filled and the filling position of each parameter to be filled in the text to be displayed are determined according to the parameter label and index information, wherein the filling position is determined by the language structure feature of the target language package.
  • the text adaptation display device configured on the client further includes a text replacement module, which is configured to: when the parameter to be filled does not match the language type of the target language pack, the Before the parameters to be filled are filled into the text to be displayed, determining in the target language package the translated text of the same language type as the parameters to be filled in the target language package;
  • the text display module 440 is also set to:
  • the text adaptation display device configured on the client terminal further includes a text rendering module configured to render the parameter-filled text before displaying the parameter-filled text.
  • the text adaptation display device configured on the client provided by the embodiment of the present disclosure can execute the text adaptation display method applied to the client provided by any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects for the execution method.
  • FIG. 5 shows a schematic structural diagram of a text adaptation display device configured on a server according to the fifth embodiment of the present disclosure.
  • the embodiment of the present disclosure is applicable to the case of adapting text to be displayed in applications of different languages .
  • the text adaptation display device in the embodiment of the present disclosure includes: a language packet sending module 510 and a data sending module 520.
  • the language package sending module 510 is set to send the target language package to the client in response to the client's target language package request;
  • the data sending module 520 is set to send the text of the text to be displayed to the client when text display is required Keywords and parameters to be filled, so that after the client matches the to-be-displayed text corresponding to the text keyword in the target language package, it parses the parameter filling format of the to-be-displayed text and adds The parameter to be filled is filled into the text to be displayed, and the text filled with the parameter to be filled is displayed.
  • the technical solution of the embodiment of the present disclosure provides a language package to the client through the server, and delivers text keywords and parameters to be filled to the client, so that the client can match the text to be displayed in the language package according to the text keywords , Parse out the format of the text to be displayed, fill in the parameters to be filled into the corresponding position in the text to be displayed, generate and display the final text, solve the problem that the adaptation cannot be completed when the server cannot determine the language used by the client, and realize
  • the server completes the adaptation and decoupling of application language and application business logic without depending on the location information of the client, making language adaptation more flexible.
  • the text adaptation display device configured on the server further includes a data determining module, which is configured to receive a data request sent by the client before the client sends the text keyword and the parameters to be filled in the text to be displayed. Including request keywords and request parameters; the text keywords and the parameters to be filled are determined according to the request keywords and the request parameters.
  • the text adaptation display device configured on the server further includes a translation module configured to send the added text to the text translation platform in a preset format and obtain the multilingual translation result of the added text; and separate the translation results Update to the corresponding language pack.
  • a translation module configured to send the added text to the text translation platform in a preset format and obtain the multilingual translation result of the added text; and separate the translation results Update to the corresponding language pack.
  • the text adaptation display device configured on the server provided by the embodiment of the present disclosure can execute the text adaptation display method applied to the server provided by any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects for the execution method.
  • FIG. 6 shows a schematic structural diagram of an electronic device and/or server 600 suitable for implementing embodiments of the present disclosure.
  • the electronic devices and/or servers in the embodiments of the present disclosure may include, for example, mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), tablet computers (Portable Android Device, PAD), and portable multimedia players.
  • Mobile terminals such as Personal Multimedia Player (PMP), in-vehicle terminals (such as car navigation terminals), and fixed terminals such as digital television (TV), desktop computers, etc., or multiple forms of servers, such as stand-alone servers Or server cluster.
  • PMP Personal Multimedia Player
  • TV digital television
  • desktop computers etc.
  • server cluster multiple forms of servers, such as stand-alone servers Or server cluster.
  • the electronic device and/or server shown in FIG. 6 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the electronic device and/or the server 600 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, and the processing device 601 may be stored in a read-only memory (Read-only Memory, ROM) 602
  • the program in or the program loaded from the storage device 605 to the random access storage device (Random Access Memory, RAM) 603 performs various appropriate actions and processing.
  • the RAM 603 also stores various programs and data required for the operation of the electronic device and/or the server 600.
  • the processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604.
  • An input/output (Input/Output, I/O) interface 605 is also connected to the bus 604.
  • the following devices can be connected to the I/O interface 604: including input devices 606 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD) Output devices 607 such as speakers, vibrators, etc.; storage devices 608 such as magnetic tapes, hard disks, etc.; and communication devices 609.
  • the communication device 609 may allow the electronic device and/or the server 600 to perform wireless or wired communication with other devices to exchange data.
  • FIG. 6 shows an electronic device and/or a server 600 having various devices, it is not required to implement or have all the illustrated devices. It may alternatively be implemented or provided with more or fewer devices.
  • the process described above with reference to the flowchart may be implemented as a computer software program.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing a display method of an operable control.
  • the computer program may be downloaded and installed from the network through the communication device 609, or installed from the storage device 604, or installed from the ROM 602.
  • the processing device 601 the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
  • the aforementioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
  • the computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the above.
  • the computer-readable storage medium may include: an electrical connection with one or more wires, a portable computer disk, a hard disk, RAM, ROM, an Erasable Programmable Read-Only Memory (EPROM) or flash memory, Optical fiber, compact Disc Read-Only Memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may be included in a baseband or a data signal propagated as a part of a carrier wave, which carries computer-readable program code. This propagated data signal can take many forms, including electromagnetic signals, optical signals, or any suitable combination of the above.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including: wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs.
  • the electronic device obtains the target language package from the server; after receiving the text keywords and parameters to be filled In the case of matching the to-be-displayed text corresponding to the text keyword in the target language package; parse the parameter filling format of the to-be-displayed text; fill the parameter to be filled in all the parameters according to the parameter filling format In the text to be displayed, the text filled according to the parameters to be filled is displayed.
  • the computer program code used to perform the operations of the present disclosure may be written in one or more programming languages or a combination thereof.
  • the above-mentioned programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional Procedural programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network-including Local Area Network (LAN) or Wide Area Network (WAN)-or it can be connected to an external computer (for example, use an Internet service provider to connect via the Internet).
  • LAN Local Area Network
  • WAN Wide Area Network
  • each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, or they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the units described in the embodiments of the present disclosure can be implemented in software or hardware. Among them, the name of the module does not constitute a limitation on the module itself in some cases.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Artificial Intelligence (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种文本适配显示方法、装置、电子设备、服务器及存储介质。其中,方法包括:从服务端获取目标语言包(S110);当接收到文本关键字及待填充参数时,在所述目标语言包中匹配与所述文本关键字对应的待显示文本(S120);解析所述待显示文本的参数填充格式(S130);根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示参数填充后的文本(S140)。

Description

文本适配显示方法、装置、电子设备、服务器及存储介质
本申请要求在2019年03月18日提交中国专利局、申请号为201910205047.4的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本公开实施例涉及计算机软件应用技术领域,例如涉及一种文本适配显示方法、装置、电子设备、服务器及存储介质。
背景技术
移动应用(Application,App)向国际市场推广需要做很多适配,其中,包括多语言适配,从而保证多个国家的用户使用App时,都可以使用熟悉的本国语言。
在相关技术中,有两种方法来解决多种语言适配的问题。其中,一种方法是在服务器中存储有多种语言的文本内容,由客户端通过应用程序接口(Application Programming Interface,API)向服务器请求目标语言的文本内容,在发出的请求当中带有场所和/或语言(locale/language)参数,服务器根据locale/language参数将相应的目标语言文本内容下发到客户端进行显示。另一种方法是,将App使用过程中需要的文本翻译为多种语言的文本,并预埋到App中作为本地文案,在客户端使用时可直接获取相应语言的文本内容进行解析并显示。
但是,上述两种方法均存在相应的弊端,使用不够灵活。第一种方法中,当服务器主动向客户端推送文本消息或不能正常获取到客户端文本请求中的locale/language参数时,就不能确定目标适配语言,不能正常的完成消息推送。第二种方法中,预埋多个语种的所有相关文案工作量大,当应用的预埋文案需要改动或更新时都需要发布新的App版本,可用性不高,而且不能在客户端显示动态变化的文本。
发明内容
本公开实施例提供了一种文本适配显示方法、装置、电子设备、服务器及存储介质,以实现在多种业务场景下,无需客户端预埋文案,将服务端动态下发的文案进行客户端本地语言适配。
在一实施例中,本公开实施例提供了一种文本适配显示方法,应用于客户 端,该方法包括:
从服务端获取目标语言包;
在接收到文本关键字及待填充参数的情况下,在所述目标语言包中匹配与所述文本关键字对应的待显示文本;
解析所述待显示文本的参数填充格式;
根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
在一实施例中,本公开实施例提供了一种文本适配显示方法,应用于服务端,该方法包括:
响应于客户端的目标语言包请求,向客户端发送目标语言包;
在需要进行文本显示的情况下,向客户端发送待显示文本的文本关键字及待填充参数,以使客户端在所述目标语言包中匹配到所述文本关键字对应的待显示文本后,解析所述待显示文本的参数填充格式,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
在一实施例中,本公开实施例还提供了一种文本适配显示装置,配置于客户端,该装置包括:
语言包获取模块,设置为从服务端获取目标语言包;
待显示文本匹配模块,设置为在接收到文本关键字及待填充参数的情况下,在所述目标语言包中匹配与所述文本关键字对应的待显示文本;
文本解析模块,设置为解析所述待显示文本的参数填充格式;
文本显示模块,设置为根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
在一实施例中,本公开实施例还提供了一种文本适配显示装置,配置于服务端,该装置包括:
语言包发送模块,设置为响应于客户端的目标语言包请求,向客户端发送目标语言包;
数据发送模块,设置为在需要进行文本显示的情况下,向客户端发送待显示文本的文本关键字及待填充参数,以使客户端在所述目标语言包中匹配到所述文本关键字对应的待显示文本后,解析所述待显示文本的参数填充格式,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据 所述待填充参数填充后的文本。
在一实施例中,本公开实施例还提供了一种电子设备,该电子设备包括:
一个或多个处理装置;
存储装置,设置为存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理装置执行,使得所述一个或多个处理装置实现如本公开中任意实施例所述的应用于客户端的文本适配显示方法。
在一实施例中,本公开实施例还提供了一种服务器,该服务器包括:
一个或多个处理装置;
存储器,设置为存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本公开中任意实施例所述的应用于服务端的文本适配显示方法。
在一实施例中,本公开实施例还提供了一种计算机存储介质,计算机存储介质上存储有计算机程序,该计算机程序被处理器执行时实现本公开任意实施例所提供的应用于客户端或服务端的文本适配显示方法。
附图说明
图1a是本公开实施例一提供的应用于客户端的文本适配显示方法的流程图;
图1b是本公开实施例一提供的待显示文本解析过程示意图;
图2是本公开实施例二提供的应用于客户端的文本适配显示方法的流程图;
图3是本公开实施例三提供的应用于服务端的文本适配显示方法的流程图;
图4是本公开实施例四提供的配置于客户端的文本适配显示装置的结构示意图;
图5是本公开实施例五提供的配置于服务端的文本适配显示装置的结构示意图;
图6是本公开实施例六提供的电子设备和/或服务器的结构示意图。
具体实施方式
以下将参照本公开实施例中的附图,通过实施方式描述本公开的技术方案, 所描述的实施例是本公开一部分实施例,而不是全部的实施例。下述多个实施例中,每个实施例中同时提供了可选特征和示例,实施例中记载的多个特征可进行组合,形成多个可选方案,不应将每个编号的实施例仅视为一个技术方案。
实施例一
图1a示出了本公开实施例一提供的应用于客户端的文本适配显示方法的流程图,本公开实施例可适用于在不同语言种类的应用中进行待显示的文本适配的情况,该方法可以由配置于客户端的文本适配显示装置实现,可通过电子设备中的软件和/或硬件来实施。
如图1a所示,本公开实施例提供的应用于客户端的文本适配显示方法包括:
S110、从服务端获取目标语言包。
对于用户使用的任意一个APP软件程序,在APP被启动时,或是用户设置切换语言种类后,APP会向服务端请求目标语言包,从而更新客户端的数据库。其中,服务端是与用户使用的APP在业务上相关联并为APP提供数据的服务器;目标语言包是用户在启动APP后使用的语言种类所对应的语言数据包。每一个语言数据包中都包含有翻译为相应语言种类的待显示文本,其中,待显示文本可以是一个完整的语句,可以是一个需要填充参数的语句,还可以是一个词语。
在一实施例中,APP在向服务端发送目标语言包请求时,会在请求中携带位置(locale)信息、已有语言包版本号和/或语言种类。当目标语言包请求中,仅包含位置信息时,获取的目标语言包即为位置信息指示出的地点所使用的语言种类对应的语言包。当目标语言包请求中,包含已有语言包版本号时,获取的语言包的版本号是经过版本号比对之后确定的最新版本号的语言包,在一实施例中,当仅更新语言包的版本时,可采用增量更新的方法,只更新需要更新的地方,可以更快捷地获取目标语言包,减少了数据处理量。当目标语言包请求中包含有语言种类信息时,若语言种类信息指示的语言种类与当前使用的语言种类不同,获取的语言包则是语言种类信息指示的语言种类对应的语言包,利用该语言包替换掉已有的语言包。
S120、当接收到文本关键字及待填充参数时,在所述目标语言包中匹配与所述文本关键字对应的待显示文本。
在一实施例中,当服务端向客户端推送消息时,实质上推送的是文本关键字和待填充参数。从而,客户端可以根据文本关键字在目标语言包中匹配到相应的需要进行显示的待显示文本。对于使用不同语言种类的语言包的客户端来说,针对同一个推送消息,每个客户端接收到的文本关键字和待填充参数是相同的。例如,有三个用户的APP客户端,应用的语言分别为汉语、英语和德语, 当服务器向三个用户的客户端推送消息时,三个客户端接收到的文本关键词均为KEY-1,以及接收到的待填充参数均为Param-1、Param-2和Param-3。
S130、解析所述待显示文本的参数填充格式。
其中,待显示文本中包括参数标签和参数索引信息。在一实施例中,参数标签可以表示参数的种类,其中,参数种类可以根据APP应用的业务需求进行自定义,如在可直播的APP的直播间中,显示的文案为“用户A送了两个玫瑰”,可将用户A的名称定义为用户类(user)参数,将玫瑰定义为礼物(gift)类参数;参数索引是指参数在待显示文本中的字符位置,在不同的语言中,同一参数在待显示文本中的位置不同,这是由不同语言的语言结构决定的,如中英文之间的语序结构是不同的。
在一实施例中,解析所述待显示文本的参数填充格式,包括:根据待显示文本中的参数标签和索引信息确定需要填充的参数的类型,以及每个需要填充的参数在待显示文本中的填充位置。
示例性的,在可直播的APP的直播间的评论区,需要显示主播直播中与观众的互动情况,当有观众给主播送礼物时,服务端会根据送礼物的观众上传的消息向在该直播间发送内容的用户的客户端推送消息的关键字KEY-1以及待填充参数Param-1、Param-2和Param-3。客户端根据关键字KEY-1匹配出了待显示文本:
"{0:user}送给了主播{1:string}个{2:gift}",或是
"{1:string}{2:gift}(s)has been send to anchor by{0:user}"。
进而,可以确定在待显示文本中的哪一个位置填充哪一类的参数。在使用中文的APP中,标签为(0:user)的参数填在文本句首的位置,表示送给主播礼物的观众的用户名称。在一实施例中,待显示文本解析过程可以参考图1b所示的解析过程,其中,TextPiece即表示不同类型(type)的待显示参数。
S140、根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示参数填充后的文本。
在一实施例中,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
当确定客户端对待显示文本的解析结果之后,便可以根据解析结果将待填充参数填充到待显示文本中,并显示参数填充后的文本。如将待填充参数Param-1填入(0:user)位置,将参数Param-2填入(1:string)位置,并将参数Param-3填入(2:gift)位置,得到完整的显示文本。
在一种可选的实施方式中,还可以在显示参数填充后的文本之前,对所述参数填充后的文本进行渲染。例如,用户名需要高亮显示,就定义user和string类型,分别代表用户名和普通的字符串参数,文案颜色和字体等可以根据业务需要分别进行设定。示例性的,渲染设置方式可参考如下内容:
message Text{
string key=1;
string default_pattern=2;
TextFormat default_format=3;
repeated TextPiece pieces=4;
}//设置文本样式
message TextFormat{
uint32 argb=1;
bool bold=2;
bool italic=3;
}//设置渲染形式(颜色,加粗,斜体)
message TextPiece{
PieceType type=1;
TextFormat format=2;
string string_value=11;
TextPieceUser user_value=21;
}//自定义参数值
message TextPieceUser{
User user=1;
}//参数类别标签设定
在另一种实施方式中,当匹配到的待显示文本无需添加参数时,服务端下发的参数可以是自定义设定的参数NULL,表示在此次推送的消息中不需要填充参数。
本公开实施例提供的一种应用于客户端的文本适配显示方法,通过客户端 从服务端获取语言包,在接收服务端下发的文本关键字和待填充参数之后,根据文本关键字在目标语言包中匹配出待显示的文本,从而解析出待显示文本的格式,将待填充参数填入待显示文本中相应的位置,生成并显示最终的文本,解决了在服务端不能确定客户端使用语言时无法完成适配的问题,实现了在不依赖于客户端的位置信息的情况下,完成应用语言与应用业务逻辑的适配解耦,使语言适配更加灵活。
实施例二
图2为本公开实施例二提供的一种应用于客户端的文本适配显示方法的流程图。本实施例以上述实施例中多个可选方案为基础。如图2所示,本公开实施例中提供的应用于客户端的文本适配显示方法包括如下步骤:
S210、从服务端获取目标语言包。
对于用户使用的任意一个APP软件程序,在APP被启动时,或是用户设置切换语言种类后,APP会向服务端请求目标语言包,从而更新客户端的数据库。
S220、向服务端发送数据请求,所述请求中包括与所述文本关键字和所述待填充参数相关联的请求关键字和请求参数。
在用户使用一个APP的过程中,通常会与服务器之间产生数据的交互,向服务器端请求目标数据,如人气明星XXX在一个比赛中的实时票数、重大节目开始倒计时或一个地区人气高的美食等等内容。在一实施例中,在客户端发出的请求中包含有与待填充参数相关联的请求关键字和请求参数。示例性的,在“人气明星XXX在一个比赛中的实时票数”这一请求中,人气明星的姓名XXX、比赛名称及票数都是请求的参数,在该请求中请求关键字可以是KEY-2。从而使服务端根据接收到的请求关键词和请求参数,确定下发给客户端的文本关键字和待显示参数(也可称为待填充参数)。
S230、当接收到文本关键字及待填充参数时,在所述目标语言包中匹配与所述文本关键字对应的待显示文本。
在一实施例中,当服务端向客户端推送消息时,实质上推送的是文本关键字和待填充参数。从而,客户端可以根据文本关键字在目标语言包中匹配到相应的需要进行显示的待显示文本。
在一实施例中,在所述待填充参数与所述目标语言包的语言种类不匹配的情况下,在根据所述参数填充格式将所述待填充参数填充到所述待显示文本中之前,所述方法还包括:
在所述目标语言包中确定所述待填充参数与所述目标语言包的语言种类相同的对应的翻译文本;
所述根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,包括:
根据所述参数填充格式将所述待填充参数的翻译文本填充到所述待显示文本中。
对于使用不同语言种类的语言包的客户端来说,针对同一个推送消息,每个客户端接收到的文本关键字和待填充参数是相同的。因此,待填充参数存在几种情况,第一种情况是,待填充参数为国际通用的表示方式,如阿拉伯数字、专用名词及专用名词的缩写等,这一类的待填充参数可以直接填充到待显示文本的相应位置处;第二种情况是,待填充参数与一个客户端使用的语言不匹配,但是该待填充参数为用户请求的目标数据,无需进行翻译,也可以直接将此类待填充参数直接填充到待显示的文本中;第三种情况是,待填充参数与一个客户端使用的语言不匹配,需要将待填充参数替换为客户端使用的语言种类对应的翻译文本,再将翻译后的待填充参数填充到待显示文本中。可选的翻译方式是:预先为第三种情况中的待显示参数设置识别标签,并在语言包中预埋设置有同样的识别标签的翻译文本,当客户端接收到服务端下发的文本关键字与待填充参数时,可以直接根据待显示参数的识别标签在目标语言包中查找对应的翻译文本。若待显示参数为识别标签,则说明该待显示参数可直接填充到待显示文本的相应位置处。
S240、解析所述待显示文本的参数填充格式。
该步骤可参考本公开实施例一中S130的相关描述。
S250、根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示参数填充后的文本。
在本实施例中,待填充参数为服务端下发的待填充参数本身,或是服务端下发的待填充参数在目标语言包中对应的翻译文本。当确定客户端对待显示文本的解析结果之后,便可以根据解析结果将待填充参数填充到待显示文本中,并显示参数填充后的文本。
在一种可选的实施方式中,还可以在显示参数填充后的文本之前,对参数填充后的文本进行渲染。例如,将参数填充后的文本中关键词高亮显示,改变文本的颜色和字体等,可以根据业务需要分别进行设定。
本公开实施例提供的一种应用于客户端的文本适配显示方法,通过客户端从服务端获取语言包,并在与服务端的交互过程中发送数据请求,接收服务端 下发的根据数据请求确定的文本关键字和待填充参数,进而根据文本关键字在目标语言包中匹配出待显示的文本,从而解析出待显示文本的格式,将待填充参数或待填充参数的翻译文本填入待显示文本中相应的位置,生成并显示最终的文本,解决了在服务端不能确定客户端使用语言时无法完成适配的问题,实现了在不依赖于客户端的位置信息的情况下,完成应用语言与应用业务逻辑的适配解耦,使语言适配更加灵活。
实施例三
图3示出了本公开实施例三提供的应用于服务端的文本适配显示方法的流程图,本公开实施例可适用于在不同语言种类的应用中进行待显示的文本适配的情况,该方法可以由配置于服务端的文本适配显示装置实现,可通过服务器中的软件和/或硬件来实施。如图3所示,本公开实施例提供的应用于服务端的文本适配显示方法包括:
S310、响应于客户端的目标语言包请求,向客户端发送目标语言包。
对于用户使用的任意一个APP软件程序,在APP被启动时,或是用户设置切换语言种类后,APP会向服务端发送目标语言包请求信息,在请求信息中携带位置(locale)信息、已有语言包版本号和/或语言种类。那么,服务端便根据位置(locale)信息、已有语言包版本号和/或语言种类确定目标语言包,并将目标语言包下发到客户端,从而维持一个可增量更新的语言包接口。
当目标语言包请求中,仅包含位置信息时,服务端便将位置信息指示出的地点所使用的语言种类对应的语言包作为目标语言包下发到客户端。当目标语言包请求中,包含已有语言包版本号时,服务端将客户端已有语言版本号与当前最新语言版本号进行比对判断是否一致,当不一致是便将最新版本号的语言包下发到客户端,在一实施例中,当仅更新语言包的版本时,可采用增量更新的方法,只更新需要更新的地方,可以更快捷地获取目标语言包,减少了数据处理量。当目标语言包请求中包含有语言种类信息时,若语言种类信息指示的语言种类与当前使用的语言种类不同,服务端便将语言种类信息指示的语言种类对应的语言包发送到客户端。
S320、在需要进行文本显示时,向客户端发送待显示文本的文本关键字及待填充参数,以使客户端在所述目标语言包中匹配到所述文本关键字对应的待显示文本后,解析所述待显示文本的参数填充格式,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示参数填充后的文本。
当服务端向客户端主动推送消息时,是通过向客户端推送相关的文本关键 字与待填充参数实现的,从而使客户端在目标语言包中匹配到与文本关键字对应的待显示文本后,解析待显示文本的参数填充格式,根据解析得到的参数填充格式将所述待填充参数填充到待显示文本中,并显示参数填充后的文本。
在另一实施方式中,服务端在接收到客户端发送的数据请求,其中,数据请求中包含请求关键字和请求参数。进而,客户端根据请求关键字和请求参数确定要下发到客户端的文本关键字及待填充参数。其中,待填充参数的确定过程主要有两种情况,一种情况是根据请求参数直接确定待显示参数,例如,客户端请求的数据是想查询一个电视剧的名字,那么确定的待显示参数即为电视剧的名字,无需其他的处理过程;另一种情况是,服务端需要根据请求参数在预设的计算逻辑下计算出待显示的参数,例如,客户端请求的数据是一个活动开始的倒计时,是一个动态变化的数据,服务端便会根据请求参数在预设的计算逻辑和规则下计算出倒计时的时间,并实时的反馈到客户端,直到用户在客户端离开显示倒计时的界面,从而使客户端显示的文本能够进行动态更新。
在一实施例中,当APP有新的功能模块时,相应的,与APP配套的语言包会增加与新的功能模块对应的文本内容,服务端会将增加文本按照预设格式发送到文本翻译平台并获取增加文本的多语言翻译结果;将翻译结果分别更新到相应的语言包中。在一实施例中,本公开实施例中对文本翻译平台并不做限定,具有翻译功能的翻译平台均可以为本实施例所用,通常每个应用开发公司均有与每个应用开发公司合作的翻译平台完成指定的翻译工作。
本公开实施例提供的一种应用于服务端的文本适配显示方法,通过服务端向客户端提供语言包,并向客户端下发文本关键字和待填充参数,从而使客户端根据文本关键字在语言包中匹配出待显示的文本,解析出待显示文本的格式,将待填充参数填入待显示文本中相应的位置,生成并显示最终的文本,解决了在服务端不能确定客户端使用语言时无法完成适配的问题,实现了服务端在不依赖于客户端的位置信息的情况下,完成应用语言与应用业务逻辑的适配解耦,使语言适配更加灵活。
实施例四
图4示出了本公开实施例四提供的一种配置于客户端的文本适配显示装置的结构示意图,本公开实施例可适用于在不同语言种类的应用中进行待显示的文本适配的情况。
如图4所示,本公开实施例中文本适配显示装置,包括:语言包获取模块410、待显示文本匹配模块420、文本解析模块430和文本显示模块440。
其中,语言包获取模块410,设置为从服务端获取目标语言包;待显示文本 匹配模块420,设置为当接收到文本关键字及待填充参数时,在所述目标语言包中匹配与所述文本关键字对应的待显示文本;文本解析模块430,设置为解析所述待显示文本的参数填充格式;文本显示模块440,设置为根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
本公开实施例的技术方案,通过客户端从服务端获取语言包,在接收服务端下发的文本关键字和待填充参数之后,根据文本关键字在语言包中匹配出待显示的文本,从而解析出待显示文本的格式将待填充参数填入待显示文本中相应的位置,生成并显示最终的文本,解决了在服务端不能确定客户端使用语言时无法完成适配的问题,实现了在不依赖于客户端的位置信息的情况下,完成应用语言与应用业务逻辑的适配解耦,使语言适配更加灵活。
可选的,配置于客户端的文本适配显示装置还包括数据请求模块,设置为在接收到文本关键字及待填充参数之前,向服务端发送数据请求,所述数据请求中包括与所述文本关键字和所述待填充参数相关联的请求关键字和请求参数。
可选的,待显示文本中包括参数标签和参数索引信息,相应的,文本解析模块430是设置为:
根据所述参数标签和索引信息确定需要填充的参数的类型,以及每个需要填充的参数在待显示文本中的填充位置,其中,所述填充位置是由目标语言包的语言结构特征确定的。
可选的,配置于客户端的文本适配显示装置还包括文本替换模块,设置为当所述待填充参数与所述目标语言包的语言种类不匹配时,在根据所述参数填充格式将所述待填充参数填充到所述待显示文本中之前,在所述目标语言包中确定所述待填充参数与所述目标语言包的语言种类相同的翻译文本;
相应的,文本显示模块440还设置为:
根据所述参数填充格式将所述待填充参数的翻译文本填充到所述待显示文本中。
可选的,配置于客户端的文本适配显示装置还包括文本渲染模块,设置为在显示参数填充后的文本之前,对所述参数填充后的文本进行渲染。
本公开实施例所提供的配置于客户端的文本适配显示装置可执行本公开任意实施例所提供的应用于客户端的文本适配显示方法,具备执行方法相应的功能模块和有益效果。
实施例五
图5示出了本公开实施例五提供的一种配置于服务端的文本适配显示装置的结构示意图,本公开实施例可适用于在不同语言种类的应用中进行待显示的文本适配的情况。
如图5所示,本公开实施例中文本适配显示装置,包括:语言包发送模块510和数据发送模块520。
其中,语言包发送模块510,设置为响应于客户端的目标语言包请求,向客户端发送目标语言包;数据发送模块520,设置为在需要进行文本显示时,向客户端发送待显示文本的文本关键字及待填充参数,以使客户端在所述目标语言包中匹配到所述文本关键字对应的待显示文本后,解析所述待显示文本的参数填充格式,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示所述待填充参数填充后的文本。
本公开实施例的技术方案,通过服务端向客户端提供语言包,并向客户端下发文本关键字和待填充参数,从而使客户端根据文本关键字在语言包中匹配出待显示的文本,解析出待显示文本的格式将待填充参数填入待显示文本中相应的位置,生成并显示最终的文本,解决了在服务端不能确定客户端使用语言时无法完成适配的问题,实现了服务端在不依赖于客户端的位置信息的情况下,完成应用语言与应用业务逻辑的适配解耦,使语言适配更加灵活。
可选的,配置于服务端的文本适配显示装置还包括数据确定模块,设置为在客户端发送待显示文本的文本关键字及待填充参数之前,接收客户端发送的数据请求,所述数据请求中包括请求关键字和请求参数;根据所述请求关键字和所述请求参数确定所述文本关键字及所述待填充参数。
可选的,配置于服务端的文本适配显示装置还包括翻译模块,设置为将增加文本按照预设格式发送到文本翻译平台并获取所述增加文本的多语言翻译结果;将所述翻译结果分别更新到相应的语言包中。
本公开实施例所提供的配置于服务端的文本适配显示装置可执行本公开任意实施例所提供的应用于服务端的文本适配显示方法,具备执行方法相应的功能模块和有益效果。
实施例六
下面参考图6,图6示出了适于用来实现本公开实施例的电子设备和/或服务器600的结构示意图。本公开实施例中的电子设备和/或服务器可以包括诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,PDA)、平板电脑(Portable Android Device,PAD)、便携式多媒体播放器(Personal Multimedia Player,PMP)、车载终端(例如车载导航终端) 等等的移动终端以及诸如数字电视(television,TV)、台式计算机等等的固定终端,或者多种形式的服务器,如独立服务器或者服务器集群。图6示出的电子设备和/或服务器仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图6所示,电子设备和/或服务器600可以包括处理装置(例如中央处理器、图形处理器等)601,处理装置601可以根据存储在只读存储装置(Read-only Memory,ROM)602中的程序或者从存储装置605加载到随机访问存储装置(Random Access Memory,RAM)603中的程序而执行多种适当的动作和处理。在RAM 603中,还存储有电子设备和/或服务器600操作所需的多种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(Input/Output,I/O)接口605也连接至总线604。
通常,以下装置可以连接至I/O接口604:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备和/或服务器600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有多种装置的电子设备和/或服务器600,但是并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行可操作控件的显示方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置604被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。
本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质可以包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、RAM、ROM、可擦式可编程只读存储装置(Erasable Programmable Read-Only Memory,EPROM)或闪存、光纤、便携式紧凑磁盘只读存储装置(Compact Disc Read-Only Memory,CD-ROM)、光存储装置件、磁存储装置件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中 或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该处理装置执行时,使得该电子设备:从服务端获取目标语言包;在接收到文本关键字及待填充参数的情况下,在所述目标语言包中匹配与所述文本关键字对应的待显示文本;解析所述待显示文本的参数填充格式;根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(Local Area Network,LAN)或广域网(Wide Area Network,WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开多种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以 通过硬件的方式来实现。其中,模块的名称在一些情况下并不构成对该模块本身的限定。

Claims (13)

  1. 一种文本适配显示方法,应用于客户端,包括:
    从服务端获取目标语言包;
    在接收到文本关键字及待填充参数的情况下,在所述目标语言包中匹配与所述文本关键字对应的待显示文本;
    解析所述待显示文本的参数填充格式;
    根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
  2. 根据权利要求1所述的方法,其中,在所述接收到文本关键字及待填充参数之前,所述方法还包括:
    向所述服务端发送数据请求,所述数据请求中包括与所述文本关键字和所述待填充参数相关联的请求关键字和请求参数。
  3. 根据权利要求1所述的方法,其中,所述待显示文本中包括参数标签和参数索引信息,所述解析所述待显示文本的参数填充格式,包括:
    根据所述参数标签和所述索引信息确定需要填充的参数的类型,以及每个需要填充的参数在所述待显示文本中的填充位置,其中,所述填充位置是由所述目标语言包的语言结构特征确定的。
  4. 根据权利要求1所述的方法,其中,在所述待填充参数与所述目标语言包的语言种类不匹配的情况下,在根据所述参数填充格式将所述待填充参数填充到所述待显示文本中之前,所述方法还包括:
    在所述目标语言包中确定所述待填充参数与所述目标语言包的语言种类相同的翻译文本;
    所述根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,包括:
    根据所述参数填充格式将所述待填充参数的翻译文本填充到所述待显示文本中。
  5. 根据权利要求1-4任一所述的方法,其中,在所述显示所述待填充参数填充后的文本之前,所述方法还包括:
    对所述待填充参数填充后的文本进行渲染。
  6. 一种文本适配显示方法,应用于服务端,包括:
    响应于客户端的目标语言包请求,向所述客户端发送目标语言包;
    在需要进行文本显示的情况下,向所述客户端发送待显示文本的文本关键字及待填充参数,以使所述客户端在所述目标语言包中匹配到所述文本关键字对应的待显示文本后,解析所述待显示文本的参数填充格式,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示所述待填充参数填充后的文本。
  7. 根据权利要求6所述的方法,其中,在向所述客户端发送待显示文本的文本关键字及待填充参数之前,所述方法还包括:
    接收所述客户端发送的数据请求,所述数据请求中包括请求关键字和请求参数;
    根据所述请求关键字和所述请求参数确定所述文本关键字及所述待填充参数。
  8. 根据权利要求6或7所述的方法,还包括:
    将增加文本按照预设格式发送到文本翻译平台并获取所述增加文本的多语言翻译结果;
    将所述翻译结果分别更新到相应的语言包中。
  9. 一种文本适配显示装置,配置于客户端,包括:
    语言包获取模块,设置为从服务端获取目标语言包;
    待显示文本匹配模块,设置为在接收到文本关键字及待填充参数的情况下,在所述目标语言包中匹配与所述文本关键字对应的待显示文本;
    文本解析模块,设置为解析所述待显示文本的参数填充格式;
    文本显示模块,设置为根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示根据所述待填充参数填充后的文本。
  10. 一种文本适配显示装置,配置于服务端,包括:
    语言包发送模块,设置为响应于客户端的目标语言包请求,向所述客户端发送目标语言包;
    数据发送模块,设置为在需要进行文本显示的情况下,向所述客户端发送待显示文本的文本关键字及待填充参数,以使所述客户端在所述目标语言包中匹配到所述文本关键字对应的待显示文本后,解析所述待显示文本的参数填充格式,根据所述参数填充格式将所述待填充参数填充到所述待显示文本中,并显示所述待填充参数填充后的文本。
  11. 一种电子设备,包括:
    一个或多个处理装置;
    存储装置,设置为存储一个或多个程序;
    所述一个或多个程序被所述一个或多个处理装置执行,使得所述一个或多个处理装置实现如权利要求1-5中任一所述的应用于客户端的文本适配显示方法。
  12. 一种服务器,包括:
    一个或多个处理装置;
    存储器,设置为存储一个或多个程序;
    所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求6-8中任一所述的应用于服务端的文本适配显示方法。
  13. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-8中任一所述的应用于客户端或服务端的文本适配显示方法。
PCT/CN2020/070718 2019-03-18 2020-01-07 文本适配显示方法、装置、电子设备、服务器及存储介质 WO2020186904A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910205047.4 2019-03-18
CN201910205047.4A CN109947512B (zh) 2019-03-18 2019-03-18 一种文本适配显示方法、装置、服务器及存储介质

Publications (1)

Publication Number Publication Date
WO2020186904A1 true WO2020186904A1 (zh) 2020-09-24

Family

ID=67008430

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/070718 WO2020186904A1 (zh) 2019-03-18 2020-01-07 文本适配显示方法、装置、电子设备、服务器及存储介质

Country Status (2)

Country Link
CN (1) CN109947512B (zh)
WO (1) WO2020186904A1 (zh)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840273B (zh) * 2019-01-18 2020-09-15 珠海天燕科技有限公司 一种文案生成方法和装置
CN109947512B (zh) * 2019-03-18 2020-06-05 北京字节跳动网络技术有限公司 一种文本适配显示方法、装置、服务器及存储介质
CN110401841B (zh) * 2019-07-19 2021-10-29 北京字节跳动网络技术有限公司 一种直播间消息的解析方法、装置、设备及存储介质
CN110536149A (zh) * 2019-09-02 2019-12-03 北京字节跳动网络技术有限公司 消息显示方法、装置、可读介质及电子设备
CN112925655B (zh) * 2019-12-05 2024-02-27 台达电子工业股份有限公司 划分服务的解耦系统及其方法
CN111010392B (zh) * 2019-12-13 2022-09-02 惠州Tcl移动通信有限公司 灾害信息的显示方法、装置、存储介质及电子设备
CN111177634A (zh) * 2020-01-03 2020-05-19 北京字节跳动网络技术有限公司 支持多语言的文案内容加载方法、装置、设备、及介质
CN111857906B (zh) * 2020-06-03 2022-02-01 北京旷视科技有限公司 终端的文本显示方法、装置、系统和存储介质
CN112073487B (zh) * 2020-08-28 2023-08-01 北京达佳互联信息技术有限公司 信令发送、信令展示方法、装置、电子设备及存储介质
CN113392356B (zh) * 2021-06-28 2024-04-12 北京沃东天骏信息技术有限公司 文案适配方法、装置及存储介质
CN113360657B (zh) * 2021-06-30 2023-10-24 安徽商信政通信息技术股份有限公司 一种公文智能分发办理方法、装置及计算机设备
CN115965017B (zh) * 2023-01-04 2023-11-10 北京三维天地科技股份有限公司 一种基于开发平台的多语言录入和解析系统及方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104020991A (zh) * 2014-05-16 2014-09-03 可牛网络技术(北京)有限公司 应用程序的多语言切换方法及装置
US8930308B1 (en) * 2012-08-20 2015-01-06 3Play Media, Inc. Methods and systems of associating metadata with media
CN108924030A (zh) * 2018-05-31 2018-11-30 康键信息技术(深圳)有限公司 电子装置、动态配置消息展示方式的方法及存储介质
CN109947512A (zh) * 2019-03-18 2019-06-28 北京字节跳动网络技术有限公司 一种文本适配显示方法、装置、服务器及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6993568B1 (en) * 2000-11-01 2006-01-31 Microsoft Corporation System and method for providing language localization for server-based applications with scripts
US7801721B2 (en) * 2006-10-02 2010-09-21 Google Inc. Displaying original text in a user interface with translated text
CN104199662A (zh) * 2014-09-01 2014-12-10 浪潮电子信息产业股份有限公司 一种适用于flex项目的多语言支持技术
CN106873971B (zh) * 2016-12-29 2020-08-04 武汉斗鱼网络科技有限公司 一种flash应用的多语言展示方法和系统
CN107122190A (zh) * 2017-04-27 2017-09-01 努比亚技术有限公司 一种多语言静态页面生成方法、服务器和存储介质
CN107590110B (zh) * 2017-09-20 2021-09-28 广州酷狗计算机科技有限公司 文本显示方法及装置
CN108021423B (zh) * 2017-12-15 2021-05-04 语联网(武汉)信息技术有限公司 一种多语化网站生成方法、系统以及计算机可读存储介质
CN109325121B (zh) * 2018-09-14 2021-04-02 北京字节跳动网络技术有限公司 用于确定文本的关键词的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8930308B1 (en) * 2012-08-20 2015-01-06 3Play Media, Inc. Methods and systems of associating metadata with media
CN104020991A (zh) * 2014-05-16 2014-09-03 可牛网络技术(北京)有限公司 应用程序的多语言切换方法及装置
CN108924030A (zh) * 2018-05-31 2018-11-30 康键信息技术(深圳)有限公司 电子装置、动态配置消息展示方式的方法及存储介质
CN109947512A (zh) * 2019-03-18 2019-06-28 北京字节跳动网络技术有限公司 一种文本适配显示方法、装置、服务器及存储介质

Also Published As

Publication number Publication date
CN109947512A (zh) 2019-06-28
CN109947512B (zh) 2020-06-05

Similar Documents

Publication Publication Date Title
WO2020186904A1 (zh) 文本适配显示方法、装置、电子设备、服务器及存储介质
CN109324861B (zh) 消息显示处理方法、装置、介质及电子设备
US11711441B2 (en) Method and apparatus for publishing video synchronously, electronic device, and readable storage medium
WO2022116841A1 (zh) 文本翻译方法、装置、设备及存储介质
CN109036397B (zh) 用于呈现内容的方法和装置
JP7397094B2 (ja) リソース構成方法、リソース構成装置、コンピューター機器、及びコンピュータープログラム
US20210266276A1 (en) Name label display method and apparatus
US11095957B2 (en) Method and apparatus for publishing information, and method and apparatus for processing information
WO2022057677A1 (zh) 振动控制方法、装置、电子设备和计算机可读存储介质
CN113778419B (zh) 多媒体数据的生成方法、装置、可读介质及电子设备
JP2021197153A (ja) ワードスロットを識別するための方法及び装置、電子機器、記憶媒体並びにコンピュータプログラム
CN112328094A (zh) 信息输入方法、云端输入法系统和客户端
CN111694629A (zh) 信息展示方法、装置和电子设备
WO2020207083A1 (zh) 信息分享的方法、装置、电子设备及计算机可读存储介质
CN112492399B (zh) 信息显示方法、装置及电子设备
CN110147283B (zh) 一种显示内容切换显示方法、装置、设备及介质
CN110618811B (zh) 信息呈现方法和装置
CN116303888A (zh) 一种生僻字处理方法、装置、存储介质及电子设备
CN111625250B (zh) 应用更新方法、装置、存储介质及电子设备
CN113378895B (zh) 一种分类模型生成方法、装置、存储介质及电子设备
JP2024500300A (ja) 情報インタラクション方法、装置、及び機器
CN114595702A (zh) 一种文本翻译模型训练方法、文本翻译方法及相关装置
CN113296771A (zh) 页面显示方法、装置、设备和计算机可读介质
CN115374320B (zh) 文本匹配方法、装置、电子设备、计算机介质
CN113259414B (zh) 信息推送方法、装置、电子设备和计算机可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20774507

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.02.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20774507

Country of ref document: EP

Kind code of ref document: A1