CN113918261A - Multi-language adaptation method, device, equipment and storage medium - Google Patents

Multi-language adaptation method, device, equipment and storage medium Download PDF

Info

Publication number
CN113918261A
CN113918261A CN202111217953.XA CN202111217953A CN113918261A CN 113918261 A CN113918261 A CN 113918261A CN 202111217953 A CN202111217953 A CN 202111217953A CN 113918261 A CN113918261 A CN 113918261A
Authority
CN
China
Prior art keywords
text
language type
language
translated
user interface
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
CN202111217953.XA
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202111217953.XA priority Critical patent/CN113918261A/en
Publication of CN113918261A publication Critical patent/CN113918261A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06F9/454Multi-language systems; Localisation; Internationalisation
    • 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

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)
  • User Interface Of Digital Computer (AREA)
  • Machine Translation (AREA)

Abstract

The application provides a multi-language adaptation method, a multi-language adaptation device, a multi-language adaptation equipment and a storage medium. The method comprises the steps of utilizing an exchange HOOK mode to exchange an initial flow into a preset flow before displaying a case on a graphical user interface according to the initial flow of the case in an application program, wherein the preset flow is an adaptation flow of the case, identifying a text of a first language type displayed on the graphical user interface, performing adaptation operation on the text of the first language type to obtain a text of a second language type, and then displaying the text of the second language type on the graphical user interface. According to the technical scheme, the problems that in the prior art, the implementation modes of operations such as completion of language texts are complex, time consumption is long and efficiency is low are solved by replacing the file flow in the application program and adapting to the multi-language file.

Description

Multi-language adaptation method, device, equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for multi-language adaptation.
Background
With the rapid development of mobile terminal technology, more and more applications are installed on the mobile terminal, and the application range is wider and wider. In order to meet the requirements of users in different regions, the application interface generally needs to support multiple languages, so that the interface display of the application is changed according to the used languages in different regions. So-called multi-language adaptation or string internationalization.
In the prior art, a multilingual directory is built in a res (specific) directory of an application installation package, that is, string files with different names are built in the directory (the string file with each name represents a language package), when a brand new language needs to be supplemented, a developer counts character strings of a character string resource file, and the character strings are translated manually by a translator, copied to corresponding language files one by one and displayed by a terminal interface.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: this implementation of completing the language text is cumbersome, time consuming and inefficient.
Disclosure of Invention
The embodiment of the application provides a multilingual adaptation method, device, equipment and storage medium, and aims to solve the problems that in the prior art, the implementation mode for completing a language text for application is complicated, time consumption is long, and efficiency is low.
In a first aspect, an embodiment of the present application provides a multilingual adaptation method, including:
before displaying a document according to an initial flow of the document in an application program on a graphical user interface, exchanging the initial flow into a preset flow by using an exchange HOOK mode, wherein the preset flow is an adaptation flow of the document;
identifying text of a first language type displayed on the graphical user interface;
performing adaptation operation on the text of the first language type to obtain a text of a second language type;
displaying text of the second language type on the graphical user interface.
In a possible design of the first aspect, the performing an adaptation operation on the text in the first language type to obtain the text in the second language type includes:
translating the text of the first language type to obtain the translated text, wherein the translated text comprises a first part of the text of the first language type which is not translated and a second part of the text which is translated into a second language type;
and performing supplementary translation on the first part of the text which is not translated according to the second language type to obtain a translated first part of text, wherein the text of the second language type comprises the translated first part of text and the second part of text.
In another possible design of the first aspect, the performing an adaptation operation on the text in the first language type to obtain the text in the second language type includes:
analyzing the multi-language file corresponding to the text of the first language type to obtain first text content corresponding to the first language type;
according to the first text content, second text content corresponding to the second language type corresponding to the first text content is obtained from a server;
determining a text of the second language type corresponding to the text of the first language type in the second text content;
and storing the second text content into the corresponding relation of the first text content to obtain an updated multi-language file.
In yet another possible design of the first aspect, the performing, according to the second language type, a supplementary translation on the first part of text that is not translated to obtain a translated first part of text includes:
calling a built-in translation tool kit to translate the first part of text to obtain a translated first part of text with a second language type;
alternatively, the first and second electrodes may be,
and calling an application program interface, and sending the first part of text to a preset configuration platform for translation to obtain a translated first part of text with the language type being a second language type.
Optionally, the application program is adapted to multi-language completion of a multi-language scenario, and the graphical user interface includes: a native page;
accordingly, the identifying text in the first language type displayed on the graphical user interface includes:
and carrying out HOOK processing on the native page to obtain the text of the first language type.
Optionally, the application program is adapted to multi-language completion of a multi-language scenario, and the graphical user interface includes: a web page;
accordingly, the identifying text in the first language type displayed on the graphical user interface includes:
performing screenshot processing on the network page to obtain a screenshot page;
and performing Optical Character Recognition (OCR) processing on the screenshot page, and removing picture elements in the screenshot page to obtain the text of the first language type.
Optionally, the application is not adapted to multi-language completion of a multi-language scenario, and the method further includes:
and taking the language type set by the user or the language type configured by the server corresponding to the application program as the second language type.
In a second aspect, an embodiment of the present application provides a multi-language adaptation apparatus, including: the device comprises a processing module and a display module;
the processing module is used for exchanging the initial flow into a preset flow by using an exchange HOOK mode before displaying the case on a graphical user interface according to the initial flow of the case in an application program, wherein the preset flow is an adaptation flow of the case, recognizing a text of a first language type displayed on the graphical user interface, and then performing adaptation operation on the text of the first language type to obtain a text of a second language type;
the display module is configured to display the text in the second language type on the graphical user interface.
In a possible design of the second aspect, the processing module performs an adaptation operation on the text of the first language type to obtain a text of a second language type, and is specifically configured to:
translating the text of the first language type to obtain the translated text, wherein the translated text comprises a first part of the text of the first language type which is not translated and a second part of the text which is translated into a second language type;
and performing supplementary translation on the first part of the text which is not translated according to the second language type to obtain a translated first part of text, wherein the text of the second language type comprises the translated first part of text and the second part of text.
In another possible design of the second aspect, the processing module performs an adaptation operation on the text of the first language type to obtain a text of a second language type, and is specifically configured to:
analyzing the multi-language file corresponding to the text of the first language type to obtain first text content corresponding to the first language type;
according to the first text content, second text content corresponding to the second language type corresponding to the first text content is obtained from a server;
determining a text of the second language type corresponding to the text of the first language type in the second text content;
and storing the second text content into the corresponding relation of the first text content to obtain an updated multi-language file.
In yet another possible design of the second aspect, the processing module performs supplementary translation on the first part of text that is not translated according to the second language type to obtain a translated first part of text, and is specifically configured to:
calling a built-in translation tool kit to translate the first part of text to obtain a translated first part of text with a second language type;
alternatively, the first and second electrodes may be,
and calling an application program interface, and sending the first part of text to a preset configuration platform for translation to obtain a translated first part of text with the language type being a second language type.
Optionally, the application program is adapted to multi-language completion of a multi-language scenario, and the graphical user interface includes: a native page;
correspondingly, the processing module identifies a text of the first language type displayed on the graphical user interface, and is specifically configured to:
and carrying out HOOK processing on the native page to obtain the text of the first language type.
Optionally, the application program is adapted to multi-language completion of a multi-language scenario, and the graphical user interface includes: a web page;
correspondingly, the processing module identifies a text of the first language type displayed on the graphical user interface, and is specifically configured to:
performing screenshot processing on the network page to obtain a screenshot page;
and performing Optical Character Recognition (OCR) processing on the screenshot page, and removing picture elements in the screenshot page to obtain the text of the first language type.
Optionally, the application is not adapted to multi-language completion of a multi-language scenario, and the processing module is further configured to:
and taking the language type set by the user or the language type configured by the server corresponding to the application program as the second language type.
In a third aspect, an embodiment of the present application provides a terminal device, including: a processor, a memory;
the memory stores computer-executable instructions;
the processor executes the computer executable instructions to cause the terminal device to perform the multi-language adaptation method as described in the first aspect and in various possible designs above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored therein computer-executable instructions for implementing the multilingual adaptation method described in the first aspect and various possible designs as described above when executed by a processor.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program that, when executed by a processor, is configured to implement the multilingual adaptation method described in the first aspect above and in various possible designs.
The embodiment of the application provides a multi-language adaptation method, a multi-language adaptation device, a multi-language adaptation equipment and a storage medium. The method comprises the steps of utilizing an exchange HOOK mode to exchange an initial flow into a preset flow before displaying a case on a graphical user interface according to the initial flow of the case in an application program, wherein the preset flow is an adaptation flow of the case, identifying a text of a first language type displayed on the graphical user interface, performing adaptation operation on the text of the first language type to obtain a text of a second language type, and then displaying the text of the second language type on the graphical user interface. According to the technical scheme, the problems that in the prior art, the implementation modes of operations such as completion of language texts are complex, time consumption is long and efficiency is low are solved by replacing the file flow in the application program and adapting to the multi-language file.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic view of an application scenario of a multi-language adaptation method provided in an embodiment of the present application;
FIG. 2 is a flowchart illustrating a multilingual adaptation method according to a first embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a second embodiment of a multilingual adaptation method according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a third embodiment of a multilingual adaptation method according to an embodiment of the present application;
FIG. 5 is a flowchart of a multilingual adaptation method according to an embodiment of the present disclosure;
FIG. 6 is a schematic structural diagram of a multi-language adaptation apparatus provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Before introducing the embodiments of the present application, the background of the present application is explained first:
with the rapid development of mobile terminal technology, more and more applications are installed on the mobile terminal, and the application range is wider and wider. In order to meet the requirements of users in different regions, the application interface generally needs to support multiple languages, so that the interface display of the application is changed according to the used languages in different regions. So-called multi-language adaptation or string internationalization. The prior art is to build a multilingual directory inside the res (specific) directory of the application installation package, i.e. to create string files (multilingual packages) of different names under the directory.
However, the prior art integrates the multi-language package into the installation package of the application, increases the size of the installation package of the application, and needs to upgrade the installation package when refreshing the multi-language package of the application.
In addition, in the development process, a developer needs to count the character strings of the character string resource file and transfer the character strings to a translation group for manual translation. Then, after the translation is finished, manually copying the translated character strings one by one and placing the copied character strings into a folder of a corresponding language. The whole process is more complicated and the workload is larger, so that the whole development process consumes more time and the development efficiency is lower.
In addition, the existing scheme cannot better cover the scenes of newly adding and modifying the multi-language file, and can only solve the problem by updating and upgrading the multi-language package or installing the package, so that the dynamic property is poor.
Based on the above problems in the prior art, fig. 1 is a schematic view of an application scenario of a multi-language adaptation method provided in an embodiment of the present application, so as to solve the above technical problems. As shown in fig. 1, the application scenario diagram includes: a terminal device 11 and a server 12.
The terminal device 11 may be a device with a display function, such as a mobile phone, a computer, a tablet, a television, and the like, and the server may be a device of a server corresponding to an application program running on the terminal device 11, such as a configuration platform.
In a possible implementation, an application program is being opened on the display interface of the terminal device 11, the default language of the application program is english, at this time, the english of the display interface needs to be displayed as chinese, according to a multi-language package in the application program (the multi-language package has a part of english corresponding to chinese, but lacks a part of english corresponding to chinese), at this time, the terminal device 11 sends an identifier of the translation type corresponding to the english text that cannot be translated into chinese to the server 12, and in the server 12, the part of english text is translated, and the result is returned to the terminal device 11, and then displayed on the display interface of the terminal device 11.
It should be understood that the above-described processes and hardware devices are only examples of one possible implementation, and in the following embodiments, the contents provided by the embodiments of the present application will be described in detail.
In order to solve the technical problems, the technical conception process of the inventor is as follows: the inventor finds that, in the prior art, when a certain text is translated, if a multi-language package under an application program does not have a translation text corresponding to the text, the multi-language package needs to be updated, that is, a technician changes a code of the application program again and sends the installation package to a user to download and install the installation package again, and the inventor considers that, when the translation text corresponding to the text does not exist, the part of text and a type needing to be translated can be sent to a third-party device, are directly obtained after being translated and then are loaded on the user device; or other translation software or toolkits of the user equipment can be called to translate, and the result is returned to the application program and displayed, so that the problems of complicated steps and the like caused by the need of updating the application program can be solved, and the translation efficiency is improved.
The technical solution of the present application is described in detail by specific embodiments with a schematic frame structure shown in fig. 1. It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart illustrating a multilingual adaptation method according to a first embodiment of the present application. As shown in fig. 2, the multi-language adaptation method may include the steps of:
and 21, exchanging the initial flow into a preset flow by using an exchange HOOK mode before displaying the file on the graphical user interface according to the initial flow of the file in the application program.
Wherein, the preset flow is an adaptation flow of the file.
In this step, the specific method set for the document in the client corresponding to the application, that is, the initial flow of the document, is intercepted and exchanged to the preset flow in a HOOK manner, that is, the adaptation operation of the multilingual document is performed according to the specific rule, which is described in detail in the following embodiments.
Optionally, the process may be triggered by the user sliding a page up and down on the graphical user interface after opening the application program and before displaying the document, or by the server detecting that the multilingual file in the application program needs to be updated.
Step 22, text in a first language type displayed on the graphical user interface is identified.
In this step, in order to perform adaptation operation on the text on the graphical user interface, the text needs to be identified first, and in the embodiment of the present application, the application program is divided into two possible implementations, and the two possible implementations are processed respectively, where one possible implementation is multi-language completion in which the application program has been adapted to a multi-language scene, and the other possible implementation is multi-language completion in which the application program has not been adapted to a multi-language scene.
In one possible implementation, for multi-language completion where the application has adapted to a multi-language scenario, the graphical user interface includes: native pages and web pages.
The native page is a page which can be displayed by the application program without networking; the web page, i.e. the embedded web page, needs to be web-loaded with the exposed page, e.g. H5 page. Further, the manner in which the text in the first language type is processed for two different pages is different.
A first, graphical user interface comprises: a native page.
And carrying out HOOK processing on the native page to obtain a text of the first language type.
Specifically, since the embodiment of the present application needs to intercept the method for setting the text in the prior art, and change the method into the processing procedure of the present solution, at this time, for the multilingual adaptation of the text type, a method of HOOK can be adopted for processing, so as to obtain the text of the first language type and the language type translated into the text of the first language type, that is, the second language type.
The following is a program code corresponding to a setting method of a certain field, taking an Input Output System (IOS) as an example:
Figure BDA0003311413870000081
Figure BDA0003311413870000091
a second, graphical user interface, comprises: a web page.
Firstly, screenshot processing is carried out on a network page to obtain a screenshot page, secondly, Optical Character Recognition (OCR) processing is carried out on the screenshot page, picture elements in the screenshot page are removed, and a text of a first language type is obtained.
Specifically, for an embedded web page, a method for setting a text which cannot be directly hook in an application program is converted into an xml format file, at this time, a screenshot needs to be performed on the page to obtain a screenshot page, some irrelevant texts exist in the screenshot page, for example, an illustration drawing of the screenshot page contains some texts, the part of the text does not need to be translated, and the irrelevant texts are removed, and the process can be realized through OCR, so that the text of the first language type and the translated language type are obtained.
In another possible implementation, for the multi-language completion that the application program is not adapted to the multi-language scenario, the language type set by the user or the language type configured by the server corresponding to the application program needs to be used as the second language type.
The default language type of the application program can be used as the first language type, and when the first language type is different from the second language type, the text corresponding to the first language type is directly translated by using the following steps.
And step 23, performing adaptation operation on the text of the first language type to obtain the text of the second language type.
In this step, in the graphical user interface, the adapting operation is performed on the text of the first language type, which may be to complete the translated text corresponding to the text of the first language type, or to modify (update) the translated text corresponding to the text of the first language type.
Optionally, there may be the following possible scenarios for this step: firstly, the translation operation is performed on the part of the text of the first language type that is not translated, secondly, the multi-language file (in the application program) corresponding to the text of the first language type is updated, and also the text of the second language type corresponding to the text of the first language type can be updated, which are detailed by the following two embodiments respectively.
And 24, displaying the text of the second language type on the graphical user interface.
In this step, after the text of the second language type is obtained, the adapted text is displayed in a graphical user interface, so that a user can browse an interface provided by the application program or operate the application program.
In one possible implementation, the display of text in the second language type may be performed by a Label, or Button, or other control that can set text, attributedText.
According to the multilingual adaptation method provided by the embodiment of the application, before the language is displayed on the graphical user interface according to the initial flow of the language in the application program, the initial flow is exchanged into the preset flow in a HOOK mode, the preset flow is the adaptation flow of the language, the text of the first language type displayed on the graphical user interface is identified, the adaptation operation is carried out on the text of the first language type, the text of the second language type is obtained, and then the text of the second language type is displayed on the graphical user interface. According to the technical scheme, the problems that in the prior art, the implementation modes of operations such as completion of language texts are complex, time consumption is long and efficiency is low are solved by replacing the file flow in the application program and adapting to the multi-language file.
On the basis of the above embodiments, fig. 3 is a flowchart illustrating a second embodiment of the multilingual adaptation method according to the present embodiment. As shown in fig. 3, the step 23 can be implemented by:
and step 31, translating the text of the first language type to obtain a translated text.
The translated text comprises a first part of text of the first language type which is not translated and a second part of text which is translated into the second language type.
In the scheme, when the application program runs on the terminal equipment, a picture provided by the application program is displayed on a graphical user interface of the terminal equipment. According to different requirements of users, the language type of the text displayed in the screen can be adjusted correspondingly, for example, the text supported by an application program is Chinese by default, and at this time, the Chinese text needs to be translated into English text and displayed on the interface.
In this step, the text of the first language type is displayed in the graphical user interface provided by the application program, and at this time, the text of the first language type needs to be translated.
The first language type may be a language type set by a user or a language type issued by a server, and the first language type may be a language type of a multi-language file retrieved by determining whether the multi-language mode is set in the application program.
In one possible design, the application may translate text in the first language type by invoking a local multilingual file in response to a user clicking a translation button on the graphical user interface and then converting the text in the first language type to the language type as needed.
It is to be understood that when the first language type and the language type to be converted (the second language type described below) are identical, the following processing procedure is not necessary.
The translated text comprises a first part of text of the first language type which is not translated and a second part of text which is translated into the second language type.
That is, since all the second partial text of the second language type corresponding to the text of the first language type is not included in the multi-language file, during the translation process, a portion that has been successfully translated or a portion that has not been successfully translated, that is, the first partial text and the second partial text, appear.
Optionally, some applications do not adapt to the multi-language completion function of the multi-language scenario, and at this time, the text of the first language type cannot be translated, that is, only the first part of text exists.
And 32, performing supplementary translation on the first part of the text which is not translated according to the second language type to obtain the translated first part of the text.
Wherein the text of the second language type includes the translated first portion of text and the second portion of text.
In this step, in the graphical user interface, there is an untranslated text, which is called a first part of text, and at this time, the part of text needs to be translated, and the following two ways are provided as examples in this embodiment of the present application:
and firstly, calling a built-in translation tool package to translate the first part of text to obtain the translated first part of text with the language type being the second language type.
The translation toolkit may be Software Development Kit (SDK), which may be in a terminal device, for example, IOS, and may be google translation Software, that is, after a first part of text is translated by the google translation Software, the translated first part of text is obtained.
And secondly, calling an application program interface, and sending the first part of text to a preset configuration platform for translation to obtain the translated first part of text with the language type of the second language type.
The configuration platform is used for self-defining the texts for technicians and storing the texts corresponding to the first language type and the second language type after the texts are translated. The translated first part of text may be directly obtained from the configuration platform by calling an Application Programming Interface (API).
The multilingual adaptation method provided by the embodiment of the application translates the text of the first language type to obtain the translated text, and performs supplementary translation on the first part of the text which is not translated according to the second language type to obtain the translated first part of the text. According to the technical scheme, the application program interface or the built-in translation tool package is called for translation from the untranslated text, so that the operation that the text can be adapted without updating the application program package is realized, and the process is convenient.
On the basis of the above embodiments, fig. 4 is a flowchart illustrating a third embodiment of a multilingual adaptation method provided in the present application. As shown in fig. 4, the step 23 can be implemented by:
and step 41, analyzing the multi-language file corresponding to the text of the first language type to obtain the first text content corresponding to the first language type.
In this scheme, when a multi-language file in an application needs to be updated, that is, when a string file (for example, IOS) with a different name in the res (specific) directory of an installation package of the application is updated, for example, the following operations are performed, such as correcting and expanding an english translation of a certain chinese vocabulary, and adding a multi-language type.
From the perspective of the prior art, even if the english translation of a single chinese vocabulary is updated, all resources need to be downloaded, that is, the entire installation package needs to be updated, whereas the embodiment of the present application performs the update processing only on the resources that need to be updated (for example, the translation update of a certain language of a certain word).
In this step, a multilingual file built in an application is first obtained, that is, a string file is obtained, all texts contained in the file are read, and the parsing is performed according to a certain format.
In one possible implementation, the format may be a key-value correspondence, such as "hello" in Chinese-English, which is obtained and stored to a certain path or a specific location.
And 42, acquiring second text content corresponding to the second language type corresponding to the first text content from the server according to the first text content.
In this step, the service side may be a service side of a manufacturer corresponding to the application program, or a service side for text translation. The second text content corresponding to the second language type corresponding to the first text content is configured in the server, and may be a text content added or updated by a technician in real time.
In one possible implementation, the "hello" (chinese-english) service may add "hello" (first content) to be "hi" (english), or "3-arg" у й "(other languages), and obtain" hello "corresponding" hi "or" 3-arg.
And 43, determining the text of the second language type corresponding to the text of the first language type in the second text content.
In this step, the text of the second language type corresponding to the text of the first language type is in the second text content, and the text of the second language type shown in the graphical user interface, that is, the updated text to be completed.
Alternatively, the process of this embodiment may be an overall update of the content of the multi-language type text in the multi-language file, or an update of the second language type text presented in the graphical user interface.
And step 44, storing the second text content into the corresponding relation of the first text content to obtain the updated multi-language file.
In the step, the modified key-value corresponding relation is stored in the corresponding string file, and writing is performed through the key, that is, the updated text content is stored in the multi-language file.
Furthermore, the updated application program includes second text content corresponding to the first text content, and the second text content can be displayed on a corresponding graphical user interface when the application program is subsequently run.
The multilingual adaptation method provided by the embodiment of the application obtains first text content corresponding to a first language type by analyzing a multilingual file corresponding to a text of the first language type, obtains second text content corresponding to a second language type corresponding to the first text content from a server according to the first text content, then determines a text of the second language type corresponding to the text of the first language type in the second text content, and finally stores the second text content in a corresponding relation of the first text content to obtain an updated multilingual file. According to the technical scheme, the required text content is obtained from the server, the problem that in the prior art, when multiple languages are updated, the application program needs to be downloaded again, so that the process is complicated is solved, and a foundation is provided for displaying different text translation results on a graphical user interface of the application program in the follow-up process.
Based on the above embodiments, fig. 5 is a general flowchart of a multilingual adaptation method provided in the embodiments of the present application. As shown in fig. 5, the schematic diagram includes the following steps:
step 1, starting;
step 2, starting an application program;
after the application program is started, two execution flows can be provided, namely completion and updating of multiple voice types of the text, and specifically, the updating is started in the step 3; completion of the text begins at step 7.
Step 3, analyzing the multi-language file;
step 4, acquiring all first text contents (first language type) -second text contents (second language type) in the multi-language file;
step 5, pulling the first text content (first language type) -the second text content (second language type) to be updated, and updating;
step 6, packaging the updated first text content (first language type) -second text content (second language type) into a multi-language file, and executing step 19;
step 7, judging whether the application program is matched with multi-language completion of the multi-language scene or not, if so, executing step 8; if not, executing the step 11;
step 8, taking the default language of the application program as a first language type;
step 9, taking the language type set by the user in the application program or issued by the server as a first language type;
step 10, calling API or SDK to obtain translation text, and executing step 18;
step 11, judging whether the graphical user interface of the application program in operation is a native page, if so, executing step 12; if not, executing the step 14;
step 12, determining a first language type;
step 13, obtaining a text of a first language type in an exchange mode, and executing step 17;
step 14, determining a first language type;
step 15, carrying out screenshot processing on the network page to obtain a screenshot page;
step 16, performing OCR recognition on the screenshot page, and determining a text of a first language type;
step 17, determining a text to be completed and a corresponding language type, and executing step 10;
step 18, displaying in a graphical user interface;
and step 19, ending.
The multilingual adaptation method provided by the embodiment of the application determines the default language type and the language type which needs to be changed of the application program, correspondingly processes two scenes, namely multilingual completion of the application program adapted to a multilingual scene and multilingual completion of the application program not adapted to the multilingual scene, determines the text which needs to be completed or supplemented, realizes efficient translation and display of the text on a graphical user interface, and obtains the language which needs to be updated from an application server by analyzing the multilingual package which needs to be updated, thereby reducing complicated steps in the updating process and avoiding inconvenience caused by a long development period in the prior art.
Based on the above method embodiments, fig. 6 is a schematic structural diagram of a multi-language adaptation apparatus provided in the embodiments of the present application. As shown in fig. 6, the multi-language adaptation apparatus includes: a processing module 61 and a display module 62;
the processing module 61 is configured to, before displaying the case on the graphical user interface according to the initial flow of the case in the application program, exchange the initial flow into a preset flow by using an exchange HOOK manner, where the preset flow is an adaptation flow of the case, identify a text of a first language type displayed on the graphical user interface, and then perform an adaptation operation on the text of the first language type to obtain a text of a second language type;
a display module 62 for displaying text of the second language type on the graphical user interface.
In one possible design of the embodiment of the present application, the processing module 61 performs an adaptation operation on the text in the first language type to obtain the text in the second language type, and is specifically configured to:
translating the text of the first language type to obtain a translated text, wherein the translated text comprises a first part of the text of the first language type which is not translated and a second part of the text which is translated into a second language type;
and performing supplementary translation on the first part of the text which is not translated according to the second language type to obtain the translated first part of the text, wherein the text of the second language type comprises the translated first part of the text and the translated second part of the text.
In another possible design of the embodiment of the present application, the processing module 61 performs an adaptation operation on the text in the first language type to obtain the text in the second language type, and is specifically configured to:
analyzing a multi-language file corresponding to the text of the first language type to obtain first text content corresponding to the first language type;
according to the first text content, second text content corresponding to a second language type corresponding to the first text content is obtained from the server;
determining a text of a second language type corresponding to the text of the first language type in the second text content;
and storing the second text content into the corresponding relation of the first text content to obtain the updated multi-language file.
In another possible design of the embodiment of the present application, the processing module 61, according to the second language type, performs supplementary translation on the first part of text that is not translated, to obtain a translated first part of text, and is specifically configured to:
calling a built-in translation tool kit to translate the first part of text to obtain a translated first part of text with a second language type;
alternatively, the first and second electrodes may be,
and calling an application program interface, and sending the first part of text to a preset configuration platform for translation to obtain the translated first part of text with the language type being the second language type.
Optionally, the application program is adapted to multi-language completion of the multi-language scenario, and the graphical user interface includes: a native page;
correspondingly, the processing module 61 identifies the text of the first language type displayed on the graphical user interface, and is specifically configured to:
and carrying out HOOK processing on the native page to obtain a text of the first language type.
Optionally, the application program is adapted to multi-language completion of the multi-language scenario, and the graphical user interface includes: a web page;
correspondingly, the processing module 61 identifies the text of the first language type displayed on the graphical user interface, and is specifically configured to:
screenshot processing is carried out on the network page to obtain a screenshot page;
and performing Optical Character Recognition (OCR) processing on the screenshot page, and removing picture elements in the screenshot page to obtain a text of the first language type.
Optionally, the application is not adapted to the multi-language completion of the multi-language scenario, and the processing module 61 is further configured to:
and taking the language type set by the user or the language type configured by the server corresponding to the application program as a second language type.
The multi-language adaptation device provided in the embodiment of the present application can be used to execute the technical solutions corresponding to the multi-language adaptation methods in the embodiments described above, and the implementation principles and technical effects are similar, which are not described herein again.
It should be noted that the division of the modules of the multi-language adaptation device is only a logical division, and the actual implementation may be wholly or partially integrated into a physical entity, or may be physically separated. And these modules can be realized in the form of software called by processing element; or may be implemented entirely in hardware; and part of the modules can be realized in the form of calling software by the processing element, and part of the modules can be realized in the form of hardware. In addition, all or part of the modules can be integrated together or can be independently realized. The processing element described herein may be an integrated circuit having signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 7, the terminal device may include: a processor 70, a memory 71, and computer program instructions stored on the memory 71 and operable on the processor 70.
Optionally, the terminal device may further include: a display 72.
The processor 70 executes computer-executable instructions stored by the memory 71, causing the processor 70 to perform the aspects of the embodiments described above. The processor 70 may be a general-purpose processor including a central processing unit CPU, a Network Processor (NP), and the like; but also a digital signal processor DSP, an application specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
A memory 71 and a display 72 are coupled to the processor 70 via the system bus and are in communication with each other, the memory 71 being used to store computer program instructions.
The display 72 is used for displaying a graphical user interface, and in terms of hardware implementation, the display module 62 in the embodiment shown in fig. 6 corresponds to the display 72 in the present embodiment, wherein the display 72 is used for displaying the processing result of the processor 70 and interacting with a human machine.
The system bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The system bus may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The terminal device provided in the embodiment of the present application may be configured to execute the technical solution corresponding to the multi-language adaptation method in the above embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
The embodiment of the application also provides a chip for running the instructions, and the chip is used for executing the technical scheme of the multi-language adaptation method in the embodiment.
The embodiment of the present application further provides a computer-readable storage medium, where a computer instruction is stored in the computer-readable storage medium, and when the computer instruction runs on a terminal device, the terminal device is enabled to execute the technical solution of the multilingual adaptation method in the foregoing embodiment.
The embodiment of the present application further provides a computer program product, which includes a computer program, and the computer program is used for executing the technical solution of the multilingual adaptation method in the above embodiment when executed by a processor.
The computer-readable storage medium described above may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. Readable storage media can be any available media that can be accessed by a general purpose or special purpose terminal device.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (17)

1. A multi-language adaptation method, comprising:
before displaying a document according to an initial flow of the document in an application program on a graphical user interface, exchanging the initial flow into a preset flow by using an exchange HOOK mode, wherein the preset flow is an adaptation flow of the document;
identifying text of a first language type displayed on the graphical user interface;
performing adaptation operation on the text of the first language type to obtain a text of a second language type;
displaying text of the second language type on the graphical user interface.
2. The method according to claim 1, wherein said adapting the text of the first language type to obtain the text of the second language type comprises:
translating the text of the first language type to obtain the translated text, wherein the translated text comprises a first part of the text of the first language type which is not translated and a second part of the text which is translated into a second language type;
and performing supplementary translation on the first part of the text which is not translated according to the second language type to obtain a translated first part of text, wherein the text of the second language type comprises the translated first part of text and the second part of text.
3. The method according to claim 1, wherein said adapting the text of the first language type to obtain the text of the second language type comprises:
analyzing the multi-language file corresponding to the text of the first language type to obtain first text content corresponding to the first language type;
according to the first text content, second text content corresponding to the second language type corresponding to the first text content is obtained from a server;
determining a text of the second language type corresponding to the text of the first language type in the second text content;
and storing the second text content into the corresponding relation of the first text content to obtain an updated multi-language file.
4. The method of claim 2, wherein the performing a supplementary translation on the first part of text that is not translated according to the second language type to obtain a translated first part of text comprises:
calling a built-in translation tool kit to translate the first part of text to obtain a translated first part of text with a second language type;
alternatively, the first and second electrodes may be,
and calling an application program interface, and sending the first part of text to a preset configuration platform for translation to obtain a translated first part of text with the language type being a second language type.
5. The method of any of claims 1-4, wherein the application has adapted multilingual completion for a multilingual scene, and wherein the graphical user interface comprises: a native page;
accordingly, the identifying text in the first language type displayed on the graphical user interface includes:
and carrying out HOOK processing on the native page to obtain the text of the first language type.
6. The method of any of claims 1-4, wherein the application has adapted multilingual completion for a multilingual scene, and wherein the graphical user interface comprises: a web page;
accordingly, the identifying text in the first language type displayed on the graphical user interface includes:
performing screenshot processing on the network page to obtain a screenshot page;
and performing Optical Character Recognition (OCR) processing on the screenshot page, and removing picture elements in the screenshot page to obtain the text of the first language type.
7. The method of claim 4, wherein the application is not adapted to multi-language completion of multi-language scenarios, the method further comprising:
and taking the language type set by the user or the language type configured by the server corresponding to the application program as the second language type.
8. A multi-language adaptation apparatus, comprising: the device comprises a processing module and a display module;
the processing module is used for exchanging the initial flow into a preset flow by using an exchange HOOK mode before displaying the case on a graphical user interface according to the initial flow of the case in an application program, wherein the preset flow is an adaptation flow of the case, recognizing a text of a first language type displayed on the graphical user interface, and then performing adaptation operation on the text of the first language type to obtain a text of a second language type;
the display module is configured to display the text in the second language type on the graphical user interface.
9. The apparatus according to claim 8, wherein the processing module performs an adaptation operation on the text of the first language type to obtain a text of a second language type, and is specifically configured to:
translating the text of the first language type to obtain the translated text, wherein the translated text comprises a first part of the text of the first language type which is not translated and a second part of the text which is translated into a second language type;
and performing supplementary translation on the first part of the text which is not translated according to the second language type to obtain a translated first part of text, wherein the text of the second language type comprises the translated first part of text and the second part of text.
10. The apparatus according to claim 8, wherein the processing module performs an adaptation operation on the text of the first language type to obtain a text of a second language type, and is specifically configured to:
analyzing the multi-language file corresponding to the text of the first language type to obtain first text content corresponding to the first language type;
according to the first text content, second text content corresponding to the second language type corresponding to the first text content is obtained from a server;
determining a text of the second language type corresponding to the text of the first language type in the second text content;
and storing the second text content into the corresponding relation of the first text content to obtain an updated multi-language file.
11. The apparatus according to claim 9, wherein the processing module performs, according to the second language type, a supplementary translation on the first part of text that is not translated to obtain a translated first part of text, and is specifically configured to:
calling a built-in translation tool kit to translate the first part of text to obtain a translated first part of text with a second language type;
alternatively, the first and second electrodes may be,
and calling an application program interface, and sending the first part of text to a preset configuration platform for translation to obtain a translated first part of text with the language type being a second language type.
12. The apparatus according to any of claims 8-11, wherein said application has adapted multilingual completion of a multilingual scene, and wherein said graphical user interface comprises: a native page;
correspondingly, the processing module identifies a text of the first language type displayed on the graphical user interface, and is specifically configured to:
and carrying out HOOK processing on the native page to obtain the text of the first language type.
13. The apparatus according to any of claims 8-11, wherein said application has adapted multilingual completion of a multilingual scene, and wherein said graphical user interface comprises: a web page;
correspondingly, the processing module identifies a text of the first language type displayed on the graphical user interface, and is specifically configured to:
performing screenshot processing on the network page to obtain a screenshot page;
and performing Optical Character Recognition (OCR) processing on the screenshot page, and removing picture elements in the screenshot page to obtain the text of the first language type.
14. The apparatus of claim 11, wherein the application is not adapted for multi-language completion of multi-language scenarios, and wherein the processing module is further configured to:
and taking the language type set by the user or the language type configured by the server corresponding to the application program as the second language type.
15. A terminal device, comprising: processor, memory and computer program instructions stored on the memory and executable on the processor, characterized in that the processor implements the multilingual adaptation method of any of the preceding claims 1-7 when executing the computer program instructions.
16. A computer-readable storage medium having computer-executable instructions stored thereon for performing the multilingual adaptation method of any of the preceding claims 1-7 when executed by a processor.
17. A computer program product comprising a computer program for implementing a multilingual adaptation method according to any one of claims 1 to 7 when executed by a processor.
CN202111217953.XA 2021-10-19 2021-10-19 Multi-language adaptation method, device, equipment and storage medium Pending CN113918261A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111217953.XA CN113918261A (en) 2021-10-19 2021-10-19 Multi-language adaptation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111217953.XA CN113918261A (en) 2021-10-19 2021-10-19 Multi-language adaptation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113918261A true CN113918261A (en) 2022-01-11

Family

ID=79241551

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111217953.XA Pending CN113918261A (en) 2021-10-19 2021-10-19 Multi-language adaptation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113918261A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108319592A (en) * 2018-02-08 2018-07-24 广东小天才科技有限公司 Translation method and device and intelligent terminal
CN109002320A (en) * 2018-08-20 2018-12-14 苏州思必驰信息科技有限公司 For the update method of software development kit, system, electronic equipment and storage medium
CN111427641A (en) * 2020-02-27 2020-07-17 深圳壹账通智能科技有限公司 Multi-language adaptation method, device, system, computer equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108319592A (en) * 2018-02-08 2018-07-24 广东小天才科技有限公司 Translation method and device and intelligent terminal
CN109002320A (en) * 2018-08-20 2018-12-14 苏州思必驰信息科技有限公司 For the update method of software development kit, system, electronic equipment and storage medium
CN111427641A (en) * 2020-02-27 2020-07-17 深圳壹账通智能科技有限公司 Multi-language adaptation method, device, system, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2020173128A1 (en) Method and device for generating software development kit, and terminal device
WO2018077085A1 (en) Application processing method, device and storage medium
US7539854B2 (en) System and method to seamlessly enable enhanced management and scripting of a computer system and its add-in devices
US20170031574A1 (en) Supporting webpage design and revision irrespective of webpage framework
CN110955428A (en) Page display method and device, electronic equipment and medium
CN110321177B (en) Mobile application localized loading method and device and electronic equipment
CN106909441B (en) Disk direct I/O access method based on JVM
CN111158687B (en) Interface generation method and device of JAVA plugin, computer equipment and storage medium
CN112905179A (en) Mobile terminal H5 page generation method and device, electronic equipment and storage medium
WO2019042349A1 (en) Translation method, mobile terminal and storage device of operating system framework
CN112925718B (en) Call stack backtracking method, device, equipment and medium
CN112528619A (en) Page template file generation method and device, electronic equipment and storage medium
US10387124B2 (en) System and method for creating domain specific language
US10310863B1 (en) Patching functions in use on a running computer system
CN114995859A (en) Page hot updating method, device, equipment and storage medium
CN112052000A (en) Component multiplexing and rendering method and device
CN112169326B (en) Picture processing method, device, electronic equipment and storage medium
CN115543440A (en) Method for migrating android project to android-like system, electronic equipment and storage medium
CN113918261A (en) Multi-language adaptation method, device, equipment and storage medium
CN113641594B (en) Cross-terminal automatic testing method and related device
WO2022099913A1 (en) Interface configuration method and apparatus, and device and medium
CN111857782B (en) Interface updating method and device, computer equipment and storage medium
Lyu et al. A procedure-based dynamic software update
CN111443979B (en) Document processing method, device, computer equipment and storage medium
KR20080027293A (en) Managing multiple languages in a data language

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