A translation method and device of an application program
Patent Information
- Application Number
- CN202111130160.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-26
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2041-09-26
AI Technical Summary
[0004]有鉴于此,本公开实施例提供了一种应用程序的翻译方法及装置,用于解决翻译后的应用程序中的时间信息的展示格式可能会不正确的问题
[0039]本公开实施例提供的应用程序的翻译方法在对应用程序进行翻译时,先检测待翻译应用程序中的时间信息,并获取所述时间信息的属性信息,然后再根据所述属性信息确定所述时间信息的展示格式,以及基于所述展示格式对所述时间信息进行翻译。由于本发明实施例提供的应用程序的翻译方法可以根据待翻译应用程序中的时间信息的属性信息获取时间信息的展示格式,因此本发明实施例在翻译应用程序中的时间信息时,可以使用指定的格式对应用程序中的时间信息进行翻译,避免人工确定时间信息的展示格式可能带来的错误,因此本发明实施例可以解决翻译后的应用程序中的时间信息的展示格式不正确的问题。
Smart Images

Figure CN115879479B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of information processing technology, and in particular to a method and apparatus for translating application programs. Background Technology
[0002] With increasing globalization, it's becoming more common for a single application (APP) to serve users in multiple languages. To better serve users, the content within an application often needs to be translated into multiple languages.
[0003] Time information is ubiquitous in applications. When an application needs to be translated into a target language, its time information must also be displayed according to the target language's display rules. In existing technology, during application translation, the time information is treated as text, and the format of the translated time information is set by the developers based on their understanding of the target language's time information display rules. However, the display rules for time information, such as the required time units, the order of these units, and whether plural forms are needed, vary across different language environments. Manually determining the display format of the translated time information can easily lead to incorrect formatting due to confusion or misremembering the display rules in different language environments. Summary of the Invention
[0004] In view of this, the present disclosure provides a method and apparatus for translating an application, which addresses the problem that the display format of time information in the translated application may be incorrect.
[0005] To achieve the above objectives, the present disclosure provides the following technical solutions:
[0006] In a first aspect, embodiments of this disclosure provide a method for translating an application, comprising:
[0007] Detect time information in the application to be translated;
[0008] Obtain attribute information of the time information, the attribute information including at least one of the target language for translation of the time information, the time unit contained in the time information, and the number of data bits for each time unit of the time information;
[0009] The display format is obtained based on the attribute information;
[0010] The time information is translated based on the display format.
[0011] As an optional implementation of this disclosure, determining the display format based on the attribute information includes:
[0012] Obtain the format identifier based on the attribute information;
[0013] The display format is determined based on the format identifier and the configuration file, wherein the configuration file includes the correspondence between the format identifier and the display format.
[0014] As an optional implementation of this disclosure, obtaining the format identifier based on the attribute information includes:
[0015] The attribute information is calculated based on a preset algorithm to obtain the target calculated value;
[0016] The format identifier is obtained based on the target calculated value.
[0017] As an optional implementation of this disclosure, the preset algorithm is either the MD5 message digest algorithm or a hash algorithm.
[0018] As an optional implementation of this disclosure, the detection of time information in the application to be translated includes:
[0019] Regular expression matching is performed on the strings in the application to be translated, and the strings in the application to be translated that match the target regular expression are identified as the time information in the application to be translated.
[0020] As an optional implementation of this disclosure, before performing regular expression matching on the strings in the application to be translated, the method further includes:
[0021] The target regular expression is obtained based on the current language of the application to be translated.
[0022] As an optional implementation of this disclosure, the translation of the time information based on the display format includes:
[0023] Based on the display format settings, at least one of the following is considered: the time units contained in the translated time information, the order of the time units in the translated time information, the number of digits in each time unit in the translated time information, and whether each time unit in the translated time information uses a plural number.
[0024] Secondly, embodiments of this disclosure provide an application translation device, comprising:
[0025] The detection unit is used to detect time information in the application to be translated;
[0026] The acquisition unit is used to acquire attribute information of the time information, the attribute information including at least one of the target language for translation of the time information, the time unit contained in the time information, and the number of data bits of each time unit of the time information;
[0027] The processing unit is used to determine the display format based on the attribute information;
[0028] A translation unit is used to translate the time information based on the display format.
[0029] As an optional implementation of this disclosure, the processing unit is specifically used to obtain a format identifier based on the attribute information; and to determine the display format based on the format identifier and the configuration file.
[0030] The configuration file includes the correspondence between the format identifier and the display format.
[0031] As an optional implementation of this disclosure, the processing unit is specifically used to calculate the attribute information based on a preset algorithm, obtain a target calculated value, and obtain the format identifier based on the target calculated value.
[0032] As an optional implementation of this disclosure, the preset algorithm is either the MD5 message digest algorithm or a hash algorithm.
[0033] As an optional implementation of this disclosure, the detection unit is specifically used to perform regular expression matching on the strings in the application to be translated, and to determine the strings in the application to be translated that match the target regular expression as the time information in the application to be translated.
[0034] As an optional implementation of this disclosure, the detection unit is further configured to obtain the target regular expression based on the current language of the application to be translated before performing regular expression matching on the strings in the application to be translated.
[0035] As an optional implementation of this disclosure, the translation unit is specifically configured to set at least one of the following based on the display format: the time units contained in the translated time information, the order of the time units in the translated time information, the number of digits in each time unit in the translated time information, and whether each time unit in the translated time information uses a plural number.
[0036] Thirdly, embodiments of this disclosure provide an electronic device, including: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to cause the electronic device to implement the application translation method described in any of the above embodiments when the computer program is invoked.
[0037] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing a computer program that, when executed by a computing device, causes the computing device to implement the application translation method described in any of the above embodiments.
[0038] Fifthly, embodiments of this disclosure provide a computer program product that, when run on a computer, enables the computer to implement the translation method of the application program described in any of the above embodiments.
[0039] The application translation method provided in this disclosure first detects time information in the application to be translated and obtains attribute information of the time information. Then, it determines the display format of the time information based on the attribute information and translates the time information based on the display format. Since the application translation method provided in this embodiment can obtain the display format of the time information based on the attribute information of the time information in the application to be translated, this embodiment can use a specified format to translate the time information in the application, avoiding errors that may occur from manually determining the display format of the time information. Therefore, this embodiment can solve the problem of incorrect display format of time information in the translated application. Attached Figure Description
[0040] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0041] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 One of the flowcharts of the translation method for the application provided in this embodiment of the disclosure;
[0043] Figure 2 One of the flowcharts of the translation method for the application provided in this embodiment of the disclosure;
[0044] Figure 3 A schematic diagram of the structure of the translation device for the application provided in this embodiment of the disclosure;
[0045] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0046] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0047] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0048] In this disclosure, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this disclosure should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Furthermore, in the description of the embodiments in this disclosure, unless otherwise stated, "a plurality of" means two or more.
[0049] The term "at least one of..." in the specification and claims of this disclosure means that it includes any one or more of the listed items. For example, "at least one of A, B, and C" can be: 1. including only A; 2. including only B; 3. including only C; 4. including A and B; 5. including A and C; 6. including B and C; 7. including A, B, and C.
[0050] The execution entity of the application translation method provided in this embodiment of the invention can be an application translation device. The application translation device can be a laptop computer, personal computer (PC), ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), or other types of devices; this embodiment of the invention does not limit the types of devices.
[0051] Based on the above, this disclosure provides a method for translating an application program, referring to... Figure 1 As shown, the translation method of this application includes the following steps:
[0052] S11. Detect the time information in the application to be translated.
[0053] Specifically, the time information in this embodiment of the invention may include: time and / or date. For example, the time information may include 11:41:01; for another example, the time information may include: September 9, 2021; for yet another example, the time information may include: September 9, 2021, 11:41:57.
[0054] S12. Obtain the attribute information of the time information.
[0055] The attribute information includes at least one of the target language for the translation of the time information, the time unit contained in the time information, and the number of bits in each time unit of the time information.
[0056] In this embodiment of the invention, when an application needs to be translated into a certain language, that language is the target language for translating the time information. For example, when an application needs to be translated from a Chinese application to an English application, the target language for translating the time information is English. The time units included in the time information may include one or more of the following: century, year, quarter, month, day, weekday, hour, quarter, minute, second, etc. The number of bits for a time unit refers to the number of bits used to represent the value of a time unit. For example, for the time unit "year", when identified by "18", "21", etc., its number of bits is 2, while when identified by "2018", "2021", etc., its number of bits is 4. As another example, for the time unit "month", when identified by "1", "5", etc., its number of bits is 1, while when identified by "01", "05", etc., its number of bits is 2.
[0057] S13. Determine the display format based on the attribute information.
[0058] That is, obtain the display format corresponding to the time information based on the attribute information of the time information.
[0059] It should be noted that when the application to be translated includes multiple time information, since there may be differences between the attribute information of each time information, it is necessary to obtain the display format corresponding to each time information based on the attribute information of each time information.
[0060] As an optional implementation of this invention, determining the display format based on the attribute information includes the following steps 1 and 2:
[0061] Step 1: Obtain the format identifier based on the attribute information.
[0062] Optionally, the implementation of obtaining the format identifier based on the attribute information may include the following steps a and b:
[0063] Step a: Calculate the attribute information based on a preset algorithm to obtain the target calculated value.
[0064] That is, the attribute information is used as the input of a preset algorithm, and the output of the preset algorithm is used as the target calculated value.
[0065] Step b: Obtain the format identifier based on the target calculated value.
[0066] It should be noted that the input and output of the preset algorithm in the embodiments of the present invention correspond one-to-one. The input of a unique preset algorithm can be used to calculate the output of a unique preset algorithm, thereby ensuring that different format identifiers can be obtained according to different attribute information.
[0067] Optionally, obtaining the format identifier based on the target calculated value may include: directly using the target calculated value as the format identifier.
[0068] Optionally, the implementation of obtaining the format identifier based on the target calculated value may further include: processing the target calculated value in a preset processing manner to obtain the format identifier. For example, the preset processing method may extract the first n digits of the target calculated value, where n is a positive integer.
[0069] Step 2: Determine the display format based on the format identifier and configuration file.
[0070] The configuration file includes the correspondence between the format identifier and the display format.
[0071] Optionally, prior to step 2 above, the application translation method in this embodiment of the invention further includes: generating the configuration file and pre-configuring the configuration file into the execution body of the application translation method provided in this embodiment of the invention. The generation of the configuration file may include: generating format identifiers corresponding to various time information based on attribute information of various time information, obtaining display formats corresponding to various time information, establishing a correspondence between format identifiers and display formats of various time information, and generating the configuration file.
[0072] For example, the configuration file in this embodiment of the disclosure can be as shown in Table 1 below:
[0073] Table 1 Configuration Files
[0074]
[0075] S14. Translate the time information based on the display format.
[0076] For example, based on the configuration file shown in Table 1 above, when the time information is 2021 / 09 / 09, and the format identifier obtained according to the attribute information of the time information is identifier 5, the display format "MMMM DD" can be obtained according to identifier 5 and the configuration file shown in Table 1, and the time information can be translated into September 09 based on the display format "MMMM DD".
[0077] The application translation method provided in this disclosure first detects the time information in the application to be translated and obtains the attribute information of the time information. Then, it determines the display format of the time information based on the attribute information and translates the time information based on the display format. Since the application translation method provided in this embodiment can obtain the display format of the time information based on the attribute information of the time information in the application to be translated, this embodiment can use a specified format to translate the time information in the application, avoiding errors that may arise from manually determining the display format of the time information. Therefore, this embodiment can solve the problem of incorrect display format of time information in the translated application.
[0078] As an extension and refinement of the above embodiments, this invention provides another method for translating applications, referring to... Figure 2 As shown, the translation method of this application includes the following steps:
[0079] S201. Obtain the target regular expression based on the current language of the application to be translated.
[0080] Specifically, time and date have specific display rules in each language environment, so the target regular expression can be generated based on the display rules of time and date in the current language.
[0081] For example, based on the rules for displaying time information in Chinese, the regular expression for a date in Chinese can be:
[0082] / ^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$ / ;
[0083] The regular expression for time can be:
[0084] / ^(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$ / ;
[0085] The regular expression for date and time can be:
[0086] / ^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$ / ;
[0087] Therefore, when the application to be translated is a Chinese application, the above regular expression can be selected as the target regular expression.
[0088] S202. Perform regular expression matching on the strings in the application to be translated, and determine the strings in the application to be translated that match the target regular expression as the time information in the application to be translated.
[0089] By performing regular expression matching on the strings in the application to be translated, and identifying the strings in the application that match the target regular expression as the time information in the application to be translated, the time information in the application to be translated can be quickly detected, and the misidentification or omission of the time information in the application to be translated can be avoided.
[0090] S203. Obtain the attribute information of the time information.
[0091] The attribute information includes at least one of the target language for the translation of the time information, the time unit contained in the time information, and the number of bits in each time unit of the time information.
[0092] Specifically, time information can be identified and analyzed to obtain its attribute information. For example, if the detected time information is "2021 / 09 / 09", then the three time units "year", "month", and "day" can be obtained, with the "year" data having 4 digits, the "month" data having 2 digits, and the "day" data having 2 digits.
[0093] S204. Calculate the attribute information based on a preset algorithm to obtain the target calculated value.
[0094] That is, the attribute information is used as the input of the preset algorithm, and the output of the preset algorithm is used as the target calculated value.
[0095] Optionally, the preset algorithm can be the Message-Digest Algorithm (MD5) algorithm.
[0096] Optionally, the preset algorithm may also be a hash algorithm.
[0097] Based on the above embodiments, the preset algorithm can also be other algorithms. This disclosure does not limit this algorithm, and the target calculation value that can be obtained based on the unique attribute information shall prevail.
[0098] S205. Obtain the format identifier based on the target calculated value.
[0099] In some embodiments, the target calculated value can be directly used as the format identifier.
[0100] In some embodiments, the target calculated value can be processed based on a preset processing method to obtain the format identifier.
[0101] S206. Obtain the display format based on the format identifier and configuration file.
[0102] The configuration file includes the correspondence between the format identifier and the display format.
[0103] S207. Translate the time information based on the display format.
[0104] Optionally, translating the time information based on the display format includes:
[0105] Based on the display format settings, at least one of the following is considered: the time units contained in the translated time information, the order of the time units in the translated time information, the number of digits in each time unit in the translated time information, and whether each time unit in the translated time information uses a plural number.
[0106] Time information requires different time units in different language environments. Setting the time unit included in the translated time information through the display format can prevent the translated time information from missing or having an extra time unit, thus ensuring the accuracy of the translated time information. For example, when translating the time information "Friday, May 28, 2021, 15:00", if the target language is English, since English displays use a 12-hour clock and requires specifying AM / PM, the time information can be translated as "Friday, May 28, 2021, 3:00 PM" by setting the display format to include the time unit "AM / PM".
[0107] In different language environments, the arrangement order of each time unit of time information is different. Setting the arrangement order of each time unit of the translated time information through the display format can ensure the correctness of the translated time information. For example, when translating the time information "May 28, 2021", if the target translation language is English, since the expression order of "year, month, day" in English is month, day, year in sequence, the arrangement order of the time units of the translated time information can be set to month, day, year through the display format, so that the time information is translated into "May 28, 2021".
[0108] In different language environments, the definition of whether each time unit of time information needs to use a plural form is different. Setting whether each time unit of the translated time information uses a plural form through the display format can ensure the correctness of the translated time information. For example, in English, the English expression for the next 11 hours is "in 11 hours", which is in the plural form. In Russian, no matter it is 11, 21, or 101, as long as the last digit is 1, it is regarded as singular. Therefore, the Russian expression for the next 11 hours is "через 11 ч", which is in the singular form. Japanese does not distinguish between singular and plural, so the Japanese expression for the next 11 hours is "11時間後".
[0109] When the translation method for an application provided by the embodiments of the present disclosure translates an application, it first detects the time information in the application to be translated, obtains the attribute information of the time information, then determines the display format of the time information according to the attribute information, and translates the time information based on the display format. Since the translation method for an application provided by the embodiments of the present invention can obtain the display format of the time information according to the attribute information of the time information in the application to be translated, when translating the time information in the application, the embodiments of the present invention can translate the time information in the application using a specified format, avoiding possible errors caused by manually determining the display format of the time information. Therefore, the embodiments of the present invention can solve the problem that the display format of the time information in the translated application is incorrect.
[0110] Based on the same inventive concept, as an implementation of the above method, the embodiments of the present disclosure further provide a translation apparatus for an application. This apparatus embodiment corresponds to the foregoing method embodiment. For the convenience of reading, this apparatus embodiment will not repeat the detailed contents in the foregoing method embodiment one by one, but it should be made clear that the translation apparatus for an application in this embodiment can correspondingly implement all the contents in the foregoing method embodiment.
[0111] The embodiments of the present disclosure provide a translation apparatus for an application. Figure 3 is a schematic structural diagram of the translation apparatus for an application, as shown in Figure 3 As shown, the translation device 300 of the application includes:
[0112] Detection unit 31 is used to detect time information in the application to be translated;
[0113] The acquisition unit 32 is used to acquire attribute information of the time information, the attribute information including at least one of the target language for translation of the time information, the time unit contained in the time information, and the number of data bits of each time unit of the time information;
[0114] Processing unit 33 is used to obtain the display format based on the attribute information;
[0115] Translation unit 34 is used to translate the time information based on the display format.
[0116] As an optional implementation of this disclosure, the processing unit 33 is specifically used to obtain a format identifier based on the attribute information; and to determine the display format based on the format identifier and the configuration file.
[0117] The configuration file includes the correspondence between the format identifier and the display format.
[0118] As an optional implementation of this disclosure, the processing unit 33 is specifically used to calculate the attribute information based on a preset algorithm, obtain a target calculated value, and obtain the format identifier based on the target calculated value.
[0119] As an optional implementation of this disclosure, the preset algorithm is either the MD5 message digest algorithm or a hash algorithm.
[0120] As an optional implementation of this disclosure, the detection unit 31 is specifically used to perform regular expression matching on the strings in the application to be translated, and to determine the strings in the application to be translated that match the target regular expression as the time information in the application to be translated.
[0121] As an optional implementation of this disclosure, the detection unit 31 is further configured to obtain the target regular expression based on the current language of the application to be translated before performing regular expression matching on the strings in the application to be translated.
[0122] As an optional implementation of this disclosure, the translation unit 34 is specifically configured to set at least one of the following based on the display format: the time unit contained in the translated time information, the arrangement order of the various time units in the translated time information, the number of digits in each time unit of the translated time information, and whether each time unit of the translated time information uses a plural number.
[0123] The application translation device provided in this embodiment of the invention can implement the application translation method provided in the above embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0124] Based on the same inventive concept, this disclosure also provides an electronic device. Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this disclosure, such as... Figure 4 As shown, the electronic device provided in this embodiment includes a memory 41 and a processor 42. The memory 41 is used to store computer programs; the processor 42 is used to enable the electronic device to implement the application translation method provided in the above embodiment when the computer program is invoked and executed.
[0125] Specifically, memory 41 can be used to store software programs and various data. Memory 41 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). In addition, memory 41 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0126] The processor 42 is the control center of the electronic device. It connects various parts of the electronic device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 41, and by calling data stored in the memory 41, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 42 may include one or more processing units.
[0127] Furthermore, it should be understood that the electronic device provided in the embodiments of the present invention may also include components such as a radio frequency unit, a network module, an audio output unit, a receiving unit, a sensor, a display unit, a user receiving unit, an interface unit, and a power supply. Those skilled in the art will understand that the structure of the electronic device described above does not constitute a limitation on the electronic device; the electronic device may include more or fewer components, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the electronic device includes, but is not limited to, mobile phones, tablet computers, laptop computers, PDAs, vehicle terminals, wearable devices, and pedometers.
[0128] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a computing device, causes the computing device to implement the application translation method provided in the above embodiments.
[0129] This disclosure also provides a computer program product that, when run on a computer, enables the computer to implement the application translation method provided in the above embodiments.
[0130] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media containing computer-usable program code.
[0131] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0132] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0133] Computer-readable media include both permanent and non-permanent, removable and non-removable storage media. Storage media can store information using any method or technology; the information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media do not include transient computer-readable media, such as modulated data signals and carrier waves.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this disclosure.
Claims
1. A method for translating an application, characterized in that, include: Detect time information in the application to be translated; Obtain the attribute information of the time information, the attribute information including the target language for the translation of the time information, the time units contained in the time information, and the number of data bits for each time unit of the time information; The attribute information is calculated based on a preset algorithm to obtain the target calculated value; Obtain the format identifier based on the target calculated value; The display format is determined based on the format identifier and the configuration file; the configuration file includes the correspondence between the format identifier and the display format; The time information is translated based on the display format.
2. The method according to claim 1, characterized in that, The preset algorithm is either the MD5 message digest algorithm or a hash algorithm.
3. The method according to claim 1, characterized in that, The detection of time information in the application to be translated includes: Regular expression matching is performed on the strings in the application to be translated, and the strings in the application to be translated that match the target regular expression are identified as the time information in the application to be translated.
4. The method according to claim 3, characterized in that, Before performing regular expression matching on the strings in the application to be translated, the method further includes: The target regular expression is obtained based on the current language of the application to be translated.
5. The method according to any one of claims 1-4, characterized in that, The translation of the time information based on the display format includes: Based on the display format settings, at least one of the following is considered: the time units contained in the translated time information, the order of the time units in the translated time information, the number of digits in each time unit in the translated time information, and whether each time unit in the translated time information uses a plural number.
6. A translation device for an application, characterized in that, include: The detection unit is used to detect time information in the application to be translated; The acquisition unit is used to acquire attribute information of the time information, the attribute information including the target language for translation of the time information, the time units contained in the time information, and the number of data bits for each time unit of the time information; The processing unit is used to calculate the attribute information based on a preset algorithm to obtain the target calculated value; Obtain the format identifier based on the target calculated value; The display format is determined based on the format identifier and the configuration file; the configuration file includes the correspondence between the format identifier and the display format; A translation unit is used to translate the time information based on the display format.
7. An electronic device, characterized in that, include: A memory and a processor, the memory being used to store a computer program; the processor being used to cause the electronic device to implement the translation method of the application program according to any one of claims 1-5 when the computer program is invoked.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a computing device, causes the computing device to implement the translation method of the application program according to any one of claims 1-5.
9. A computer program product, characterized in that, When the computer program product is run on a computer, the computer enables the computer to implement the translation method of the application program according to any one of claims 1-5.
Citation Information
Patent Citations
Date-time automatic translation control method
CN106844355A
Temporal translation grammar for language translation
US20150278201A1
