CN110414010B - Processing method of internationalized resource file translation text and readable storage medium - Google Patents
Processing method of internationalized resource file translation text and readable storage medium Download PDFInfo
- Publication number
- CN110414010B CN110414010B CN201810392114.3A CN201810392114A CN110414010B CN 110414010 B CN110414010 B CN 110414010B CN 201810392114 A CN201810392114 A CN 201810392114A CN 110414010 B CN110414010 B CN 110414010B
- Authority
- CN
- China
- Prior art keywords
- resource
- translation
- content
- default language
- file
- 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.)
- Active
Links
- 238000013519 translation Methods 0.000 title claims abstract description 124
- 238000003672 processing method Methods 0.000 title claims abstract description 18
- 238000000034 method Methods 0.000 claims abstract description 33
- 238000012545 processing Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 6
- 238000003491 array Methods 0.000 claims 1
- 238000012216 screening Methods 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 4
- 238000011161 development Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 238000002372 labelling Methods 0.000 description 3
- 230000008520 organization Effects 0.000 description 3
- 238000001914 filtration Methods 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Stored Programmes (AREA)
- Machine Translation (AREA)
Abstract
The invention provides a processing method of internationalized resource file translation text and a readable storage medium, wherein the method comprises the following steps: creating a form corresponding to the application according to the application corresponding to the resource folder, wherein the header of the form comprises a resource keyword, a keyword corresponding value, a tag description and whether translation is performed or not, and the tag description corresponds to a resource type; traversing a default language resource file under the resource folder according to a preset resource type, and reading corresponding default language resource content; and reading the resource keywords corresponding to the default language resource content, the corresponding values of the keywords, the resource types and the records of whether the resources are translated or not to the form. The invention can automatically generate the form containing the key resource content and definitely marking whether to translate or not, and can accurately return to the appointed position after the translation is completed, thereby obviously improving the efficiency and accuracy of resource translation.
Description
Technical Field
The invention relates to the field of document data processing, in particular to a processing method of internationalized resource file translation text and a computer readable storage medium.
Background
In the android system in the prior art, internationalized language resources are all saved in XML format documents. With the development of android systems, adding localization languages or adding system support languages becomes a common requirement. Current common practices include:
scheme one: and collecting all resource files (such as string. Xml) in the android system, providing the resource files for professional language translation personnel, and putting the resource files back to the android source code environment after the translation is completed.
Scheme II: and copying the character string resources to be translated from the resource file into Microsoft office software EXCEL by a developer, completing translation by the translator according to the EXCEL, and copying back to the corresponding XML file by the developer.
Among them, scheme one has the following disadvantages: the resource file in the XML format is not friendly to translation personnel, and the original format of the XML is frequently modified by mistake, so that the system cannot analyze the resource file; in addition, the obtained XML file contains a plurality of resources which do not need translation, so that not only is the unnecessary workload of a translator increased, but also the workload of the translator is difficult to accurately count;
scheme II has the following disadvantages: screening, copying and replacement are all manual operations, not only increasing the error rate, but also requiring open personnel to spend a great deal of time, resulting in increased labor costs for the company.
Accordingly, there is a need for a processing method of internationalized resource file translation text and a computer readable storage medium that overcome the above disadvantages.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the processing method and the readable storage medium for the translation text of the internationalized resource file can automatically generate a form containing key resource contents and definitely marking whether the translation is performed or not, so that the efficiency and the accuracy of the resource translation are obviously improved.
In order to solve the technical problems, the invention adopts the following technical scheme:
the processing method of the internationalized resource file translation text comprises the following steps:
creating a form corresponding to the application according to the application corresponding to the resource folder, wherein the header of the form comprises a resource keyword, a keyword corresponding value, a tag description and whether translation is performed or not, and the tag description corresponds to a resource type;
traversing a default language resource file under the resource folder according to a preset resource type, and reading corresponding default language resource content;
and reading the resource keywords corresponding to the default language resource content, the corresponding values of the keywords, the resource types and the records of whether the resources are translated or not to the form.
The other technical scheme provided by the invention is as follows:
a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps involved in the above-described processing method of internationalized resource file translation text.
The invention has the beneficial effects that: the invention can automatically generate the form containing the key resource content and clearly marking whether the resource content needs to be translated through analyzing the resource folder. The form-type file to be translated is friendly to the translator, so that the translator can conveniently and clearly translate the content, and the problem that the system cannot resolve correctly due to the fact that the original format is modified by mistake due to the fact that the content of the file to be translated is disordered can be effectively avoided; further, key resources are marked in the form through label description so as to avoid missing translation, and therefore translation accuracy and translation efficiency are improved; still further, the form also contains resource key attributes, so that the translated resource content can be accurately returned to the original position. Based on the method, the processing efficiency and the processing accuracy of the translated text of the resource file can be obviously improved.
Drawings
FIG. 1 is a schematic diagram of an organization of resource files according to the present invention;
FIG. 2 is a flow chart of a method for processing translation text of an internationalized resource file according to the present invention;
FIG. 3 is a flow chart of another method for processing translation text of an internationalized resource file according to the present invention;
fig. 4 is a flowchart of a processing method of translating text from an internationalized resource file in a specific application scenario according to a first embodiment of the present invention.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
The most critical concept of the invention is as follows: the method can automatically generate the translation text in the form of a form containing key resource content and explicitly marking whether the resource content needs to be translated based on the analysis of the resource folder.
Technical term explanation related to the invention:
technical terminology | Interpretation of the drawings |
Internationalization resource file | For adapting words, pictures, etc. of different countries and regions in software applications |
Resource key | Software identification tag for different character strings |
Keyword correspondence value | Character string content corresponding to key word |
Label description | Node type in XML file |
Resource type | The kinds of resources, such as: character string, array, character string array, etc |
Translabable tag | Attributes used in XML files to identify whether the node is translated |
Python library | Script language Python specific software package |
item sequence number | Representing a specific sequence number of an array resource |
Referring to fig. 1 and fig. 2, the present invention provides a method for processing translation text of an internationalized resource file, which includes:
creating a form corresponding to the application according to the application corresponding to the resource folder, wherein the header of the form comprises a resource keyword, a keyword corresponding value, a tag description and whether translation is performed or not, and the tag description corresponds to a resource type;
traversing a default language resource file under the resource folder according to a preset resource type, and reading corresponding default language resource content;
and reading the resource keywords corresponding to the default language resource content, the corresponding values of the keywords, the resource types and the records of whether the resources are translated or not to the form.
From the above description, the beneficial effects of the invention are as follows: the resource types in the resource file are finely distinguished, and the label description is correspondingly marked in the form, so that the marking of key resources is realized, the omission of the key resources is avoided, a large amount of manpower resources are used for checking in the later period, and the processing efficiency of languages supported by a newly added system is improved; based on the record of the trans-table label in the source code of the resource file, the resource content to be translated is definitely required, and the filtering of irrelevant content can be realized, so that the translation workload is obviously reduced, the translation efficiency is improved, and meanwhile, the translation workload is conveniently and accurately calculated; the form also contains resource key attributes, namely resource keywords, so that the translated resource content can be accurately returned to the original position, the error of manual editing is reduced to the greatest extent, and meanwhile, the realization efficiency and the completion precision of the newly added language are improved.
Referring to fig. 2, further, the header further includes languages;
reading the language corresponding to the default resource content from the form;
the processing method further comprises the following steps:
traversing the non-default language resource files under the resource folder according to the preset resource types, and reading the corresponding non-default language resource content;
reading resource keywords corresponding to the non-default language resource content;
matching the resource keywords corresponding to the non-default language resource content with the resource keywords corresponding to the default language resource content;
and reading the resource keywords, the corresponding values of the keywords, the resource types, whether translation and languages are carried out or not and outputting the resource keywords, the corresponding values of the keywords, the resource types, whether translation and languages are carried out or not, which are successfully matched, to the form.
As can be seen from the above description, for the case of adding languages, only the resource content of the default language (i.e. english) can be provided for the translation staff to refer to, and the non-default resource files in the resource folder do not need to be processed, so that the form generation efficiency is obviously improved, meanwhile, the form content is ensured to be 'less and more precise', and the translation workload is greatly reduced; for the resource file with the target translation language in the resource folder, the purpose is to perfect the content of the resource text and ensure the translation integrity, or the condition that the resource content of two languages is required to be acquired simultaneously and the translation reference is convenient, all the key resource contents of the resource file to be perfected or other reference resource files can be acquired through the keyword matching mode (the characteristic that the keyword in the default language resource file is determined to be complete), and the translation integrity of the key resource contents is ensured.
Further, if the default language resource content or the non-default language resource content corresponds to the transparent label in the source code, recording the default language resource content or the non-default language resource content in the form as a form without translation, or not outputting the related content of the default language resource content to the form.
As is clear from the above description, in the source code, whether or not translation is required is marked in advance for each piece of resource content in the form of a translation tag (translation tag), and if the tag corresponds to a false value, this indicates that translation is not required, and if the tag corresponds to a true value or does not exist, this indicates that translation is required. Based on the content which definitely needs to be translated, the omission of the translation of key resources is avoided; meanwhile, the method can also be used as a basis for outputting a value form or not to realize the filtration of irrelevant data.
Further, the processing method is operated through a Python library, and a form in the EXCEL format is obtained.
As can be seen from the description, the method is based on the simplicity, readability and high expansibility of the Python language, and the XML of the resource file and the screening of the keywords are carried out through the xml.dom.miniom library, so that the method is convenient to operate and high in processing efficiency.
Further, the method further comprises the following steps:
acquiring a form file after translation is completed;
determining a corresponding resource folder according to the application corresponding to the form file;
if the corresponding resource folder does not contain the non-default language resource file of the language corresponding to the translation completion, creating a new non-default language resource file of the language;
and outputting each piece of resource content in the form file to a position corresponding to the non-default resource file according to the resource key words recorded in the form file.
Further, the method further comprises the following steps:
and if so, outputting each piece of resource content in the form file to a position corresponding to the non-default resource file according to the resource key words recorded in the form file.
As can be seen from the above description, for the case of newly adding a supported language, a new resource file corresponding to the application and the language needs to be newly built in the resource folder for storage; and for the situation that the resource files corresponding to the references and languages exist, directly locating the language folder and the file which need to be output for each piece of resource content, and placing the resource back. Thereby maintaining the original resource file organization form, ensuring the normal operation of the system,
further, in the step of reading the resource keyword, the value corresponding to the keyword, the resource type and the record whether to translate or not corresponding to the default language resource content, and outputting the record to the form, if the resource type corresponding to the default language resource content is an array, it is also necessary to read the item sequence number to the form at the same time;
and outputting the resource keywords and item sequence numbers corresponding to the default language resource content to corresponding positions during the step of outputting.
As can be seen from the above description, for vector resources, i.e., array resource contents, specific item numbers of the vector resources need to be identified according to keywords, and then specific keyword corresponding values are corresponding to the specific item numbers and output to designated positions in a form.
Further, the resource types include character strings, group numbers, character string group numbers, complex numbers, and custom controls.
It should be noted that the above description includes at least the above-mentioned general key resource types, and of course, other resource types that need to be processed may be added according to the requirement.
The other technical scheme provided by the invention is as follows:
a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps involved in the above-described processing method of internationalized resource file translation text.
From the above description, the beneficial effects of the invention are as follows: it will be appreciated by those skilled in the art that implementing all or part of the above-described aspects may be implemented by means of hardware associated with a computer program, where the program may be stored in a computer readable storage medium, and the program may include the steps of the methods described above when executed.
Example 1
Referring to fig. 3 and 4, the present embodiment provides a processing method for internationalization resource text translation text.
The method is mainly applied to processing internationalized resource files stored in an XML format by an android system, and text for translation by translation staff is obtained. The resource files of the android system have a specific storage format, a specific resource file organization form is shown in fig. 1, and a resource folder corresponding to an application exists for storing resources of the application, wherein the resource folder is usually named by application name, such as Email. Under the resource folder, a default language folder exists, usually named by values (default language), and English is uniformly specified in the android system; if the application also supports other languages, then there will also be a non-default language folder under the resource folder that corresponds to the supported language, for example, the supported language is simplified Chinese, and this non-default language folder will be named value-zh-rCN. Under each language folder, corresponding resource files are also set corresponding to various resource types, such as corresponding string (character string) types under the default language folder, and resource files commanded by strings.
The embodiment specifically may include the following steps:
s1: traversing the top-layer folder storing all the resource folders to obtain the application corresponding to each resource folder.
The top-level folder is stored with resource folders corresponding to each application, that is, each resource folder is correspondingly stored with resource files of one application, such as Bluetooth and Email, or any other APP, component, etc. Preferably, the names of the respective resource folders correspond to application names.
S2: and creating a form corresponding to the application according to the application corresponding to the resource folder.
Specifically, a form corresponding to the application is created corresponding to the application, and the form is used for identifying the correspondence between the form serving as the translation text and the application and the resource folder corresponding to the application. Preferably, the application name is directly used as the form name, so that the method has unique designability and intuitiveness.
The header of the created form may include resource keywords, keyword correspondence values, tag descriptions, whether to translate, languages, etc.
Under the header of the tag description, the corresponding resource type is recorded corresponding to the specific resource content. The common resource file types in the Android resource file are as follows: string, group number (array), string group number (string-array), complex number (plurals), custom control (default-style), etc., of course, other types of resources to be processed may be added according to the requirements. The recording and distinguishing of different types of resources is to achieve the extraction and replacement of resource files.
Wherein, the "resource key words" and "key word corresponding values" refer to a key word (name) extracted according to the resource content, and a corresponding value (value) corresponding to the key word, for example, the key word extracted by the resource content for opening the application under the corresponding default language resource is "OPEN APP", and the corresponding value is "OPEN APP"; the key extracted by the resource content corresponding to the simplified Chinese is the same as 'OPEN APP', but the corresponding value is 'OPEN application'. Meanwhile, since the default language resource file necessarily contains all necessary resource contents, the keywords extracted from the default language resource file have comprehensiveness. The non-default language resource content after the subsequent translation is completed must be able to extract all the keywords described above to ensure that the non-default language resource file after the translation is completed contains all the key resource content. Therefore, if multiple languages are to be supported, it is necessary to ensure that each keyword corresponds to a resource name of a different language.
The corresponding table header is "whether translation is performed" or not, and is determined according to whether the current resource needs to be translated or not in the form of a translation tag (translation tag) by a developer in the process of developing the source code. In the process of outputting the resource content to the form, whether the current resource needs to be translated is directly judged according to the label, and if the content corresponding to the label is false, the resource is marked to be not needed to be translated.
The "language" in the form is optional, and is mainly used for identifying the language name of the resource, such as default language, simplified Chinese, russian and the like. If only the resource content of the default language is output to the form for translation by the translation staff, the header is not required; if the resource content of other languages is required to be output at the same time for the translation staff to refer to or perfect the translation text of the corresponding language, the language marking is preferably carried out at the same time, so that the translation work of the translation staff is convenient to develop.
This step creates and outputs the above-mentioned table, preferably through the xml. Dom. Miniom library of Python. Python has the advantages of convenient operation, strong expansibility and the like, and based on the Python, the automatic return of the resource content of the form file after the subsequent translation is completed can be realized, so that the processing efficiency is remarkably improved.
Hereinafter, a detailed description will be given of a process of processing a resource folder of a single application.
For example, for an Email application, after creating a form named Email in step S2, the following steps are included:
s3: traversing the default language resource file under the resource folder according to the preset resource type, and reading the corresponding default language resource content.
Specifically, the method includes the steps of entering a specific application, such as Email, which corresponds to a resource folder, and reading specific resource content in a default language resource file under the resource folder.
S4: and screening resource keywords and keyword corresponding values of the default language resource file. Namely, processing resource contents piece by piece in a resource file according to a preset resource type, then recording a corresponding name label node, and recording the keyword attribute of the resource.
Specifically, the resource file contains various strings.xml, array.xml, and "xliff: g" and a transitable tag value in the file, and the required string information is screened according to the name of the node, for example, the English value corresponding to the confirm_send is the Send email.
S5: and outputting the corresponding resource keywords, the corresponding values of the keywords, the resource types, whether the translation is performed or not and the corresponding language records when the list head of the language exists to the form of the application according to the default language resource content.
When the corresponding resource type is vector resource, namely array resource type, the item sequence number is also required to be read to the form at the same time for positioning and returning to the original place after the subsequent translation is completed.
Specifically, in the output process of the option of translating or not, if the piece of resource content corresponds to the existence of a transitable tag in the source code and the tag content is false, the piece of resource content record is marked as not requiring translation under the header of the "translate or not translated" in the form, or the relevant content of the resource content is directly selected and not output to the form. The method has the advantages that most resources which do not need to be translated can be screened out through processing of the trans-table label in the Android resource file and clear labeling of the follow-up form, and resource contents which do not need to be translated are filtered, so that accuracy of the contents to be translated, extracted by the translation text, is realized, and further efficiency of translation work is remarkably improved; furthermore, the number of characters to be translated can be accurately calculated, and statistics of translation workload is facilitated.
In the process of extracting (and outputting), the resource keywords and the keyword corresponding values of all resource contents under the corresponding resource types are extracted and output according to the resource types, namely all the resource key attributes are reserved. The method ensures that the translation resources returned later can be accurately put back into the original resource folder, and a developer only needs to simply copy the folder corresponding to the application to put back into the application folder, so that the error of manual editing is reduced to the greatest extent.
Meanwhile, the resource types in the Android resource file, such as string-array, are distinguished more carefully, and the extracted form is described through corresponding labels, so that the problem that a large number of key resources are easy to miss due to the fact that the existing translation text in the prior art is prone to cause, and a large number of human resources in the later stage are checked is solved, and therefore the translation text is guaranteed to contain all the key resources, and comprehensiveness is achieved.
Therefore, the automatic generation of the translation text, namely the translation text in the form of the form, is realized, the contents of all key resources to be translated are recorded in the form, a large number of invalid resources are removed, whether translation is needed is clearly annotated, the efficient development of translation work of translation staff is facilitated, and meanwhile, the comprehensiveness and the accuracy of the translation contents are ensured.
In a preferred embodiment of the present invention, the foregoing scheme is further optimized, specifically, when resource contents of other languages than the default language resource content need to be provided in the generated translation text for the translation personnel to refer to, or incomplete non-default language resource content is further perfected, when the form is created in the step S2, a "language" header for labeling the corresponding language name is also created (other words for labeling the language name are all within the protection scope of the present application); in the step S5, the language corresponding to the content of the current language resource is also read and output to the under-head of the "language" table.
After step S5, it will further include:
s6: traversing the non-default language resource file under the currently applied resource folder according to the preset resource type, and reading the corresponding non-default language resource content.
And e.g. reading the specific resource content under the non-default language resource file corresponding to the Email.
If the purpose of obtaining the non-default language resource content is to perfect the resource content corresponding to the language, if it is uncertain whether the resource content corresponding to the simplified Chinese language under Email application is complete, whether omission exists or not, whether all key resource contents correspond to the translation text of the simplified Chinese language or not is required to be confirmed, or if the key resource contents are known to be incomplete, all key resource contents of the language need to be obtained to further perfect the translation text, and the translation text is generated. If only the translation text of the resource content in simplified Chinese is needed to be provided for the translation staff to translate other languages such as Japanese for reference, the translation staff is also required to output the resource content in simplified Chinese to the form.
S7: and reading the resource keywords and the corresponding values of the keywords corresponding to the non-default language resource content determined in the previous step.
S8: matching the resource keywords corresponding to the non-default language resource content with the resource keywords corresponding to the default language resource content screened in the step S4. This is based on the integrity of the default language resource content, and the missing resource keywords can be quickly obtained by comparison.
S9: and reading the resource keywords, the corresponding values of the keywords, the resource types, whether translation and languages are carried out or not and outputting the resource keywords, the corresponding values of the keywords, the resource types, whether translation and languages are carried out or not, which are successfully matched, to the form.
Specifically, by comparison, if the same keyword is found, the resource keyword and the corresponding value are output to the form; if the same keyword is not found, outputting blank content corresponding to the corresponding value position of the keyword, so as to intuitively indicate the resource needing to be translated. If the method is based on the reference requirement, only the resource content with the reference property can be output through matching, irrelevant content is removed, the simplicity of the form content is ensured, and meanwhile, the generation efficiency of the translation text is improved.
By the preferred implementation mode, the key resource content of other languages can be provided for reference at the same time when the requirements exist, and the development of translation work is facilitated; furthermore, the confirmation and perfection of the translation text of the original non-default language resource content can be realized, and the support of the application to the language is ensured.
In this embodiment, the method further includes a resource return process after translation is completed, where the process may include the following steps:
s10: acquiring a form file after translation is completed;
if the translation text only needs to correspond to the default language resource, the step is after the step S5; if there is a need to simultaneously provide non-default language resources, the above step S9 is followed.
S11: determining a corresponding resource folder according to the application corresponding to the form file; this step is used to make clear which application the translated text is the resource translation for.
S12: if the resource folder corresponding to the application determined in the previous step does not contain the non-default language resource file of the language corresponding to the translation completion, creating a new non-default language resource file corresponding to the language; and outputting each piece of resource content in the form file to a position corresponding to the non-default resource file according to the resource key words recorded in the form file.
S13: and if so, outputting each piece of resource content in the form file to a position corresponding to the non-default resource file according to the resource key words recorded in the form file.
Specifically, it is determined whether or not a language resource file corresponding to the target translation language exists under the application. Providing the resource content in simplified Chinese form for the corresponding Email application; if a resource file named as 'values-zh-rCN' is not built corresponding to the Chinese language of the simplified Chinese under the Email application in the android system, a resource file of a Chinese simplified folder is newly built under the resource folder under the Email application and is used for storing the resource content of the Chinese simplified, so that the support of the Chinese simplified is realized; and then outputs the translated content thereto. This case corresponds to the newly added support language.
Under the condition of perfecting the original supported language translation resource content, the resource file corresponding to the target translation language is necessarily existed under the application, so that each resource content in the form file is directly output to the position corresponding to the non-default resource file according to the resource key words recorded in the form file.
Specifically, the process of outputting the translation content in the form file to the corresponding resource file includes: and positioning the language resource folder and the language resource file which are required to be output by each resource through the Excel form name, the language keyword, the resource keyword and the item name (if the resource type is an array), and placing the resource back.
For example: (how to put back the resource type, key and corresponding value by way of example and for simplicity of explanation)
Examples:
splicing node contents of xml according to the read contents, such as:
< string name= "confirm_send" > Send Email, after all xml node trees are assembled, writing into Email/values/string. Xml file according to application name and language key, and completing put-back operation.
Therefore, after the translation is completed, the embodiment can automatically position according to the form content and correctly place the resource content back into the resource folder, thereby realizing automatic screening, output and input of the translation text.
In a preferred embodiment, analysis of resource files and screening of keywords are carried out through an xml.dom.miniom library based on Python language, so that automatic exporting of EXCEL files friendly to translators is realized, a large number of redundant character string resources are removed, and resources which do not need translation are screened; reading and writing an Excel file through a pyexcelator library, and accurately placing translated resources back into the android source code according to tag keywords. The steps S1-S12 are realized by a Python tool, so that the operation is convenient, and the treatment efficiency is extremely high; furthermore, the system also has cross-platform capability and very strong function expansion capability.
Example two
The present embodiment corresponds to the first embodiment, and provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, is capable of implementing all the steps included in the processing method for translating text of an internationalized resource file provided in the first embodiment. It will be appreciated by those skilled in the art that all or part of the flow in the technical solution implementing the first embodiment may be implemented by a computer program to instruct related hardware.
In summary, the processing method and the computer-readable storage medium for the translation text of the internationalized resource file provided by the invention are very friendly to translation personnel, and are beneficial to efficient development of translation work; the resource types are distinguished more carefully, the marking of key resources is realized, omission of the key resources is avoided, and translation integrity is ensured; irrelevant contents can be filtered, the translation workload is reduced, and the translation efficiency is obviously improved; the translated resource content can be accurately put back to the designated position, and the normal analysis of the system is ensured; the invention can obviously improve the realization efficiency and the realization accuracy of the resource multilingual support.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.
Claims (7)
1. The processing method of the internationalized resource file translation text is characterized by comprising the following steps:
creating a form corresponding to the application according to the application corresponding to the resource folder, wherein the header of the form comprises a resource keyword, a keyword corresponding value, a tag description and whether translation is performed or not, and the tag description corresponds to a resource type;
traversing a default language resource file under the resource folder according to a preset resource type, and reading corresponding default language resource content;
reading resource keywords corresponding to the default language resource content, corresponding values of the keywords, tag description and records of whether translation is performed or not to the form;
the header also comprises languages;
reading the language corresponding to the default language resource content from the form;
the processing method further comprises the following steps:
traversing the non-default language resource files under the resource folder according to the preset resource types, and reading the corresponding non-default language resource content;
reading resource keywords corresponding to the non-default language resource content;
matching the resource keywords corresponding to the non-default language resource content with the resource keywords corresponding to the default language resource content;
reading the resource keywords, the corresponding values of the keywords, the tag description, whether translation and languages are carried out or not and outputting the resource keywords, the corresponding values of the keywords, the tag description and the translation and languages to the form, wherein the resource keywords, the corresponding values of the keywords, the tag description, whether translation and languages are successfully matched with the non-default language resource contents are read;
the resource types include strings, arrays, complex numbers, and custom controls.
2. The method for processing translation text of an internationalized resource file according to claim 1,
if the default language resource content or the non-default language resource content corresponds to the transtable label content in the source code as false, recording the default language resource content or the non-default language resource content in the form as non-translation-needed or not outputting the related content of the default language resource content to the form.
3. The method for processing translation text of an internationalized resource file according to claim 1,
and (3) operating the processing method through a Python library to obtain a form in the EXCEL format.
4. The method for processing translation text of an internationalized resource file according to claim 1, further comprising:
acquiring a form file after translation is completed;
determining a corresponding resource folder according to the application corresponding to the form file;
if the corresponding resource folder does not contain the non-default language resource file of the language corresponding to the translation completion, creating a new non-default language resource file of the language;
and outputting each piece of resource content in the form file to a position corresponding to the non-default language resource file according to the resource key words recorded in the form file.
5. The method for processing the translation text of the internationalized resource file according to claim 4, further comprising:
and if so, outputting each piece of resource content in the form file to a position corresponding to the non-default language resource file according to the resource key words recorded in the form file.
6. The method for processing translation text of internationalized resource file according to claim 4, wherein in the step of reading the resource key word, the key word corresponding value, the tag description and the record of whether translation is performed or not corresponding to the default language resource content, and outputting the record to the form, if the resource type corresponding to the default language resource content is an array, it is also necessary to read item sequence numbers of the resource type corresponding to the default language resource content to the form at the same time;
and outputting the resource keywords and item sequence numbers corresponding to the default language resource content to corresponding positions during the step of outputting.
7. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps comprised in the method for processing translated text of an internationalized resource file as claimed in any one of the preceding claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810392114.3A CN110414010B (en) | 2018-04-27 | 2018-04-27 | Processing method of internationalized resource file translation text and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810392114.3A CN110414010B (en) | 2018-04-27 | 2018-04-27 | Processing method of internationalized resource file translation text and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110414010A CN110414010A (en) | 2019-11-05 |
CN110414010B true CN110414010B (en) | 2023-05-02 |
Family
ID=68346640
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810392114.3A Active CN110414010B (en) | 2018-04-27 | 2018-04-27 | Processing method of internationalized resource file translation text and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110414010B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111652003B (en) * | 2020-06-09 | 2023-08-15 | 广东小天才科技有限公司 | Language translation processing method, device, electronic equipment and medium |
CN112819419B (en) * | 2020-08-13 | 2023-03-21 | 厦门汉印电子技术有限公司 | Android application international language management method and system based on Git |
CN114201248B (en) * | 2020-09-17 | 2023-10-20 | 福建天泉教育科技有限公司 | Method and system for judging whether component needs translation |
CN115291876B (en) * | 2022-09-29 | 2023-03-17 | 安徽商信政通信息技术股份有限公司 | Form design tool construction method, system, electronic equipment and storage medium |
CN120181105B (en) * | 2025-05-20 | 2025-08-29 | 上海钢联电子商务股份有限公司 | Intelligent translation method and system based on translation form |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101216820A (en) * | 2008-01-17 | 2008-07-09 | 北京中星微电子有限公司 | Multi-language translation method and device |
CN101441567A (en) * | 2008-11-18 | 2009-05-27 | 宇龙计算机通信科技(深圳)有限公司 | Method and system for supporting multiple-language user interface in mobile terminal |
CN103617046A (en) * | 2013-12-12 | 2014-03-05 | 用友软件股份有限公司 | Method and device for scanning and extracting resources to be translated in target system source codes |
CN104317788A (en) * | 2014-11-03 | 2015-01-28 | 上海鼎讯电子有限公司 | Android multi-language translation method and device |
CN107357568A (en) * | 2017-06-12 | 2017-11-17 | 北京天健通泰科技有限公司 | A kind of original language replacement method based on multi-lingual label |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7509251B2 (en) * | 2002-12-23 | 2009-03-24 | International Business Machines Corporation | Mock translating software applications at runtime |
-
2018
- 2018-04-27 CN CN201810392114.3A patent/CN110414010B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101216820A (en) * | 2008-01-17 | 2008-07-09 | 北京中星微电子有限公司 | Multi-language translation method and device |
CN101441567A (en) * | 2008-11-18 | 2009-05-27 | 宇龙计算机通信科技(深圳)有限公司 | Method and system for supporting multiple-language user interface in mobile terminal |
CN103617046A (en) * | 2013-12-12 | 2014-03-05 | 用友软件股份有限公司 | Method and device for scanning and extracting resources to be translated in target system source codes |
CN104317788A (en) * | 2014-11-03 | 2015-01-28 | 上海鼎讯电子有限公司 | Android multi-language translation method and device |
CN107357568A (en) * | 2017-06-12 | 2017-11-17 | 北京天健通泰科技有限公司 | A kind of original language replacement method based on multi-lingual label |
Also Published As
Publication number | Publication date |
---|---|
CN110414010A (en) | 2019-11-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110414010B (en) | Processing method of internationalized resource file translation text and readable storage medium | |
US9507698B2 (en) | Test code generation based on test documentation | |
US7571092B1 (en) | Method and apparatus for on-demand localization of files | |
US7895576B2 (en) | Method for automating internationalization software testing | |
US7149971B2 (en) | Method, apparatus, and system for providing multi-language character strings within a computer | |
US10229115B2 (en) | System and method for creating an internationalized web application | |
US6574792B1 (en) | Dynamically generating expanded user messages in a computer system | |
US9690788B2 (en) | File type recognition analysis method and system | |
US7636656B1 (en) | Method and apparatus for synthesizing multiple localizable formats into a canonical format | |
US7103885B2 (en) | Comment driven processing | |
JP2009534743A (en) | How to parse unstructured resources | |
JP2007034813A (en) | Software description generation system for multiple natural languages | |
CN109710518A (en) | Script review method and device | |
CN104899010A (en) | Multilingualization method and system of source code | |
CN111144210A (en) | Image structuring processing method and device, storage medium and electronic equipment | |
US20030110175A1 (en) | Deploying predefined data warehouse process models | |
US20190278568A1 (en) | Recording medium recording generation program, information processing apparatus, and generation method | |
CN109947711B (en) | Automatic multi-language file management method in IOS project development process | |
US12242845B2 (en) | Development support device, non-transitory computer-readable medium, and development support method | |
US7730025B1 (en) | Migrating documents | |
CN101464875B (en) | Method for representing electronic dictionary catalog data by XML | |
CN117708385A (en) | Operation method and device of resource character string and electronic equipment | |
CN114035726B (en) | Method and system for robot flow automatic page element identification process | |
CN111443979A (en) | Document processing method and device, computer equipment and storage medium | |
JP6056489B2 (en) | Translation support program, method, and apparatus |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |