CN114818606A - Text information localization method and device, electronic equipment and storage medium - Google Patents

Text information localization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114818606A
CN114818606A CN202210492431.9A CN202210492431A CN114818606A CN 114818606 A CN114818606 A CN 114818606A CN 202210492431 A CN202210492431 A CN 202210492431A CN 114818606 A CN114818606 A CN 114818606A
Authority
CN
China
Prior art keywords
text
target
font
localization
preset
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
CN202210492431.9A
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 CN202210492431.9A priority Critical patent/CN114818606A/en
Publication of CN114818606A publication Critical patent/CN114818606A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/117Tagging; Marking up; Designating a block; Setting of attributes
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/25Output arrangements for video game devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/109Font handling; Temporal or kinetic typography
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application discloses a text information localization method, a text information localization device, electronic equipment and a computer readable storage medium; the method and the device can determine the target display language of the text of the game interface; when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed; determining a target display format of the target text based on localized configuration parameters of text of the game interface; and displaying the target text on the game interface according to the target display format. The method and the device for text localization can solve the problem of format switching such as fonts during text localization, and avoid the problems of disordered and irregular display after text localization in games.

Description

Text information localization method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of games, in particular to a text information localization method and device, electronic equipment and a computer readable storage medium.
Background
Since the users of the game software may come from all over the world, the language configuration is performed on the game, different languages are applied to the game according to the selection of the players, namely, the texts in the game are localized, and the language barrier of the players in the game can be eliminated.
However, in the actual development process, the inventor of the embodiment of the present application finds that, on one hand, a commonly used game engine, such as Unity3D, does not support localization of static text; on the other hand, even if localization of the dynamic text can be achieved, the problem of format switching such as fonts and the like during text localization cannot be effectively solved, and the problem that display of the localized text in the game is disordered and irregular is caused.
Disclosure of Invention
The embodiment of the application provides a text information localization method and device, electronic equipment and a computer readable storage medium, which can solve the problem of format switching such as fonts and the like during text localization and avoid the problems of disordered and irregular display after the text localization in a game.
In a first aspect, an embodiment of the present application provides a text information localization method, including:
determining a target display language of a text of a game interface;
when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed;
determining a target display format of the target text based on localized configuration parameters of text of the game interface;
and displaying the target text on the game interface according to the target display format.
In a second aspect, an embodiment of the present application further provides a text information localization apparatus, including:
a first determination unit for determining a target display language of a text of the game interface;
the game interface display device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a target text matched with a target display language from a preset text table based on a target text identifier of the text content to be displayed when the text content to be displayed on the game interface exists;
the second determining unit is used for determining a target display format of the target text based on the localization configuration parameters of the text of the game interface;
and the display unit is used for displaying the target text on the game interface according to the target display format.
In some embodiments, the localization configuration parameters include a target font configuration parameter of the target display language, and the second determining unit is specifically configured to:
determining target font configuration parameters associated with the target display language from font configuration parameters associated with each preset language;
and determining a target display format of the target text based on the target font configuration parameters.
In some embodiments, the target font configuration parameter includes at least one of a font size, a font type, a text column spacing, and a text line spacing associated with the target display language, and the second determining unit is specifically configured to:
and adjusting the font format of the target text according to at least one of the font size, the font type, the text column spacing and the text line spacing associated with the target display language to obtain the target display format of the target text.
In some embodiments, the target font configuration parameter includes at least one of a first font type of the interactive control text and a second font type of the non-interactive control text, and the second determining unit is specifically configured to:
detecting a text type of the target text;
if the text type is an interactive control text, adjusting the font format of the target text based on the first font type to obtain the target display format of the target text;
in some embodiments, the second determining unit is specifically configured to:
detecting a text type of the target text;
and if the text type is a non-interactive control text, adjusting the font format of the target text based on the second font type to obtain the target display format of the target text.
In some embodiments, the text information localization apparatus further includes a configuration unit, and before determining the target font configuration parameter associated with the target display language from among the font configuration parameters associated with the preset languages, the configuration unit is specifically configured to:
constructing a font surface preset body of a localization component based on a game engine text component;
acquiring font configuration parameters associated with each preset language;
outputting the font configuration parameters associated with the preset languages to the font table preset body;
in some embodiments, the second determining unit is specifically configured to:
and calling a preset font switching function through the localization component to switch fonts so as to acquire target font configuration parameters associated with the target display language from the font table preset body.
In some embodiments, the localized configuration parameter includes a line feed on/off state of a specific character string, and the second determining unit is specifically configured to:
detecting the line feed starting and stopping state of the specific character string;
if the line feed starting and stopping state of the specific character string is the starting state, replacing the specific character string in the target text with a line feed character to obtain a first format text of the target text;
and obtaining a target display format of the target text based on the first format text.
In some embodiments, the localization configuration parameters include a non-linefeed opening and closing state of a space character, and the second determining unit is specifically configured to:
detecting a non-line feed opening and closing state of the space character;
if the non-line-feed starting and stopping state of the space character is the starting state, replacing the space character in the target text with the non-line-feed space character to obtain a second format text of the target text;
and obtaining a target display format of the target text based on the second format text.
In some embodiments, the localized configuration parameters include a localized on-off state of a text corresponding to each text identifier, and the obtaining unit is specifically configured to:
when text content to be displayed on the game interface exists, detecting a local on-off state of the text content to be displayed;
if the localized on-off state of the text content to be displayed is an on state, acquiring a text associated with the target display language from a preset text table based on the target text identification to serve as the target text;
in some embodiments, the obtaining unit is specifically configured to:
when text content to be displayed on the game interface exists, detecting a local on-off state of the text content to be displayed;
and if the localized on-off state of the text content to be displayed is the off state, acquiring a text associated with the default language of the game interface from a preset text table based on the target text identification to serve as the target text.
In some embodiments, the configuration unit is specifically configured to:
acquiring a text identifier of each text content;
acquiring each language text of each text content;
and writing the text identification of each text content and each language text association of each text content into a preset text table.
In some embodiments, before the target text matching the target display language is acquired from a preset text table based on a target text identifier of the text content to be displayed when there is text content to be displayed on the game interface, the configuration unit is specifically configured to:
acquiring a search path corresponding to each text identifier in the preset text table;
recording the search path corresponding to each text identifier into a preset database;
in some embodiments, the obtaining unit is specifically configured to:
when text content to be displayed on the game interface exists, acquiring a target search path corresponding to the target text identifier from the preset database;
and acquiring a target text matched with the target display language from the preset text table based on the target text identification and the target search path.
In a third aspect, an embodiment of the present application further provides an electronic device, including a memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps of any of the text information localization methods provided by the embodiments of the present application.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, where a plurality of instructions are stored, and the instructions are adapted to be loaded by a processor to perform steps in any one of the text information localization methods provided by the embodiments of the present application.
The method comprises the steps of determining a target display language of a text of a game interface; when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed; determining a target display format of the target text based on localized configuration parameters of text of the game interface; displaying the target text on the game interface according to the target display format; because the display format of the target text can be determined by the localization configuration parameters of the text of the game interface, the content of the text to be displayed can be adapted to different language formats after being switched to different languages, the problem of format switching such as fonts and the like during text localization can be solved to a certain extent, and the problems of disordered and irregular display after the text localization in the game can be avoided to a certain extent.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of an embodiment of a text information localization method provided in an embodiment of the present application;
FIG. 2 is a schematic process diagram of implementing localization based on a localization text component according to this embodiment;
FIG. 3 is a schematic diagram illustrating the configuration of a localization tool provided in an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating font configuration parameters associated with preset languages provided in an embodiment of the present application;
FIG. 5 is a diagram illustrating a property group of the localitionText component provided in the present embodiment;
fig. 6 is a schematic structural diagram of a text information localization apparatus provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application. Meanwhile, in the description of the embodiments of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present application, "a plurality" means two or more unless specifically defined otherwise.
The embodiment of the application provides a text information localization method and device, electronic equipment and a computer readable storage medium.
Specifically, the present embodiment will be described from the perspective of a text information localization apparatus, which may be specifically integrated in an electronic device, that is, the text information localization method in the embodiments of the present application may be executed by an electronic device, which may be a terminal, a server, or the like. The terminal can be a mobile phone, a tablet Computer, an intelligent bluetooth device, a notebook Computer, a touch screen, a game machine, or a Personal Computer (PC), and the like; the server may be a single server or a server cluster composed of a plurality of servers.
For example, the electronic device may be a mobile terminal that may determine a target display language for text of a game interface through a network; when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed; determining a target display format of the target text based on localized configuration parameters of text of the game interface; and displaying the target text on the game interface according to the target display format.
In some embodiments, the text information localization apparatus may also be integrated in a plurality of electronic devices, for example, the text information localization apparatus may be integrated in a plurality of servers, and the text information localization method of the present application is implemented by the plurality of servers. For another example, the text information localization apparatus may be integrated in a plurality of terminals, and the text information localization method of the present application is implemented by the plurality of terminals. Illustratively, the electronic device may specifically be a terminal device for running a game in the embodiment of the present application.
In some embodiments, the text information localization apparatus may also be integrated in a terminal and server cluster.
In some embodiments, the server may also be implemented in the form of a terminal, for example, a personal computer may be configured as the server to integrate the text information localization apparatus, and the server configured by the personal computer is configured to implement the text information localization method of the present application.
The following detailed description is made with reference to the accompanying drawings, respectively. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown in the figures, for example, step 103 and step 104 may be performed simultaneously, or step 103 may be performed first and step 104 may be performed later. As shown in fig. 1, a specific flow of the game data interaction method may include steps 101 to 104, where:
101. a target display language for text of the game interface is determined.
The target display language is a language to be displayed in the game application, for example. There are various ways to determine the target display language in step 101, which exemplarily includes:
(1) and receiving the game language set by the game user in real time as the target display language. Exemplarily, at this time, the step 101 may specifically include: receiving a display setting instruction of a text of a game interface; responding to the display setting instruction, and displaying a setting interface of the text of the game interface; and receiving the display language input or selected by the game user based on the setting interface as the target display language. The display setting instruction is an instruction for requesting to set the language of a text displayed on the game interface; the setting interface is a page for setting a display language of text of the game interface. For example, game player 1 opens a language setting page, i.e., a setting interface that triggers a display setting instruction of a text of the game interface in game application a and displays the text of the game interface in response to the display setting instruction; then, game player 1 can select or input one display language in the setting page as the target display language.
(2) And reading the game language set by the game user in the history, and directly determining the game language set by the game user in the history as the target display language.
The embodiment method is implemented by taking an inheritance component (marked as localization Text component) capable of realizing language localization reconstructed based on the Text component in the Unity3D engine as an example. For convenience of understanding, the principle of localization implemented by the localization Text component in the embodiment is described first, and since the Text component in the Unity3D engine has no localization function, in this embodiment:
firstly, constructing a localization Text component inherited to a Text component; the LocalizationText component is used to implement localization of text in a game interface.
Taking the localized configuration parameter as an example of a target font configuration parameter of a target display language, as shown in fig. 2, fig. 2 is a process diagram for implementing localization based on a localization text component provided in this embodiment, and when there is text content to be displayed in a game interface, language switching is triggered, at this time, on the one hand, a SwitchFont function is called to perform font switching, so as to return the target font configuration parameter of the target display language to the localization text component. On the other hand, the localization text is triggered by calling the OnLocalize function to carry out localization processing. Then, the localization text component calls a GetText function, and obtains a text which is matched with the target display language and has a text identifier of a target text identifier from a preset text table as the target text. And finally, localizing the text content to be displayed by the localization text component based on the target text and the target font configuration parameters, and finally displaying the localized text content to be displayed on the game interface.
The SwitchFont function is a preset function for obtaining target font configuration parameters associated with the target display language from the font table preset body and returning the target font configuration parameters to the localization text component.
The GetText function is a preset function used for obtaining a target text which is matched with the target display language and is associated with the target text identifier from a preset text table and returning the target text to the localization text component.
Secondly, adding a corresponding localization tool to support a localization text component to realize a localization function.
Illustratively, the localization tool supports a localization text component to implement the localization function specifically as follows:
<1> replace the Text component obtained in the UI preset with the LacalizationText component.
<2> the configuration of the font table (i.e. the font configuration parameters associated with each preset language) is output to the font table preset body (denoted as localization option) through the localization tool, and the specific process may refer to the following description (as in step 1031A) and the related description in fig. 4, which is not described herein again.
<3> add a text identifier (TextId) of each text content to the localization text component through the localization tool, and write the text identifier of each text content in association with each language text of each text content to the preset text table. That is, the text information localization method may further include the following steps a 1-a 3, wherein:
a1, obtaining the text identification of each text content.
Referring to table 1, for example, the text identifier of each text content may be added manually by a developer, or may be generated randomly, and the obtaining manner of the text identifier of each text content is not particularly limited. Wherein the text identifications of different text contents are different.
a2, obtaining each language text of each text content.
Referring to table 1, for example, the language text of each text content may be obtained through manual translation by a developer, or may be obtained through translation by jumping to a translation webpage through a related tool.
a3, writing the text identification of each text content and the language text association of each text content into a preset text table.
By writing the text identifier of each text content and each language text of each text content into the preset text table in a correlated manner, when the text content to be displayed on the game interface exists, the target text can be quickly found out from the preset text table, so that the localization speed of the text is improved to a certain extent.
<4> adding a search path corresponding to a localization text component to a text identifier (noted as TextId) of each text content through a localization tool so as to facilitate search and modification of text information related to each text identifier. For the following description, reference may be made to the related introduction of "(2) reading the target search path corresponding to the target text identifier," which is not described herein again for simplicity.
As shown in fig. 3, the configuration of the localization tool may specifically include an Excel configuration, a text table configuration, a UI setting, and a font configuration.
The Excel configuration mainly sets parameters such as an Excel table path, a name and an initial reading position in the table.
Wherein the text table configuration sets parameters such as the starting TextId of the text.
And the UI configuration sets parameters such as a storage path and the like preset by the UI.
The font configuration sets parameters such as font storage position, font configuration preset name, default font and font type.
Adding attributes required for localization to the localization text component, for example, as shown in fig. 5, in this embodiment, a localization attribute group is added, including: translate attribute, TextId attribute, needlewrap attribute, AdaptToChinese attribute.
The Translate attribute is used for setting a local on-off state of the text content to be displayed so as to realize whether the text content in the game interface is translated or not according to the selection of requirements and realize the differentiation requirement of whether the text content in the game interface is translated or not.
The textId attribute is mainly used for a translation index key value of the text, and the localization text component obtains the corresponding text in the preset text table (namely the target text which is associated with the target display language and is associated with the target text identification) through the textId. Therefore, on one hand, the problem that static texts cannot be translated is solved, and on the other hand, the translation of dynamic texts can be realized; and further, the problem of localization of texts in the game can be effectively solved.
The needlewrap attribute is used for setting a line feed starting and closing state of a specific character string so as to process the line feed problem of the text in the translation process, and the line feed starting and closing state of the specific character string is an opening state which indicates that the specific character string in the text is to be changed into a line feed character; the specific character string may be specifically a self-defined character string, and the specific character string may be set correspondingly according to an actual language scene, for example, the specific character string may be a line-feed character, two continuous space characters, "\ n", and the like. The application of the needlewrap attribute may specifically refer to the following description in "2) the localized configuration parameter includes a line feed start/stop state of a specific character string of a text of the game interface, and a target display format is determined based on the line feed start/stop state of the specific character string", and details are not repeated here for simplifying the description.
The AdaptToChinese attribute is used for setting a non-linefeed opening and closing state of a Space character, and because the Space character of Unity3D contains linefeed characters in order to adapt to English texts, the Space of Chinese needs to be changed into a Space character string (Breaking Space) without linefeed. The open state of the space character indicates that the space of Chinese in the text is replaced by a space character string without line feed. For the application of the AdaptToChinese attribute, reference may be specifically made to the following description in "3) the relevant description in which the localization configuration parameter includes a non-line-feed on-off state of a space character of a text of the game interface, and a target display format is determined based on the non-line-feed on-off state of the space character", which is not described herein again for simplicity.
102. And when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on the target text identification of the text content to be displayed.
The text content to be displayed refers to text content to be displayed on the game interface, for example, game rule description content in the game interface, and text content of interaction buttons (such as "yes" and "no") in the game interface.
The text identifier (TextId) is information such as a text ID that can be used to identify the text content, for example, as shown in table 1 below, each text content may correspond to a preset text ID.
TABLE 1
Text ID Text content Chinese simplified form Complex Chinese character English
20000002 Occupation of the world Occupation of the world professional
20000003 Force Force Force power
20000004 Attack of Attack of Tap attack
20000005 Hit in Hit in Hit in hit
The target text identifier refers to a text identifier of the text content to be displayed, for example, as shown in table 1, assuming that the text content to be displayed is "professional", the target text identifier is "20000002".
The preset text table is a data table for associating and recording text identifiers of each text content and each language text corresponding to each text content, and it can be understood that the preset text table is not limited to a commonly understood table form, and the preset text table may be in other expression forms.
The target text refers to a text that matches the target display language and is identified as the target text, for example, as shown in table 1, assuming that the text content to be displayed is "professional" (i.e., the target text is identified as "20000002"), and the target display language is "traditional chinese", the target text is " ".
In step 102, there are various ways to determine the target text, which exemplarily include:
(1) and directly reading the path based on the preset text table. In this case, step 102 may specifically include the following steps 1021A to 1023A, where:
1021A, obtaining the path of the preset text table.
1022A, when text content to be displayed on the game interface exists, querying the preset text table according to the path of the preset text table.
1023A, based on the target text identification, obtaining a target text matched with the target display language from a preset text table.
(2) And reading the target search path corresponding to the target text identifier. In order to facilitate the search and modification of the preset text table, in this embodiment, a corresponding search path is added to each text identifier in the preset text table, that is, before step 102, the method may further include: acquiring a search path corresponding to each text identifier in the preset text table; and recording the search path corresponding to each text identifier into a preset database. At this time, the step 102 of determining the target text may specifically include the following steps 1021B to 1022B, where:
1021B, when the text content to be displayed on the game interface exists, obtaining a target search path corresponding to the target text identification from the preset database.
1022B, based on the target text identification and the target search path, obtaining a target text matched with the target display language from the preset text table.
Therefore, the corresponding search path is added to each text identifier in the preset text table, so that the positioning speed of the target text identifier associated resources can be increased, the search speed of the target text matched with the target display language is increased, and the localization speed of the text in the game interface is increased.
(3) Detecting whether the localization function of the text content to be displayed is closed or not, and if the localization function of the text content to be displayed is closed, directly reading a text which is associated with a default language and has a text identifier as a target text identifier to serve as the target text; otherwise, if the localization function of the text content to be displayed is started, reading the text which is associated with the target display language and has the text identifier as the target text identifier, and taking the text as the target text. In this case, step 102 may specifically include the following steps 1021C to 1023C, where:
1021C, when the text content to be displayed on the game interface exists, detecting the local on-off state of the text content to be displayed.
Illustratively, as shown in table 2, a Translate attribute is correspondingly set for each text identifier, so as to control a localized on-off state of the text corresponding to each text identifier, and thus, a desired text can be selected for translation in a targeted manner.
TABLE 2
Text ID Text content Localized on/off state
20000002 Occupation of the world Is opened
20000003 Force Is opened
20000004 Attack of Is opened
20000005 Hit in Close off
Then, in step 1021C, the localized open-close state of the text content to be displayed can be determined by detecting a Translate attribute associated with the target text identifier in the localization text component.
1022C, if the localized on-off state of the text content to be displayed is an on state, acquiring a text associated with the target display language from a preset text table based on the target text identifier to serve as the target text.
1023C, if the localized on-off state of the text content to be displayed is the off state, acquiring a text associated with the default language of the game interface from a preset text table based on the target text identification to serve as the target text.
Because part of text content in the game interface does not need to be translated and part of text content needs to be translated, the localization on-off state of the text content to be displayed is detected by detecting the Translate attribute associated with the target text identifier in the localization text component; when the localized on-off state of the text content to be displayed is the on state, acquiring a text associated with a target display language as a target text, namely, localizing (translating) the text in the game interface by adopting the target display language; when the localized on-off state of the text content to be displayed is the off state, acquiring a text associated with the default language of the game interface as a target text, namely, not localizing (translating) the text in the game interface; so that the text content in the game interface can be processed in a differentiation mode according to the translation requirement.
103. Determining a target display format of the target text based on localized configuration parameters of text of the game interface.
The localization configuration parameters are parameters for adjusting the display format of the target text, such as font configuration parameters, a line feed on/off state of a specific character string, a non-line feed on/off state of a space character, and the like.
The target display format refers to a display format of the target text, for example, a font format (such as font type, font size, text line spacing, text column spacing, and the like), an arrangement format (such as space, line feed character, and the like) of the target text, and the like.
In step 103, there are various ways to determine the target display format, for example, the target display format may be determined by combining with the target font configuration parameters (such as at least one of font type, font size, text column spacing, text line spacing, etc.) of the target display language, the line feed on/off state of the specific character string, the non-line feed on/off state of the space character, and other localization configuration parameters, and the localization configuration parameters are used as the target font configuration parameters of the target display language, the line feed on/off state of the specific character string of the text of the game interface, and the non-line feed on/off state of the space character of the text of the game interface, respectively, which exemplifies the determination way of the target display format.
1) The localization configuration parameters comprise target font configuration parameters of a target display language, and the target display format is determined based on the target font configuration parameters. Exemplarily, at this time, the step 103 may specifically include the following steps 1031A to 1032A, where:
1031A, determining target font configuration parameters associated with the target display language from font configuration parameters associated with each preset language.
The font configuration parameter is a parameter for adjusting a display format of a font, such as a font type, a font size, a text column interval, a text line interval, and the like.
The target font configuration parameters refer to preset font configuration parameters associated with the target display language.
In step 1031A, there are various ways to determine the target font configuration parameters, which exemplarily include:
the font configuration parameters (referred to as font tables for short as shown in table 3 and fig. 4) associated with each preset language are directly stored in the localization text component, and the target font configuration parameters are directly obtained by querying from the font configuration parameters associated with each preset language stored in the localization text component.
TABLE 3
Language(s) Font type Font size Text column spacing Text line spacing
Chinese character cn_content.ttf 4 0 0.2
Traditional Chinese cn_content.ttf 4 0 0.2
English en_content.ttf 1 0 0
Secondly, in order to facilitate code reading, font configuration parameters (shown in table 3 and fig. 4) associated with each preset language are output to a font table preset body, and target font configuration parameters are obtained through query from the font table preset body. In this case, step 103 may further include the following steps b1 to b 3:
b1, constructing font table presets of localization components based on the game engine text components.
Wherein, the game engine Text component refers to the Text component of the game engine, for example, the Text component in Unity 3D.
The localization component refers to a component that inherits from a game engine text component and can be used for language localization of text in a game interface, for example, the localization text component mentioned above.
b2, obtaining the font configuration parameters associated with each preset language.
Illustratively, the font configuration parameters associated with each preset language can be manually configured by a developer.
b3, outputting the font configuration parameters associated with each preset language to the font table preset body.
Correspondingly, in step 1031A, the localization component may call a preset font switching function to perform font switching, so as to obtain the target font configuration parameters associated with the target display language from the font table preset body.
The font switching function is a preset function used for obtaining target font configuration parameters associated with the target display language from the font table preset body and returning the target font configuration parameters to the localization component.
For example, as shown in fig. 2, taking the localization component as a localization text component and the font switching function as a SwitchFont function as an example, when language switching is triggered, font switching is performed by calling the SwitchFont function, so as to return the target font configuration parameters of the target display language to the localization text component.
Therefore, the font configuration parameters associated with the preset languages are output to the font table preset body, so that the code reading is facilitated, and the localization of the text in the game interface can be effectively completed by the localization component inherited to the game engine text component.
1032A, determining a target display format of the target text based on the target font configuration parameters.
For example, the target font configuration parameter includes at least one of a font size, a font type, a text column spacing and a text line spacing, and the font format of the target text may be adjusted according to the at least one of the font size, the font type, the text column spacing and the text line spacing, so as to obtain the target display format of the target text.
Therefore, the target font configuration parameters associated with the target display language are determined from the font configuration parameters associated with the preset languages; the target display format of the target text is determined based on the target font configuration parameters, so that the problems of format switching such as font types, font sizes, text column intervals, text line intervals and the like during text localization can be solved to a certain extent, and the problems of disordered and irregular display after the text localization in the game are avoided.
Further, in order to distinguish the button text from the normal text in the game interface, different font configuration parameters are also set for the button text and the normal text, at this time, the target font configuration parameters include a first font configuration parameter of the interactive control text and a second font configuration parameter of the non-interactive control text, and step 103 may specifically include: detecting a text type of the target text; if the text type is an interactive control text, adjusting the font format of the target text based on the first font configuration parameter to obtain the target display format of the target text; and if the text type is a non-interactive control text, adjusting the font format of the target text based on the second font configuration parameter to obtain the target display format of the target text.
For example, the button text and the normal text are set to have different font types, at this time, the target font configuration parameter includes a first font type of the interactive control text and a second font type of the non-interactive control text, and step 103 may specifically include: detecting a text type of the target text; if the text type is an interactive control text, adjusting the font format of the target text based on the first font type to obtain the target display format of the target text; and if the text type is a non-interactive control text, adjusting the font format of the target text based on the second font type to obtain the target display format of the target text.
For another example, the button text and the normal text are set to have different font sizes, at this time, the target font configuration parameter includes a first font size of the interactive control text and a second font size of the non-interactive control text, and step 103 may specifically include: detecting a text type of the target text; if the text type is an interactive control text, adjusting the font format of the target text based on the first font size to obtain the target display format of the target text; and if the text type is a non-interactive control text, adjusting the font format of the target text based on the second font size to obtain the target display format of the target text.
By adjusting the difference of the font types or the font sizes of the interactive control text and the non-interactive control text in the game interface, the button text can be distinguished from the common text, and the interactivity after the game interface text is localized is improved.
2) The localization configuration parameters comprise the line feed on-off state of a specific character string of a text of the game interface, and the target display format is determined based on the line feed on-off state of the specific character string.
Because the arrangement of the text in different languages has certain difference, for example, a specific character string can embody line feed in language 1, but cannot embody line feed in language 2, in order to meet the arrangement differentiation requirements of the text in different languages, the line feed on-off state of the specific character string can be set, and when the line feed on-off state of the specific character string is in the on state, the specific character string in the text can be replaced by the line feed character; when the on-off state of the line feed of the specific character string is in the off state, the specific character string in the text is not replaced by the line feed character. Exemplarily, at this time, step 103 may specifically include the following step 1031B to step 1033B, where:
1031B, detecting the on-off state of the line feed of the specific character string.
Illustratively, as shown in fig. 5, a needlewrap attribute is added to the localitiontext component, and in step 1031B, the linefeed opening and closing state of the specific character string may be determined by detecting the needlewrap attribute in the localitiontext component.
For example, as shown in fig. 5, when the needlewrap attribute is selected, it is determined that the line feed start-stop state of the specific character string is an open state; and when the needlewrap attribute is unselected, determining that the line feed on-off state of the specific character string is a closed state.
The needlewrap attribute is used for configuring the line feed start and stop states of the specific character strings.
1032B, if the line feed start-stop state of the specific character string is the start state, replacing the specific character string in the target text with a line feed character to obtain a first format text of the target text.
The first format text is obtained by replacing a specific character string in the target text with a line-feed character.
1033B, obtaining a target display format of the target text based on the first format text.
Illustratively, the layout format of the first format text may be directly used as the target display format of the target text. Alternatively, the target display format of the target text may be determined by combining the layout format of the first format text and the font format of the target text obtained through the adjustment based on the target font configuration parameters in steps 1031A to 1032A.
Therefore, when the line feed starting and stopping state of the specific character string is the starting state, the specific character string in the target text is replaced by the line feed character to obtain a first format text of the target text; obtaining a target display format of the target text based on the first format text; the method can solve the problem of format switching such as line feed of specific character strings and the like during text localization to a certain extent, and avoid the problems of disordered and irregular display after the text localization in the game.
3) The localization configuration parameters comprise a non-line feed opening and closing state of a space character of a text of the game interface, and a target display format is determined based on the non-line feed opening and closing state of the space character.
Because the arrangement of the text between different languages has certain difference, for example, the space character can not show line feed in Chinese, and the space character in Unity3D contains line feed characters in order to adapt to English text, in order to solve the problem, the text arrangement consistency after the text of different languages is switched is met, the non-line feed on-off state of the space character can be set, and when the non-line feed on-off state of the space character is the on state, the space character in the text is replaced by the non-line feed space character; when the non-line feed start-stop state of the space character is the closed state, the space character in the text is not actively replaced by the non-line feed space character (for example, the space character containing the line feed character is kept and replaced). Exemplarily, at this time, step 103 may specifically include the following step 1031C to step 1033C, where:
1031C, detecting the non-line feed opening and closing state of the space character.
The AdaptToChinese attribute is used for configuring the non-line feed opening and closing state of the space character.
Illustratively, as shown in fig. 5, an AdaptToChinese attribute is added to the LocalizationText component, and in step 1031C, the unappttychinese attribute in the LocalizationText component may be detected, so that the non-line-feed on-off state of the space character may be determined.
For example, as shown in fig. 5, when the AdaptToChinese attribute is selected, the non-line feed on-off state of the space character is determined to be an open state; and when the AdaptToChinese attribute is unselected, determining that the non-line feed on-off state of the space character is a closed state.
1032C, if the non-line-feed opening and closing state of the space character is the opening state, replacing the space character in the target text with the non-line-feed space character to obtain a second format text of the target text.
The second format text is obtained by replacing the space characters in the target text with non-linefeed space characters.
1033C, obtaining a target display format of the target text based on the second format text.
Illustratively, the layout format of the second format text may be directly used as the target display format of the target text. Or, the target display format of the target text may be determined by combining the determination of the arrangement format of the first format text and the arrangement format of the second format text in the steps 1031A to 1032A, and the adjustment of the font format of the target text based on the target font configuration parameters in the steps 1031A to 1032A. Or, the target display format of the target text may be determined by combining the layout format of the second format text and the font format of the target text obtained through the adjustment based on the target font configuration parameters in the above steps 1031A to 1032A.
Therefore, when the non-line-feed on-off state of the space characters is an on state, the space characters in the target text are replaced by the non-line-feed space characters, and a second format text of the target text is obtained; obtaining a target display format of the target text based on the second format text; the method can solve the problem of format switching such as whether space characters change lines or not during text localization to a certain extent, and avoid the problems of disordered and irregular display after the text localization in the game.
The above describes the determination method of the target display format by taking the localized configuration parameters as the target font configuration parameters, the line feed on-off state of the specific character string, and the non-line feed on-off state of the space character as examples; it can be understood that the target display format can also be determined by combining two or more of the target font configuration parameters, the line feed start/stop state of the specific character string and the non-line feed start/stop state of the space character, and for simplifying the expression, the details are not repeated one by one here.
104. And displaying the target text on the game interface according to the target display format.
For example, when the font format of the target text is adjusted according to the font size, the font type, the text column spacing and the text line spacing associated with the target display language, the font format of the target text is used as the target display format of the target text; the target text is displayed on the game interface according to the font size, font type, text column spacing, and text line spacing associated with the target display language.
For another example, on one hand, the font format of the target text is adjusted according to the font size, the font type, the text column spacing and the text line spacing associated with the target display language; on the other hand, after replacing the space character in the target text with a non-line-feed space character and replacing the specific character string in the target text with a line-feed character, the target text is displayed on the game interface according to the obtained text format as the target display format.
For convenience of understanding, the process of determining the target display format in step 103 and the process of displaying the target text on the game interface in step 104 are separately described, and it is understood that the above steps 103 and 104 may be actually executed in combination or in sequence.
From the above, in the embodiment, the target display language of the text of the game interface is determined; when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed; determining a target display format of the target text based on localized configuration parameters of text of the game interface; displaying the target text on the game interface according to the target display format; because the display format of the target text can be determined by the localization configuration parameters of the text of the game interface, the content of the text to be displayed can be adapted to different language formats after being switched to different languages, the problem of format switching such as fonts and the like during text localization can be solved to a certain extent, and the problems of disordered and irregular display after the text localization in the game can be avoided to a certain extent.
In order to better implement the method, the embodiment of the present application further provides a text information localization apparatus, which may be specifically integrated in an electronic device, for example, a computer device, and the computer device may be a terminal, a server, or the like.
The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
For example, in this embodiment, the method in the embodiment of the present application will be described in detail by taking an example in which the text information localization apparatus is specifically integrated in a smart phone.
For example, as shown in fig. 6, the text information localization apparatus may include:
a first determination unit 601 configured to determine a target display language of a text of a game interface;
an obtaining unit 602, configured to, when there is text content to be displayed on the game interface, obtain, based on a target text identifier of the text content to be displayed, a target text that matches the target display language from a preset text table;
a second determining unit 603, configured to determine a target display format of the target text based on a localized configuration parameter of a text of the game interface;
a display unit 604, configured to display the target text on the game interface according to the target display format.
In some embodiments, the localization configuration parameters include a target font configuration parameter of the target display language, and the second determining unit 603 is specifically configured to:
determining target font configuration parameters associated with the target display language from font configuration parameters associated with each preset language;
and determining a target display format of the target text based on the target font configuration parameters.
In some embodiments, the target font configuration parameter includes at least one of a font size, a font type, a text column spacing, and a text line spacing associated with the target display language, and the second determining unit 603 is specifically configured to:
and adjusting the font format of the target text according to at least one of the font size, the font type, the text column spacing and the text line spacing associated with the target display language to obtain the target display format of the target text.
In some embodiments, the target font configuration parameter includes at least one of a first font type of the interactive control text and a second font type of the non-interactive control text, and the second determining unit is specifically configured to:
detecting a text type of the target text;
if the text type is an interactive control text, adjusting the font format of the target text based on the first font type to obtain the target display format of the target text;
in some embodiments, the second determining unit 603 is specifically configured to:
detecting a text type of the target text;
and if the text type is a non-interactive control text, adjusting the font format of the target text based on the second font type to obtain the target display format of the target text.
In some embodiments, the text information localization apparatus further includes a configuration unit (not shown in the figure), and before determining the target font configuration parameter associated with the target display language from among the font configuration parameters associated with the preset languages, the configuration unit is specifically configured to:
constructing a font surface preset body of a localization component based on a game engine text component;
acquiring font configuration parameters associated with each preset language;
outputting the font configuration parameters associated with the preset languages to the font table preset body;
in some embodiments, the second determining unit 603 is specifically configured to:
and calling a preset font switching function through the localization component to switch fonts so as to acquire target font configuration parameters associated with the target display language from the font table preset body.
In some embodiments, the localized configuration parameters include a line feed on/off state of a specific character string, and the second determining unit 603 is specifically configured to:
detecting the line feed starting and stopping state of the specific character string;
if the line feed starting and stopping state of the specific character string is the starting state, replacing the specific character string in the target text with a line feed character to obtain a first format text of the target text;
and obtaining a target display format of the target text based on the first format text.
In some embodiments, the localization configuration parameters include a non-line feed start/stop state of a space character, and the second determining unit 603 is specifically configured to:
detecting a non-line feed opening and closing state of the space character;
if the non-line-feed starting and stopping state of the space character is the starting state, replacing the space character in the target text with the non-line-feed space character to obtain a second format text of the target text;
and obtaining a target display format of the target text based on the second format text.
In some embodiments, the localized configuration parameters include a localized on-off state of a text corresponding to each text identifier, and the obtaining unit 602 is specifically configured to:
when text content to be displayed on the game interface exists, detecting a local on-off state of the text content to be displayed;
if the localized on-off state of the text content to be displayed is an on state, acquiring a text associated with the target display language from a preset text table based on the target text identification to serve as the target text;
in some embodiments, the obtaining unit 602 is specifically configured to:
when text content to be displayed on the game interface exists, detecting a local on-off state of the text content to be displayed;
and if the localized on-off state of the text content to be displayed is the off state, acquiring a text associated with the default language of the game interface from a preset text table based on the target text identification to serve as the target text.
In some embodiments, the configuration unit is specifically configured to:
acquiring a text identifier of each text content;
acquiring each language text of each text content;
and writing the text identification of each text content and each language text association of each text content into a preset text table.
In some embodiments, before the target text matching the target display language is acquired from a preset text table based on a target text identifier of the text content to be displayed when there is text content to be displayed on the game interface, the configuration unit is specifically configured to:
acquiring a search path corresponding to each text identifier in the preset text table;
recording the search path corresponding to each text identifier into a preset database;
in some embodiments, the obtaining unit 602 is specifically configured to:
when text content to be displayed on the game interface exists, acquiring a target search path corresponding to the target text identifier from the preset database;
and acquiring a target text matched with the target display language from the preset text table based on the target text identification and the target search path.
As can be seen from the above, the text information localization apparatus of the present embodiment can determine the target display language of the text of the game interface by the first determination unit 601; when there is text content to be displayed on the game interface, the obtaining unit 602 obtains a target text matching the target display language from a preset text table based on a target text identifier of the text content to be displayed; determining, by the second determining unit 603, a target display format of the target text based on the localized configuration parameters of the text of the game interface; the target text is displayed on the game interface by the display unit 604 in the target display format. Therefore, the embodiment of the application can adapt the text content to be displayed to different language formats after being switched to different languages, can solve the problem of format switching such as fonts during text localization to a certain extent, and avoids the problems of disordered and irregular display after the text localization in the game to a certain extent.
Correspondingly, the embodiment of the present application further provides an electronic device, where the electronic device may be a terminal, and the terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like. As shown in fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 700 includes a processor 701 having one or more processing cores, a memory 702 having one or more computer-readable storage media, and a computer program stored on the memory 702 and executable on the processor. The processor 701 is electrically connected to the memory 702. Those skilled in the art will appreciate that the electronic device configurations shown in the figures do not constitute limitations of the electronic device, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The processor 701 is a control center of the electronic device 700, connects various parts of the entire electronic device 700 using various interfaces and lines, and performs various functions of the electronic device 700 and processes data by running or loading software programs and/or modules stored in the memory 702 and calling data stored in the memory 702, thereby performing overall monitoring of the electronic device 700.
In this embodiment, the processor 701 in the electronic device 700 loads instructions corresponding to processes of one or more application programs into the memory 702 according to the following steps, and the processor 701 executes the application program stored in the memory 702, so as to implement various functions:
determining a target display language of a text of a game interface;
when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed;
determining a target display format of the target text based on localized configuration parameters of text of the game interface;
and displaying the target text on the game interface according to the target display format.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 7, the electronic device 700 further includes: a touch display screen 703, a radio frequency circuit 704, an audio circuit 705, an input unit 706, and a power supply 707. The processor 701 is electrically connected to the touch display screen 703, the radio frequency circuit 704, the audio circuit 705, the input unit 706, and the power source 707. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 7 does not constitute a limitation of the electronic device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
The touch display screen 703 may be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 703 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the electronic device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, and the like), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 701, and can receive and execute commands sent by the processor 701. The touch panel may cover the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 701 to determine the type of the touch event, and then the processor 701 provides a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 703 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display screen 703 can also be used as a part of the input unit 706 to implement an input function.
The rf circuit 704 may be configured to transmit and receive rf signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals to and from the network device or other electronic devices.
The audio circuit 705 may be used to provide an audio interface between a user and an electronic device through a speaker, microphone. The audio circuit 705 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 705 and converted into audio data, which is then processed by the output processor 701 and transmitted to, for example, another electronic device via the rf circuit 704, or output to the memory 702 for further processing. The audio circuit 705 may also include an earbud jack to provide communication of peripheral headphones with the electronic device.
The input unit 706 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 707 is used to power the various components of the electronic device 700. Optionally, the power supply 707 may be logically connected to the processor 701 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 707 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown in fig. 7, the electronic device 700 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
As can be seen from the above, the electronic device provided in this embodiment may determine the target display language of the text of the game interface; when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed; determining a target display format of the target text based on localized configuration parameters of text of the game interface; and displaying the target text on the game interface according to the target display format. According to the electronic equipment provided by the embodiment, the display format of the target text can be determined by the localization configuration parameters of the text of the game interface, so that the content of the text to be displayed can be adapted to different language formats after being switched to different languages, the problem of format switching such as fonts during text localization can be solved to a certain extent, and the problems of disordered and irregular display after the text localization in the game can be avoided to a certain extent.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer programs can be loaded by a processor to execute the steps in any of the text information localization methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
determining a target display language of a text of a game interface;
when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed;
determining a target display format of the target text based on localized configuration parameters of text of the game interface;
and displaying the target text on the game interface according to the target display format.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the computer-readable storage medium can execute the steps in any text information localization method provided in the embodiments of the present application, beneficial effects that can be achieved by any text information localization method provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The text information localization method, the text information localization device, the electronic device, and the computer-readable storage medium provided by the embodiments of the present application are described in detail above, and specific examples are applied in the present application to explain the principles and embodiments of the present application, and the description of the above embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (13)

1. A method for localizing textual information, comprising:
determining a target display language of a text of a game interface;
when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identification of the text content to be displayed;
determining a target display format of the target text based on localized configuration parameters of text of the game interface;
and displaying the target text on the game interface according to the target display format.
2. The method of claim 1, wherein the localization configuration parameters include a target font configuration parameter for the target display language, and wherein determining the target display format for the target text based on the localization configuration parameters for the text of the game interface comprises:
determining target font configuration parameters associated with the target display language from font configuration parameters associated with each preset language;
and determining a target display format of the target text based on the target font configuration parameters.
3. The method of claim 2, wherein the target font configuration parameters include at least one of a font size, a font type, a text column spacing, and a text line spacing associated with the target display language, and wherein determining the target display format of the target text based on the target font configuration parameters comprises:
and adjusting the font format of the target text according to at least one of the font size, the font type, the text column spacing and the text line spacing associated with the target display language to obtain the target display format of the target text.
4. The method of claim 2, wherein the target font configuration parameters include at least one of a first font type of interactive control text and a second font type of non-interactive control text, and wherein determining the target display format for the target text based on the localization configuration parameters for the text of the game interface comprises:
detecting a text type of the target text;
if the text type is an interactive control text, adjusting the font format of the target text based on the first font type to obtain the target display format of the target text;
or detecting the text type of the target text;
and if the text type is a non-interactive control text, adjusting the font format of the target text based on the second font type to obtain the target display format of the target text.
5. The method of claim 2, wherein before determining the target font configuration parameter associated with the target display language from the font configuration parameters associated with each predetermined language, the method further comprises:
constructing a font surface preset body of a localization component based on a game engine text component;
acquiring font configuration parameters associated with each preset language;
outputting the font configuration parameters associated with the preset languages to the font table preset body;
determining a target font configuration parameter associated with the target display language from the font configuration parameters associated with each preset language, including:
and calling a preset font switching function through the localization component to switch fonts so as to acquire target font configuration parameters associated with the target display language from the font table preset body.
6. The method of claim 1, wherein the localization configuration parameters include a line feed on/off status of a specific character string, and determining the target display format of the target text based on the localization configuration parameters of the text of the game interface comprises:
detecting the line feed starting and stopping state of the specific character string;
if the line feed starting and closing state of the specific character string is the starting state, replacing the specific character string in the target text with a line feed character to obtain a first format text of the target text;
and obtaining a target display format of the target text based on the first format text.
7. The method of claim 1, wherein the localization configuration parameters include a non-linefeed on/off state of a space character, and the determining the target display format of the target text based on the localization configuration parameters of the text of the game interface comprises:
detecting a non-line feed opening and closing state of the space character;
if the non-line-feed starting and stopping state of the space character is the starting state, replacing the space character in the target text with the non-line-feed space character to obtain a second format text of the target text;
and obtaining a target display format of the target text based on the second format text.
8. The method according to claim 1, wherein the localization configuration parameters include localization on-off states of texts corresponding to respective text identifiers, and when there is text content to be displayed on the game interface, the method includes, based on a target text identifier of the text content to be displayed, acquiring a target text matching the target display language from a preset text table, including:
when text content to be displayed on the game interface exists, detecting a local on-off state of the text content to be displayed;
if the localized on-off state of the text content to be displayed is an on state, acquiring a text associated with the target display language from a preset text table based on the target text identification to serve as the target text;
or when the text content to be displayed on the game interface exists, detecting the local on-off state of the text content to be displayed;
and if the localized on-off state of the text content to be displayed is the off state, acquiring a text associated with the default language of the game interface from a preset text table based on the target text identification to serve as the target text.
9. The method of localization of textual information according to claim 1, further comprising:
acquiring a text identifier of each text content;
acquiring each language text of each text content;
and writing the text identification of each text content and each language text association of each text content into a preset text table.
10. The method for localizing text information according to any one of claims 1 to 9, wherein before acquiring the target text matching the target display language from a preset text table based on the target text identification of the text content to be displayed when there is the text content to be displayed to be presented to the game interface, the method further comprises:
acquiring a search path corresponding to each text identifier in the preset text table;
recording the search path corresponding to each text identifier into a preset database;
when the text content to be displayed on the game interface exists, acquiring a target text matched with the target display language from a preset text table based on a target text identifier of the text content to be displayed, wherein the target text comprises:
when text content to be displayed on the game interface exists, acquiring a target search path corresponding to the target text identifier from the preset database;
and acquiring a target text matched with the target display language from the preset text table based on the target text identification and the target search path.
11. A textual information localization apparatus, comprising:
a first determination unit for determining a target display language of a text of the game interface;
the game interface display device comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a target text matched with a target display language from a preset text table based on a target text identifier of the text content to be displayed when the text content to be displayed on the game interface exists;
the second determining unit is used for determining a target display format of the target text based on the localization configuration parameters of the text of the game interface;
and the display unit is used for displaying the target text on the game interface according to the target display format.
12. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps of the method of localizing textual information according to any of claims 1 to 10.
13. A computer readable storage medium storing instructions adapted to be loaded by a processor to perform the steps of the method of localization of text information according to any of claims 1 to 10.
CN202210492431.9A 2022-05-07 2022-05-07 Text information localization method and device, electronic equipment and storage medium Pending CN114818606A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210492431.9A CN114818606A (en) 2022-05-07 2022-05-07 Text information localization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210492431.9A CN114818606A (en) 2022-05-07 2022-05-07 Text information localization method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114818606A true CN114818606A (en) 2022-07-29

Family

ID=82512077

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210492431.9A Pending CN114818606A (en) 2022-05-07 2022-05-07 Text information localization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114818606A (en)

Similar Documents

Publication Publication Date Title
US8788269B2 (en) Satisfying specified intent(s) based on multimodal request(s)
CN108614655B (en) Split screen display method and device, storage medium and electronic equipment
CN108549519B (en) Split screen processing method and device, storage medium and electronic equipment
CN112114734B (en) Online document display method, device, terminal and storage medium
US20230125288A1 (en) Font adjustment method and apparatus, storage medium, and electronic device
CN107450839A (en) Control method, device, storage medium and mobile terminal based on blank screen gesture
CN112587925A (en) Display method and device of guide information, storage medium and computer equipment
CN106815534A (en) A kind of method for protecting privacy of user, device and mobile terminal
CN114205447B (en) Shortcut setting method and device of electronic equipment, storage medium and electronic equipment
US20230385131A1 (en) Method for Accelerating Application Startup, Electronic Device, and Computer Storage Medium
CN112235629B (en) Barrage shielding method and device, computer equipment and storage medium
CN113741708B (en) Input method and electronic equipment
WO2023045908A1 (en) Information display method and apparatus, glasses, and medium
CN114818606A (en) Text information localization method and device, electronic equipment and storage medium
CN115828845A (en) Multimedia data viewing method, device, medium and equipment
CN112799754B (en) Information processing method, information processing device, storage medium and computer equipment
CN114489858B (en) Application software information setting method and device, terminal equipment and storage medium
CN113836905B (en) Theme extraction method, device, terminal and storage medium
CN108174308B (en) Video playing method, video playing device, storage medium and electronic equipment
CN112783386A (en) Page jump method, device, storage medium and computer equipment
CN114416234B (en) Page switching method and device, computer equipment and storage medium
CN114489445B (en) Screen adjustment method and device, intelligent equipment and storage medium
CN116582585B (en) Message pushing method, device, medium and equipment
CN112783860B (en) Method, device, storage medium and computer equipment for constructing mirror image database
CN114168048A (en) Application message reminding method and device, computer equipment and storage medium

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