Android translation import and export method, system and tool

CN116028030BActive Publication Date: 2026-11-24CHANGZHOU XINTU SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310059301.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-20
Publication Date
2026-11-24
Estimated Expiration
2043-01-20

AI Technical Summary

Technical Problem

从第二次开始,开发很难知道国际公司到底修改了哪些内容,并且由于都是人为操作,很容易出现错误

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116028030B_ABST
    Figure CN116028030B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of translation technology, specifically relating to an Android translation import and export method, system, and tool, including: exporting a translation comparison table; comparing the translation comparison table; importing the translation comparison table into code; and automatically importing, comparing, and exporting the code and the Excel format translation comparison table, saving development time for the corresponding translation and improving translation accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of translation technology, specifically relating to an Android translation import / export method, system, and tool. Background Technology

[0002] When developing Android export projects, the text used needs to be translated. The usual practice is for developers to manually transcribe the translated code into an Excel file and provide it to the client. The client then hires an international translation company to translate it and provide it back to the developers, who then manually update the code. From the second step onwards, it becomes difficult for developers to know exactly what changes the international company made, and because it's all done manually, errors are easily made.

[0003] Therefore, based on the above technical issues, it is necessary to design a new Android translation import / export method, system, and tool. Summary of the Invention

[0004] The purpose of this invention is to provide an Android translation import / export method, system, and tool.

[0005] To address the aforementioned technical problems, this invention provides an Android translation import / export method, comprising:

[0006] Export the translation comparison table;

[0007] Comparison and translation comparison table;

[0008] Import the translation comparison table as code.

[0009] Furthermore, the method for deriving the translation comparison table includes:

[0010] The paths to all translation files are obtained based on the modules and languages ​​specified in the configuration file.

[0011] Furthermore, the method for deriving the translation comparison table also includes:

[0012] Read all tags containing "name" from the translation file;

[0013] If the element with that id does not exist in the local list, then create an element: {"model":

[0014] "Android","id":"confirm","en":"Confirm"};

[0015] If an element with that ID already exists, then update the language. The updated element will look like this: {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"};

[0016] Once all translation files have been traversed, they are inserted into a list, each occupying a cell for module name, ID, and language.

[0017] Furthermore, the method for comparing translation reference tables includes:

[0018] Choose one translation table as the comparison template, read the contents of another translation comparison table, and organize them into {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}.

[0019] Furthermore, the method for comparing translation lookup tables also includes:

[0020] Read the translation table as a template row by row, and search in the pre-organized list based on the content of the module name and ID column;

[0021] If found, compare the content for each language. If the content is different, update the content of the corresponding cell and mark the cell.

[0022] If not found, then mark the entire translated cell.

[0023] Furthermore, the method for importing the translation lookup table into code includes:

[0024] Read the contents of the translation comparison table and organize them into a list in the format {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}.

[0025] Furthermore, the method for importing the translation lookup table into code also includes:

[0026] During the compilation process, if the translation contains specific text, the corresponding characters will be added to the compiled list.

[0027] If the translation lookup table contains a specific wildcard, then check whether other translations corresponding to that translation also contain that specific wildcard. If they do not, then the translation is considered to have a problem, and the translation is printed in log.

[0028] Furthermore, the method for importing the translation lookup table into code also includes:

[0029] For each translation, first locate the translation file, read the translation file, and if a tag matching the ID is found, then update the tag content; otherwise, add a new tag.

[0030] Secondly, the present invention also provides a translation import / export system employing the above-described Android translation import / export method, comprising:

[0031] The export module exports a translation comparison table.

[0032] The comparison module includes a translation comparison table.

[0033] Import the module and import the translation comparison table as code.

[0034] Thirdly, the present invention also provides a translation import / export tool.

[0035] The above Android translation import / export method is used for text translation.

[0036] The beneficial effects of this invention are that it automatically imports, compares, and exports code and Excel-formatted translation comparison tables by exporting, comparing, and importing the translation comparison tables into code, thus saving time in developing corresponding translations and improving translation accuracy.

[0037] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained through the structures particularly pointed out in the description and the drawings.

[0038] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0039] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0040] Figure 1 This is a flowchart of an Android translation import / export method according to the present invention;

[0041] Figure 2 This is a translation comparison of the present invention.

[0042] Figure 3 This is a block diagram illustrating the principle of an Android translation import / export system according to the present invention. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0044] Example 1

[0045] like Figures 1 to 3 As shown, this embodiment 1 provides an Android translation import and export method, including: exporting a translation comparison table; comparing the translation comparison table; importing the translation comparison table into code; realizing automatic import, comparison, and export between code and Excel format translation comparison table, saving development time for corresponding translations and improving translation accuracy.

[0046] This script uses Python to import, compare, and export code and an Excel-formatted translation lookup table. The lookup table contains columns for: module name, ID, and language. Each translation entry will also contain these columns. For example, for a translation in the lookup table with the module "AndroidAuto" and ID "confirm", the path to the English translation file in the code would be:

[0047] The Chinese translation file is located at AndroidAuto / src / main / res / values / strings.xml. The content of "values" will differ depending on the language, following Android specifications. Each strings.xml file contains a unique tag with the name "confirm", formatted as "".<stringname="confirm"> The value in the "Confirm" tag is the translation of that language.

[0048] In this embodiment, the method for exporting the translation comparison table includes: obtaining all translation file paths based on the modules and languages ​​in the configuration file to avoid omissions.

[0049] In this embodiment, the method for exporting the translation comparison table further includes: traversing all translation files and reading all tags containing "name" in the translation files; if there is no element with that id in the local list, then create an element: {"model":"Android","id":"confirm","en":"Confirm"}; if there is already an element with that id, then update the language, and the updated element is: {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}; after all translation files have been traversed, insert them into the table list according to module name, ID, and language, each occupying one cell.

[0050] In this embodiment, the method for comparing translation lookup tables includes: determining one translation lookup table as a comparison template, reading the contents of another translation lookup table, and organizing them into a list in the format of {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}.

[0051] In this embodiment, the method for comparing translation lookup tables further includes: reading the translation table as a template row by row, searching in the pre-organized list based on the content of the module name and ID column; if found, comparing the content of each language, updating the content of the corresponding cell if the content is different, and marking the cell, i.e., according to user configuration, updating the content of the corresponding cell to the new translation or displaying both the old and new translations, and filling the cell in red, and finally deleting the translation from the local list; if not found, marking the entire translation cell, for example, filling the entire translation cell in gray; marking the cells and marking cells of different results with different colors to facilitate differentiation during manual inspection by staff later.

[0052] In this embodiment, the method of importing the translation lookup table into code includes: reading the contents of the translation lookup table and organizing them into a list in the format {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}.

[0053] In this embodiment, the method of importing the translation lookup table into code further includes: during the organization process, if the translation contains specific text, the corresponding character is added to the organized list; if the translation lookup table contains a specific wildcard, it is checked whether other translations corresponding to that translation also contain the specific wildcard. If they do not contain it, it is determined that the translation has a problem, and the translation is printed through log; for example, if the translation contains "or" during organization, then a backslash is manually added because these characters need to be escaped in XML. If the translation contains wildcards such as %d, then it is checked whether other translations corresponding to that translation also contain the wildcard. If they do not contain it, then the translation has a problem, and the translation is printed through log for subsequent manual confirmation.

[0054] In this embodiment, the method for importing the translation lookup table into code further includes: for each translation, first locating the translation file according to the rules described above, reading the translation file, and if a tag matching the ID is found, then updating the tag's content; otherwise, adding a new tag. This saves time in developing the corresponding translation and improves the accuracy of the translation.

[0055] Example 2

[0056] Based on Embodiment 1, Embodiment 2 further provides a translation import and export system using the Android translation import and export method in Embodiment 1, including: an export module for exporting translation comparison tables; a comparison module for comparing translation comparison tables; and an import module for importing the translation comparison tables into code.

[0057] Specifically, based on the modules and languages ​​in the configuration file, all translation file paths are obtained; all translation files are traversed, and all tags containing "name" are read. If an element with that ID does not exist in the local list, an element is created, such as {"model":"Android","id":"confirm","en":"Confirm"}. If an element with that ID already exists, the language is updated, and the updated element is as follows:

[0058] {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}; After all translation files have been traversed, they are inserted into the table, each occupying a cell for module name, ID, and language; One translation table is selected as the comparison template, and the contents of another translation comparison table are read and organized into a list in the format {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}; The translation table used as the template is read row by row, and the contents of the module name and ID columns are searched in the organized list. If found, the contents of each language are compared. If the contents are different, the contents of the corresponding cell can be updated to the new translation or both the old and new translations can be displayed, and the cell can be filled with red, according to the user configuration. Finally, the translation is deleted from the local list. If not found, fill the entire translated cell with gray; read the contents of the translation lookup table and organize them into a list in the format {"model":"Android","id":"confirm","en":"Confirm","cn":"Confirm"}; during the organization, if the translation contains "or", manually add \, because these characters need to be escaped in XML; if the translation contains wildcards like %d, check if other translations corresponding to this translation also contain the wildcard; if not, then this translation has a problem, and log the translation for later manual confirmation; for each translation, first locate the translation file according to the rules described above, read the translation file, and if a tag matching the id is found, update the tag's content; otherwise, add a new tag.

[0059] Example 3

[0060] Based on Example 1, Example 3 also provides a translation import / export tool that uses the above-described Android translation import / export method for text translation.

[0061] In summary, this invention achieves automatic import, comparison, and export between code and Excel-formatted translation comparison tables by exporting translation comparison tables, comparing translation comparison tables, and importing translation comparison tables into code. This saves time in developing corresponding translations and improves translation accuracy.

[0062] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0063] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0064] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0065] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.

Claims

1. An Android translation import / export method, characterized in that, include: Export the translation comparison table; Comparison and translation comparison table; Import the translation comparison table as code; The method for deriving the translation comparison table includes: Obtain all translation file paths based on the modules and languages ​​in the configuration file; The method for deriving the translation comparison table also includes: Read all tags containing "name" from the translation file; If the element with the specified id does not exist in the local list, create an element: {"model": "Android","id": "confirm", "en":"Confirm"}; If an element with that ID already exists, then update the language. The updated element will look like this: {"model": "Android", "id": "confirm", "en":"Confirm", "cn":"Confirm"}; After all translation files have been traversed, they are inserted into a list, each occupying a cell for module name, ID, and language. The method for comparing translation reference tables includes: Choose one translation table as the comparison template, read the contents of another translation comparison table, and organize them into {"model": "Android", "id": "confirm", "en":"Confirm", "cn":"Confirm"}; The method for comparing translation reference tables also includes: Read the translation table as a template row by row, and search in the pre-organized list based on the content of the module name and ID column; If found, compare the content for each language. If the content is different, update the content of the corresponding cell and mark the cell. If not found, then mark the entire translated cell; The method for importing the translation comparison table into code includes: Read the contents of the translation comparison table and organize them into a list in the format {"model": "Android", "id": "confirm", "en":"Confirm", "cn":"Confirm"}; The method for importing the translation comparison table into code also includes: During the compilation process, if the translation contains specific text, the corresponding characters will be added to the compiled list. If the translation lookup table contains a specific wildcard, then check whether other translations corresponding to that translation also contain that specific wildcard. If they do not, then the translation is considered to have a problem, and the translation is printed in log. The method for importing the translation comparison table into code also includes: For each translation, first locate the translation file, read the translation file, and if a tag matching the ID is found, then update the tag content; otherwise, add a new tag.

2. A translation import / export system employing the Android translation import / export method as described in claim 1, characterized in that, include: The export module exports a translation comparison table. The comparison module includes a translation comparison table. Import the module and import the translation comparison table as code.

3. A translation import / export tool, characterized in that, Text translation is performed using the Android translation import / export method as described in claim 1.

Citation Information

Patent Citations

  • Language translation processing method and device, electronic equipment and medium

    CN111652003A