CN109062906A - The interpretation method and device of program language resource - Google Patents

The interpretation method and device of program language resource Download PDF

Info

Publication number
CN109062906A
CN109062906A CN201810622819.XA CN201810622819A CN109062906A CN 109062906 A CN109062906 A CN 109062906A CN 201810622819 A CN201810622819 A CN 201810622819A CN 109062906 A CN109062906 A CN 109062906A
Authority
CN
China
Prior art keywords
file
translated
resource
program language
mapping relation
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.)
Granted
Application number
CN201810622819.XA
Other languages
Chinese (zh)
Other versions
CN109062906B (en
Inventor
任利琴
涂勇策
陈曦骏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mobvoi Innovation Technology Co Ltd
Original Assignee
Chumen Wenwen Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chumen Wenwen Information Technology Co Ltd filed Critical Chumen Wenwen Information Technology Co Ltd
Priority to CN201810622819.XA priority Critical patent/CN109062906B/en
Publication of CN109062906A publication Critical patent/CN109062906A/en
Application granted granted Critical
Publication of CN109062906B publication Critical patent/CN109062906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the invention discloses the interpretation methods and device of a kind of program language resource, are related to technical field of data processing, improve the addition efficiency that the program language resource of different language type is added for the APP under android system.Main technical schemes of the embodiment of the present invention are as follows: receive resource translation request, include resource file to be translated and at least one object language type in resource translation request;The first mapping relations file is generated according to resource file to be translated and at least one object language type, and the first mapping relations file is subjected to output and is shown;It receives resource and generates request, it includes the second mapping relations file in request that resource, which generates,;According to the corresponding translated resources file of each object language type of the second mapping relations file generated, and translated resources file is subjected to output and is shown.The embodiment of the present invention is mainly used for adding the program language resource of different language type for the APP under android system.

Description

Translation method and device for program language resources
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a translation method and a translation device for program language resources.
Background
With the increasing development and wide Application of internet technology, mobile terminal devices have been developed rapidly, and users can install different apps (applications) in the mobile terminal devices in order to meet different requirements of the users. During the process of using APP, the user sets the program language of APP according to his own language preference, for example, the default program language of APP1 is chinese, and user a is german, then user a sets the program language of APP1 to german during the process of using APP 1. Therefore, it is important to add program language resources of different language types to the APP so that the APP can adapt to different language scenarios.
At present, when a worker adds program language resources of different language types to an APP in an Android system, the worker needs to obtain a plurality of program language resources to be translated in a target APP at first, then translate each program language resource to be translated into a program language resource corresponding to the target language type, and finally add the translated program language resource to the target APP.
The inventor finds that the following technical problems exist in the prior art in the process of implementing the invention, because a worker needs to manually acquire a plurality of program language resources to be translated in a target APP and manually add each translated program language resource to the target APP, when the number of the program language resources to be translated in the target APP is too large, the worker needs to perform a large amount of work, which consumes a large amount of time, and further causes that the adding efficiency of adding program language resources of different language types to the APP in the Android system is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for translating program language resources, and mainly aim to improve the adding efficiency of adding program language resources of different language types to an APP in an Android system.
In order to achieve the above purpose, the embodiments of the present invention mainly provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for translating a program language resource, where the method includes:
receiving a resource translation request, wherein the resource translation request comprises a resource file to be translated and at least one target language type, and the resource file to be translated comprises a plurality of program language resources to be translated;
generating a first mapping relation file according to the resource file to be translated and at least one target language type, and outputting and displaying the first mapping relation file, wherein the first mapping relation file comprises mapping relations between a plurality of program language resources to be translated and each target language type;
receiving a resource generation request, wherein the resource generation request comprises a second mapping relation file, and the second mapping relation file comprises a mapping relation between a plurality of translated program language resources corresponding to each target language type and each target language type;
and generating a translated resource file corresponding to each target language type according to the second mapping relation file, and outputting and displaying the translated resource files.
Optionally, the receiving a resource translation request includes:
receiving the resource translation request, wherein the resource translation request comprises a first compressed file and at least one target language type, and the first compressed file comprises the resource file to be translated;
decompressing the first compressed file, and filtering the resource file not to be translated to obtain the resource file to be translated.
Optionally, after the receiving the resource translation request, the method further includes:
judging whether the first compressed file is saved or not according to a suffix name corresponding to the first compressed file;
if so, determining a first storage position corresponding to the first compressed file according to a suffix name corresponding to the first compressed file;
the decompressing the first compressed file and filtering the resource file not to be translated to obtain the resource file to be translated includes:
obtaining the first compressed file at the first storage location;
decompressing the first compressed file;
and filtering the resource file which is not to be translated according to a preset rule to obtain the resource file to be translated.
Optionally, the resource file to be translated further includes a unique identifier corresponding to each program language resource to be translated; generating a first mapping relation file according to the resource file to be translated and at least one target language type, wherein the generating of the first mapping relation file comprises the following steps:
acquiring a plurality of program language resources to be translated and a unique identifier corresponding to each program language resource to be translated from the resource file to be translated;
and generating the first mapping relation file according to the plurality of program language resources to be translated, the unique identifier corresponding to each program language resource to be translated and at least one target language type.
Optionally, after receiving the resource generation request, the method further includes:
judging whether the second mapping relation file is stored or not according to a suffix name corresponding to the second mapping relation file;
and if so, determining a second storage position corresponding to the second mapping relation file according to the suffix name corresponding to the second mapping relation file.
Optionally, the second mapping relationship file further includes a unique identifier corresponding to each translated program language resource; generating a translated resource file corresponding to each target language type according to the second mapping relation file, including:
obtaining the second mapping relation file at the second storage position;
acquiring a plurality of translated program language resources corresponding to each target language type and a unique identifier corresponding to each translated program language resource in the second mapping relation file;
and generating a translated resource file corresponding to each target language type according to the plurality of translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource.
Optionally, after the translated resource file corresponding to each target language category is generated according to the second mapping relationship file, the method further includes:
carrying out fault tolerance inspection processing on the translated resource file through a preset regular expression;
and highlighting the errors in the translated resource files according to the fault tolerance inspection result.
Optionally, the outputting and displaying the translated resource file includes:
converting the translated resource file into a binary stream;
compressing the binary stream to obtain a second compressed file;
and outputting and displaying the second compressed file.
Optionally, the resource file to be translated and the translated resource file are XML files; the first mapping relation file and the second mapping relation file are Excel tables.
In a second aspect, an embodiment of the present invention further provides an apparatus for translating a program language resource, where the apparatus includes:
the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a resource translation request, the resource translation request comprises a resource file to be translated and at least one target language type, and the resource file to be translated comprises a plurality of program language resources to be translated;
a first generating unit, configured to generate a first mapping relationship file according to the resource file to be translated and the at least one target language type received by the first receiving unit, where the first mapping relationship file includes mapping relationships between multiple program language resources to be translated and each target language type;
the first output unit is used for outputting and displaying the first mapping relation file generated by the first generation unit;
a second receiving unit, configured to receive a resource generation request, where the resource generation request includes a second mapping relationship file, and the second mapping relationship file includes a mapping relationship between a plurality of translated program language resources corresponding to each target language category and each target language category;
a second generating unit, configured to generate a translated resource file corresponding to each target language type according to the second mapping relationship file received by the second receiving unit;
and the second output unit is used for outputting and displaying the translated resource file generated by the second generation unit.
Optionally, the first receiving unit includes:
a receiving module, configured to receive the resource translation request, where the resource translation request includes a first compressed file and at least one target language type, and the first compressed file includes the resource file to be translated;
and the filtering module is used for decompressing the first compressed file received by the receiving module and filtering the resource file which is not to be translated to obtain the resource file to be translated.
Optionally, the first receiving unit further includes:
the judging module is used for judging whether the first compressed file is stored or not according to a suffix name corresponding to the first compressed file after the receiving module receives the resource translation request;
the determining module is used for determining a first storage position corresponding to the first compressed file according to a suffix name corresponding to the first compressed file when the judging module judges that the first compressed file is stored;
the filtration module includes:
an obtaining sub-module, configured to obtain the first compressed file at the first storage location;
the decompression submodule is used for decompressing the first compressed file acquired by the acquisition submodule;
and the filtering submodule is used for filtering the resource file which is not to be translated according to a preset rule so as to obtain the resource file to be translated.
Optionally, the resource file to be translated further includes a unique identifier corresponding to each program language resource to be translated; the first generation unit includes:
the first obtaining module is used for obtaining a plurality of program language resources to be translated and a unique identifier corresponding to each program language resource to be translated from the resource file to be translated;
the first generating module is configured to generate the first mapping relationship file according to the plurality of to-be-translated program language resources acquired by the first acquiring module, the unique identifier corresponding to each to-be-translated program language resource, and the at least one target language type.
Optionally, the apparatus further comprises:
a judging unit, configured to, after the second receiving unit receives the resource generation request, judge whether to save the second mapping relationship file according to a suffix name corresponding to the second mapping relationship file;
and the determining unit is used for determining a second storage position corresponding to the second mapping relation file according to the suffix name corresponding to the second mapping relation file when the judging unit judges that the second mapping relation file is stored.
Optionally, the second mapping relationship file further includes a unique identifier corresponding to each translated program language resource; the second generation unit includes:
a second obtaining module, configured to obtain the second mapping relationship file at the second storage location;
a third obtaining module, configured to obtain, in the second mapping relationship file obtained by the second obtaining module, a plurality of translated program language resources corresponding to each target language type and a unique identifier corresponding to each translated program language resource;
and the second generation module is used for generating a translated resource file corresponding to each target language type according to the plurality of translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource.
Optionally, the apparatus further comprises:
the fault tolerance checking unit is used for carrying out fault tolerance checking processing on the translated resource files through a preset regular expression after the second generating unit generates the translated resource files corresponding to each target language type according to the second mapping relation file;
and the highlight display unit is used for highlighting the errors in the translated resource files according to the fault-tolerant check result.
Optionally, the second output unit includes:
the conversion module is used for converting the translated resource file into a binary stream;
the compression module is used for compressing the binary stream converted by the conversion module to obtain a second compressed file;
and the output module is used for outputting and displaying the second compressed file obtained by the compression module.
Optionally, the resource file to be translated and the translated resource file are XML files; the first mapping relation file and the second mapping relation file are Excel tables.
In a third aspect, an embodiment of the present invention further provides an electronic device, at least one processor;
and at least one memory, bus connected with the processor; wherein,
the processor and the memory complete mutual communication through the bus;
the processor is configured to call program instructions in the memory to execute the translation method of the program language resource according to any one of the first aspect.
In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method for translating a program language resource according to any one of the first aspect.
By the technical scheme, the technical scheme provided by the embodiment of the invention at least has the following advantages:
compared with the prior art in which a worker needs to manually acquire a plurality of program language resources to be translated in a target APP and needs to manually add each translated program language resource to the target APP, the method and the device for translating program language resources provided by the embodiment of the invention can generate a first mapping relation file containing mapping relations between the plurality of program language resources to be translated and each target language type after a server receives a resource file to be translated, which contains the plurality of program language resources to be translated, and at least one target language type corresponding to the target APP, and output and display the first mapping relation file, so that the worker can translate each program language resource to be translated in the target APP into a translated program language resource corresponding to each target language type according to the first mapping relation file to obtain a plurality of translated program language resources corresponding to each target language type and each target language type A second mapping relationship file of mapping relationships; and after receiving the second mapping relation file, the server can generate a translated resource file corresponding to each target language type according to the second mapping relation file, output and display are performed, and a worker can import the translated resource file into the target APP to realize that the program language resources of the target language type are added to the target APP, so that the worker does not need to manually acquire a plurality of program language resources to be translated in the target APP and manually add each translated program language resource into the target APP, and the adding efficiency of adding program language resources of different language types to the APP in the Android system is improved.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the embodiments of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the embodiments of the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flowchart illustrating a method for translating a program language resource according to an embodiment of the present invention;
FIG. 2 is a flowchart of another method for translating program language resources according to an embodiment of the present invention;
FIG. 3 is a block diagram illustrating an apparatus for translating a program language resource according to an embodiment of the present invention;
FIG. 4 is a block diagram illustrating an apparatus for translating program language resources according to another embodiment of the present invention;
fig. 5 shows a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
The embodiment of the invention provides a method for translating program language resources, which comprises the following steps of:
101. a resource translation request is received.
The resource translation request comprises a resource file to be translated and at least one target language type; the resource file to be translated includes a plurality of program language resources to be translated, and the resource file to be translated may be, but is not limited to: an XML file. The target language category may be, but is not limited to: german, french, japanese, korean, etc.
In the embodiment of the invention, for the APP in the Android system, a plurality of program language resources to be translated are stored in the APP in the form of XML files, and after obtaining a resource file to be translated corresponding to a target APP (i.e., an XML file containing a plurality of program language resources to be translated) from the target APP, a worker sends a resource translation request carrying the resource file to be translated and at least one target language type to a server through a client, and at this time, the server can receive the resource translation request.
It should be noted that, in the APP under the Android system, the existing program language resources are chinese program language resources and english program language resources, and therefore, the language type corresponding to the resource file to be translated is chinese or english, that is, the resource translation request received by the server includes the resource file to be translated having a language type of chinese and/or the resource file to be translated having a language type of english. In addition, the target language type included in the resource translation request may be one or multiple, and this is not specifically limited in the embodiment of the present invention.
102. And generating a first mapping relation file according to the resource file to be translated and at least one target language type, and outputting and displaying the first mapping relation file.
The first mapping relationship file includes mapping relationships between multiple program language resources to be translated and each target language category, and the first mapping relationship file may be, but is not limited to: excel table.
In the embodiment of the invention, after receiving a resource translation request containing a resource file to be translated and at least one target language type, a server generates a first mapping relation file containing mapping relations between a plurality of program language resources to be translated and each target language type according to the resource file to be translated containing the plurality of program language resources to be translated and the at least one target language type, and outputs and displays the generated first mapping relation file, so that a worker can translate each program language resource to be translated into a translated program language resource corresponding to each target language type after acquiring the first mapping relation file, thereby acquiring a second mapping relation file containing mapping relations between a plurality of translated program language resources corresponding to each target language type and each target language type.
103. A resource generation request is received.
The resource generation request comprises a second mapping relation file, and the second mapping relation file comprises the mapping relation between a plurality of translated program language resources corresponding to each target language type and each target language type; the second mapping relationship file has the same file type as the first mapping relationship file, and may be, but is not limited to: excel table.
In the embodiment of the present invention, after the server outputs and displays the generated first mapping relationship file, the staff translates each program language resource to be translated into the translated program language resource corresponding to each target language type, so as to obtain the second mapping relationship file including the mapping relationship between the plurality of translated program language resources corresponding to each target language type and each target language type, and sends the resource generation request carrying the second mapping relationship file to the server through the client, at this time, the server can receive the resource generation request.
104. And generating a translated resource file corresponding to each target language type according to the second mapping relation file, and outputting and displaying the translated resource files.
The translated resource file and the resource file to be translated have the same file type, and may be, but not limited to: an XML file.
In the embodiment of the present invention, after receiving a resource generation request including a second mapping relationship file, a server generates a translated resource file corresponding to each target language type according to a mapping relationship between a plurality of translated program language resources corresponding to each target language type included in the second mapping relationship file and each target language type, and outputs and displays the translated resource file, so that a worker directly imports the translated resource file corresponding to each target language type into a target APP after obtaining the translated resource file corresponding to each target language type, thereby adding program language resources of different language types to the target APP.
For the embodiment of the present invention, specific application scenarios may be as follows, but are not limited to these scenarios:
when a worker X needs to add program language resources with Japanese and German language types to APP1 in an Android system, firstly, obtaining a resource file A to be translated corresponding to APP1 from APP 1; then, the resource file A to be translated and the target language category are carried by the client: and sending resource translation requests of Japanese and German to a server, wherein the resource file A to be translated is an XML file containing a program language resource a to be translated with a Chinese language type, a program language resource b to be translated, a program language resource c to be translated and a program language resource d to be translated. After receiving a resource translation request sent by a worker X, the server, according to a resource file A to be translated and a target language type: generating a first mapping relation file B containing mapping relations between the program language resources a, B, c and d to be translated and the target language type (Japanese) and between the program language resources a, B, c and d to be translated and the target language type (German), and outputting and displaying the generated first mapping relation file B, wherein the first mapping relation file B is specifically shown in Table 1:
TABLE 1
Chinese character Japanese language German language
a
b
c
d
After obtaining the first mapping relationship file B, the worker X translates the program language resources a, B, c, d to be translated into the translated program language resources a1, B1, c1, d1 corresponding to the target language type (japanese), translates the program language resources a, B, c, d to be translated into the translated program language resources a2, B2, c2, d2 corresponding to the target language type (german), thereby obtaining a second mapping relation file C containing mapping relations between the translated program language resources a1, b1, C1, d1 and the target language class (Japanese) and between the translated program language resources a2, b2, C2, d2 and the target language class (German), and sending a resource generation request carrying a second mapping relation file C to the server through the client, wherein the second mapping relation file C is specifically shown in table 2:
TABLE 2
Chinese character Japanese language German language
a a1 a2
b b1 b2
c c1 c2
d d1 d2
The server generates a translated resource file D1 corresponding to the target language type (Japanese) and a translated resource file D2 corresponding to the target language type (German) based on the mapping relationship between the translated program language resources a1, b1, C1 and D1 and the target language type (Japanese) and the mapping relationship between the translated program language resources a2, b2, C2 and D2 and the target language type (German) included in the second mapping relationship file C when receiving the resource generation request transmitted by the staff X, and outputting and displaying the translated resource file D1 and the translated resource file D2, after obtaining the translated resource file D1 and the translated resource file D2 by the staff X, the translated resource file D1 and the translated resource file D2 may be directly imported into the APP1, thereby enabling the addition of programming language resources for the APP1 with language classes Japanese and German.
Compared with the prior art in which a worker needs to manually acquire a plurality of program language resources to be translated in a target APP and manually add each translated program language resource to the target APP, the method for translating program language resources provided by the embodiment of the invention can generate a first mapping relation file containing mapping relations between the plurality of program language resources to be translated and each target language type after a server receives a resource file to be translated corresponding to the target APP and containing the plurality of program language resources to be translated and at least one target language type, output and display the first mapping relation file, so that the worker can translate each program language resource to be translated in the target APP into a translated program language resource corresponding to each target language type according to the first mapping relation file to obtain a plurality of translated program language resources corresponding to each target language type and a translated program language resource corresponding to each target language type A second mapping relationship file of the system; and after receiving the second mapping relation file, the server can generate a translated resource file corresponding to each target language type according to the second mapping relation file, output and display are performed, and a worker can import the translated resource file into the target APP to realize that the program language resources of the target language type are added to the target APP, so that the worker does not need to manually acquire a plurality of program language resources to be translated in the target APP and manually add each translated program language resource into the target APP, and the adding efficiency of adding program language resources of different language types to the APP in the Android system is improved.
To be described in more detail below, an embodiment of the present invention provides another method for translating a program language resource, and in particular, a specific method for a server to generate a first mapping relationship file according to a resource file to be translated and at least one target language type, and a specific method for a server to generate a translated resource file corresponding to each target language type according to a second mapping relationship file, as shown in fig. 2 specifically, the method includes:
201. a resource translation request is received.
In the embodiment of the invention, after acquiring the resource file to be translated corresponding to the target APP from the target APP, a worker sends a resource translation request carrying the resource file to be translated and at least one target language type to a server through a client, and at this time, the server can receive the resource translation request. A detailed description of how the server receives the resource translation request will be given below.
(1) A resource translation request is received.
The resource translation request comprises a first compressed file and at least one target language type, and the first compressed file comprises a resource file to be translated; the resource file to be translated is an XML file.
In the embodiment of the invention, in order to reduce the data volume for transmission, a worker compresses the acquired resource file to be translated to acquire the first compressed file, and sends a resource translation request carrying the first compressed file and at least one target language type to the server through the client, and at this time, the server can receive the resource translation request.
(2) And judging whether the first compressed file is stored or not according to the suffix name corresponding to the first compressed file.
In the embodiment of the invention, after receiving a resource translation request, a server judges whether to store a first compressed file according to a suffix name of the first compressed file contained in the resource translation request, and when the server judges that the suffix name of the first compressed file is the suffix name corresponding to the compressed file, the server determines to store the first compressed file; when the server judges that the suffix name of the first compressed file is the suffix name corresponding to the uncompressed file, the first compressed file is determined to be abandoned, so that the situation that other files except the resource file to be translated are sent to the server by mistake through a resource translation request by workers, and processing resources and storage resources of the server are wasted can be avoided.
(3) And if so, determining a first storage position corresponding to the first compressed file according to the suffix name corresponding to the first compressed file.
In the embodiment of the invention, when the server judges that the suffix name of the first compressed file is the suffix name corresponding to the compressed file, namely determines to store the first compressed file, the server determines the first storage position corresponding to the first compressed file according to the suffix name corresponding to the first compressed file, and stores the first compressed file into the first storage position.
(4) And decompressing the first compressed file, and filtering the resource file which is not to be translated to obtain the resource file to be translated.
In the embodiment of the present invention, after the server stores the first compressed file in the first storage location, in order to obtain the resource file to be translated included in the first compressed file, first, the server needs to obtain the first compressed file at the first storage location; then, decompressing the first compressed file; and finally, filtering the resource files which are not to be translated and are obtained from the plurality of files after decompression processing according to a preset rule to obtain the resource files to be translated.
202. And generating a first mapping relation file according to the resource file to be translated and at least one target language type, and outputting and displaying the first mapping relation file.
In the embodiment of the invention, after obtaining the resource file to be translated, the server generates the first mapping relation file according to the resource file to be translated and at least one target language type, and outputs and displays the generated first mapping relation file. The following describes in detail how the server generates the first mapping relationship file according to the resource file to be translated and at least one target language category, and outputs and displays the first mapping relationship file.
(1) And acquiring a plurality of program language resources to be translated and a unique identifier corresponding to each program language resource to be translated from the resource file to be translated.
The resource file to be translated further includes a unique identifier corresponding to each program language resource to be translated, and the unique identifier corresponding to the program language resource to be translated may be, but is not limited to: and the StringName corresponding to the language resource of the program to be translated.
In the embodiment of the invention, after the server obtains the resource file to be translated, the server obtains a plurality of program language resources to be translated and the unique identifier corresponding to each program language resource to be translated from the resource file to be translated.
(2) And generating a first mapping relation file according to the plurality of program language resources to be translated, the unique identifier corresponding to each program language resource to be translated and at least one target language type, and outputting and displaying the first mapping relation file.
The first mapping relationship file may be, but is not limited to: excel table.
In the embodiment of the invention, after the server obtains a plurality of program language resources to be translated and the unique identifier corresponding to each program language resource to be translated from the resource file to be translated, generating a first mapping relation file containing the mapping relation between the plurality of program language resources to be translated with unique identifications and each target language type according to the plurality of program language resources to be translated, the unique identification corresponding to each program language resource to be translated and at least one target language type, and outputting and displaying the generated first mapping relation file, so that after the staff acquires the first mapping relation file, each program language resource to be translated is translated into the translated program language resource corresponding to each target language type, thereby obtaining a second mapping relation file containing mapping relations between the plurality of translated program language resources corresponding to each target language category and each target language category.
203. A resource generation request is received.
For step 203, the resource generation request may be received by referring to the description of the corresponding part in fig. 1, and details of the embodiment of the present invention will not be described here.
204. And judging whether to store the second mapping relation file according to the suffix name corresponding to the second mapping relation file.
In the embodiment of the invention, after receiving a resource generation request, a server judges whether to store a second mapping relation file according to a suffix name of the second mapping relation file contained in the resource generation request, and when the server judges that the suffix name of the second mapping relation file is a preset suffix name, the server determines to store the second mapping relation file; when the server judges that the suffix name of the second mapping relation file is a non-preset suffix name, the second mapping relation file is determined to be abandoned, so that the situation that other files except the second mapping relation file are sent to the server by mistake through a resource generation request by workers, and processing resources and storage resources of the server are wasted can be avoided.
It should be noted that, in the practical application process, the preset suffix name may be, but is not limited to: table suffix names, etc., which are not particularly limited in the embodiment of the present invention.
205. And if so, determining a second storage position corresponding to the second mapping relation file according to the suffix name corresponding to the second mapping relation file.
In the embodiment of the present invention, when the server determines that the suffix name of the second mapping relationship file is the preset suffix name, that is, determines to store the second mapping relationship file, the server determines the second storage location corresponding to the second mapping relationship file according to the suffix name corresponding to the second mapping relationship file, and stores the second mapping relationship file in the second storage location. It should be noted that, in an actual application process, the first storage location and the second storage location may be the same storage location or different storage locations, which is not specifically limited in this embodiment of the present invention.
206. And generating a translated resource file corresponding to each target language type according to the second mapping relation file.
In the embodiment of the present invention, after receiving the resource generation request including the second mapping relationship file, the server generates a translated resource file corresponding to each target language type according to the mapping relationship between the plurality of translated program language resources corresponding to each target language type included in the second mapping relationship file and each target language type. The following describes in detail how the server generates the translated resource file corresponding to each target language type according to the second mapping relationship file.
(1) And acquiring a second mapping relation file at a second storage position.
The second mapping relationship file may be, but is not limited to: excel table.
In the embodiment of the present invention, after the server stores the second mapping relationship file in the second storage location, the server first needs to acquire the second mapping relationship file in the second storage location, so as to generate the translated resource file corresponding to each target language type according to the second mapping relationship file in the following.
(2) And acquiring a plurality of translated program language resources corresponding to each target language type and a unique identifier corresponding to each translated program language resource in the second mapping relation file.
And the second mapping relation file also comprises a unique identifier corresponding to each translated program language resource.
In the embodiment of the present invention, after obtaining the second mapping relationship file, the server obtains, in the second mapping relationship file, a plurality of translated program language resources corresponding to each target language type and a unique identifier corresponding to each translated program language resource.
(3) And generating a translated resource file corresponding to each target language type according to the plurality of translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource.
Wherein the translated resource file is an XML file.
In the embodiment of the present invention, after obtaining the multiple translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource from the second mapping relationship file, the server generates a translated resource file corresponding to each target language type according to the multiple translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource.
Specifically, in this step, the server may substitute the plurality of translated program language resources corresponding to each target language category and the unique identifier corresponding to each translated program language resource into the preset template, so as to generate the translated resource file corresponding to each target language category, but is not limited thereto.
207. And carrying out fault tolerance check processing on the translated resource file corresponding to each target language type.
In the embodiment of the invention, in order to ensure the accuracy of the file format and the file content of the translated resource file, after the translated resource file corresponding to each target language type is generated according to the second mapping relation file, the server performs fault tolerance check processing on the translated resource file corresponding to each target language type through a preset regular expression, and highlights the error in each translated resource file according to the fault tolerance check result, so that after the translated resource file corresponding to each target language type is obtained, a worker modifies the error in the translated resource file according to the highlighted content in the translated resource file.
208. And outputting and displaying the translated resource file.
In the embodiment of the invention, after the server generates the translated resource file corresponding to each target language type according to the second mapping relation file, the translated resource file is output and displayed, so that after the translated resource file corresponding to each target language type is obtained, a worker can directly import the translated resource file corresponding to each target language type into the target APP, and program language resources of different language types are added to the target APP. A detailed description of how the server receives the resource translation request will be given below.
(1) The translated resource file is converted to a binary stream.
In the embodiment of the present invention, in order to reduce the amount of data to be transmitted, the server first converts the translated resource files corresponding to each target language category into corresponding binary streams.
(2) And compressing the binary stream to obtain a second compressed file.
In the embodiment of the invention, after obtaining the binary stream corresponding to each translated resource file, the server compresses the multiple binary streams to obtain the second compressed files corresponding to the multiple binary streams.
(3) And outputting and displaying the second compressed file.
In the embodiment of the invention, after obtaining the second compressed file, the server outputs and displays the second compressed file, so that after obtaining the second compressed file, a worker obtains the translated resource file corresponding to each target language type according to the second compressed file, and introduces the translated resource file corresponding to each target language type into the target APP, thereby adding program language resources of different language types to the target APP.
Further, as an implementation of the methods shown in fig. 1 and fig. 2, an embodiment of the present invention provides a device for translating a program language resource. The embodiment of the apparatus corresponds to the embodiment of the method, and for convenience of reading, details in the embodiment of the apparatus are not repeated one by one, but it should be clear that the apparatus in the embodiment can correspondingly implement all the contents in the embodiment of the method. The device is applied to and improves the interpolation efficiency that adds the program language resource of different language types for APP under the Android system, specifically as shown in fig. 3, the device includes:
a first receiving unit 31, configured to receive a resource translation request, where the resource translation request includes a resource file to be translated and at least one target language category, the resource file to be translated includes a plurality of program language resources to be translated, and the resource file to be translated may include, but is not limited to: an XML file. The target language category may be, but is not limited to: german, french, japanese, korean, etc.;
a first generating unit 32, configured to generate a first mapping relationship file according to the resource file to be translated and the at least one target language category received by the first receiving unit 31, where the first mapping relationship file includes mapping relationships between a plurality of program language resources to be translated and each target language category, and the first mapping relationship file may be, but is not limited to: excel table;
the first output unit 33 is configured to output and display the first mapping relationship file generated by the first generating unit 32, so that after the staff acquires the first mapping relationship file, each to-be-translated program language resource is translated into a translated program language resource corresponding to each target language type, and thus a second mapping relationship file including a mapping relationship between a plurality of translated program language resources corresponding to each target language type and each target language type is acquired;
a second receiving unit 34, configured to receive a resource generation request, where the resource generation request includes a second mapping relationship file, the second mapping relationship file includes a mapping relationship between a plurality of translated program language resources corresponding to each target language category and each target language category, and the second mapping relationship file is the same as the first mapping relationship file in file type, and may be, but is not limited to: excel table;
the second generating unit 35 is configured to generate, according to the second mapping relationship file received by the second receiving unit 34, a translated resource file corresponding to each target language category, where the translated resource file has the same file type as the resource file to be translated, and may be, but is not limited to: an XML file;
and the second output unit 36 is configured to output and display the translated resource files generated by the second generating unit 35, so that after obtaining the translated resource files corresponding to each target language type, a worker directly imports the translated resource files corresponding to each target language type into the target APP, thereby adding program language resources of different language types to the target APP.
Further, as shown in fig. 4, the first receiving unit 31 includes:
a receiving module 311, configured to receive the resource translation request, where the resource translation request includes a first compressed file and at least one target language type, the first compressed file includes the resource file to be translated, and the resource file to be translated is an XML file;
the filtering module 312 is configured to decompress the first compressed file received by the receiving module 311, and filter a resource file that is not to be translated, so as to obtain the resource file to be translated.
Further, as shown in fig. 4, the first receiving unit 31 further includes:
a determining module 313, configured to determine whether to store the first compressed file according to a suffix name corresponding to the first compressed file after the receiving module 311 receives the resource translation request;
a determining module 314, configured to determine, when the determining module 313 determines to save the first compressed file, a first storage location corresponding to the first compressed file according to a suffix name corresponding to the first compressed file;
the filtering module 312 includes:
an obtaining sub-module 3121, configured to obtain the first compressed file at the first storage location;
the decompression submodule 3122 is configured to decompress the first compressed file acquired by the acquisition submodule 3121;
and the filtering submodule 3123 is configured to filter the resource file not to be translated according to a preset rule, so as to obtain the resource file to be translated.
Further, as shown in fig. 4, the resource file to be translated further includes a unique identifier corresponding to each program language resource to be translated; the first generation unit 32 includes:
the first obtaining module 321 is configured to obtain, in the resource file to be translated, a plurality of program language resources to be translated and a unique identifier corresponding to each program language resource to be translated, where the unique identifier corresponding to a program language resource to be translated may be, but is not limited to: the String Name corresponding to the language resource of the program to be translated;
a first generating module 322, configured to generate the first mapping relationship file according to the multiple program language resources to be translated, the unique identifier corresponding to each program language resource to be translated, and the at least one target language category, which are acquired by the first acquiring module 321, where the first mapping relationship file may be, but is not limited to: excel table.
Further, as shown in fig. 4, the apparatus further includes:
a judging unit 37, configured to, after the second receiving unit 34 receives the resource generation request, judge whether to save the second mapping relationship file according to a suffix name corresponding to the second mapping relationship file;
the determining unit 38 is configured to determine, when the determining unit 37 determines to store the second mapping relationship file, a second storage location corresponding to the second mapping relationship file according to a suffix name corresponding to the second mapping relationship file, and in an actual application process, the first storage location and the second storage location may be the same storage location or different storage locations.
Further, as shown in fig. 4, the second mapping relationship file further includes a unique identifier corresponding to each translated program language resource; the second generation unit 35 includes:
a second obtaining module 351, configured to obtain the second mapping relationship file at the second storage location, where the second mapping relationship file may be, but is not limited to: excel table;
a third obtaining module 352, configured to obtain, in the second mapping relationship file obtained by the second obtaining module 351, a plurality of translated program language resources corresponding to each target language category and a unique identifier corresponding to each translated program language resource;
the second generating module 353 generates a translated resource file corresponding to each target language type according to the plurality of translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource, where the translated resource file is an XML file.
Further, as shown in fig. 4, the apparatus further includes:
the fault tolerance checking unit 39 is configured to perform fault tolerance checking on the translated resource files through a preset regular expression after the second generating unit 35 generates the translated resource files corresponding to each target language type according to the second mapping relationship file;
and the highlight display unit 310 is configured to highlight the error in the translated resource file according to the fault tolerance check result, so that after the translated resource file corresponding to each target language type is obtained, the worker modifies the error in the translated resource file according to the highlighted content in the translated resource file.
Further, as shown in fig. 4, the second output unit 36 includes:
a conversion module 361, configured to convert the translated resource file into a binary stream;
a compressing module 362, configured to perform compression processing on the binary stream converted by the converting module 361 to obtain a second compressed file;
and the output module 363 is configured to output and display the second compressed file obtained by the compression module 362, so that after obtaining the second compressed file, a worker obtains the translated resource file corresponding to each target language type according to the second compressed file, and introduces the translated resource file corresponding to each target language type into the target APP, thereby adding program language resources of different language types to the target APP.
Further, as shown in fig. 4, the resource file to be translated and the translated resource file are XML files; the first mapping relation file and the second mapping relation file are Excel tables.
Since the apparatus for translating a program language resource described in this embodiment is an apparatus capable of executing the method for translating a program language resource in the embodiment of the present invention, based on the method for translating a program language resource described in the embodiment of the present invention, a person skilled in the art can understand the specific implementation of the apparatus for translating a program language resource in this embodiment and various variations thereof, so how the apparatus for translating a program language resource realizes the method for translating a program language resource in the embodiment of the present invention is not described in detail herein. The scope of the present application is intended to be covered by the claims as long as the skilled person can implement the apparatus for translating the program language resource in the embodiments of the present invention.
Compared with the prior art in which a worker needs to manually acquire a plurality of program language resources to be translated in a target APP and needs to manually add each translated program language resource to the target APP, the method and the device for translating program language resources provided by the embodiment of the invention can generate a first mapping relation file containing mapping relations between the plurality of program language resources to be translated and each target language type after a server receives a resource file to be translated, which contains the plurality of program language resources to be translated, and at least one target language type corresponding to the target APP, and output and display the first mapping relation file, so that the worker can translate each program language resource to be translated in the target APP into a translated program language resource corresponding to each target language type according to the first mapping relation file to obtain a plurality of translated program language resources corresponding to each target language type and each target language type A second mapping relationship file of mapping relationships; after receiving the second mapping relation file, the server can generate a translated resource file corresponding to each target language type according to the second mapping relation file, output and display the translated resource file, and a worker can import the translated resource file into a target APP to realize that program language resources of the target language type are added to the target APP, so that the worker does not need to manually acquire a plurality of program language resources to be translated in the target APP and manually add each translated program language resource into the target APP, and the adding efficiency of adding program language resources of different language types to the APP in the Android system is improved; in addition, the embodiment of the invention can also carry out fault tolerance inspection on the generated translated resource file through the preset regular expression and highlight the error in the translated resource file according to the fault tolerance inspection result, so that after the translated resource file is obtained, a worker can modify the error in the translated resource file according to the highlighted content, and the accuracy of the generated translated resource file can be further ensured.
The device for translating the program language resources comprises a processor and a memory, wherein the first receiving unit, the first generating unit, the first output unit, the second receiving unit, the second generating unit, the second output unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the adding efficiency of adding different language types of program language resources to the APP in the Android system is improved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a non-transitory computer-readable storage medium, which stores computer instructions for causing a computer to execute the method for translating a program language resource described in the above embodiment.
An embodiment of the present invention provides an electronic device, as shown in fig. 5, including:
at least one processor 41;
and at least one memory 42, a bus 43 connected to said processor 41; wherein,
the processor 41 and the memory 42 complete mutual communication through the bus 43;
the processor 41 is configured to call program instructions in the memory 42 to perform the following steps:
receiving a resource translation request, wherein the resource translation request comprises a resource file to be translated and at least one target language type, and the resource file to be translated comprises a plurality of program language resources to be translated;
generating a first mapping relation file according to the resource file to be translated and at least one target language type, and outputting and displaying the first mapping relation file, wherein the first mapping relation file comprises mapping relations between a plurality of program language resources to be translated and each target language type;
receiving a resource generation request, wherein the resource generation request comprises a second mapping relation file, and the second mapping relation file comprises a mapping relation between a plurality of translated program language resources corresponding to each target language type and each target language type;
and generating a translated resource file corresponding to each target language type according to the second mapping relation file, and outputting and displaying the translated resource files.
Further, the receiving a resource translation request includes:
receiving the resource translation request, wherein the resource translation request comprises a first compressed file and at least one target language type, and the first compressed file comprises the resource file to be translated;
decompressing the first compressed file, and filtering the resource file not to be translated to obtain the resource file to be translated.
Further, after the receiving the resource translation request, the method further comprises:
judging whether the first compressed file is saved or not according to a suffix name corresponding to the first compressed file;
if so, determining a first storage position corresponding to the first compressed file according to a suffix name corresponding to the first compressed file;
the decompressing the first compressed file and filtering the resource file not to be translated to obtain the resource file to be translated includes:
obtaining the first compressed file at the first storage location;
decompressing the first compressed file;
and filtering the resource file which is not to be translated according to a preset rule to obtain the resource file to be translated.
Further, the resource file to be translated also includes a unique identifier corresponding to each program language resource to be translated; generating a first mapping relation file according to the resource file to be translated and at least one target language type, wherein the generating of the first mapping relation file comprises the following steps:
acquiring a plurality of program language resources to be translated and a unique identifier corresponding to each program language resource to be translated from the resource file to be translated;
and generating the first mapping relation file according to the plurality of program language resources to be translated, the unique identifier corresponding to each program language resource to be translated and at least one target language type.
Further, after receiving the resource generation request, the method further includes:
judging whether the second mapping relation file is stored or not according to a suffix name corresponding to the second mapping relation file;
and if so, determining a second storage position corresponding to the second mapping relation file according to the suffix name corresponding to the second mapping relation file.
Further, the second mapping relationship file also contains a unique identifier corresponding to each translated program language resource; generating a translated resource file corresponding to each target language type according to the second mapping relation file, including:
obtaining the second mapping relation file at the second storage position;
acquiring a plurality of translated program language resources corresponding to each target language type and a unique identifier corresponding to each translated program language resource in the second mapping relation file;
and generating a translated resource file corresponding to each target language type according to the plurality of translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource.
Further, after the translated resource file corresponding to each target language category is generated according to the second mapping relationship file, the method further includes:
carrying out fault tolerance inspection processing on the translated resource file through a preset regular expression;
and highlighting the errors in the translated resource files according to the fault tolerance inspection result.
Further, the outputting and displaying the translated resource file includes:
converting the translated resource file into a binary stream;
compressing the binary stream to obtain a second compressed file;
and outputting and displaying the second compressed file.
Further, the resource file to be translated and the translated resource file are XML files; the first mapping relation file and the second mapping relation file are Excel tables.
The electronic device in the embodiment of the present invention may be a PC, a server, or the like.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device: receiving a resource translation request, wherein the resource translation request comprises a resource file to be translated and at least one target language type, and the resource file to be translated comprises a plurality of program language resources to be translated; generating a first mapping relation file according to the resource file to be translated and at least one target language type, and outputting and displaying the first mapping relation file, wherein the first mapping relation file comprises mapping relations between a plurality of program language resources to be translated and each target language type; receiving a resource generation request, wherein the resource generation request comprises a second mapping relation file, and the second mapping relation file comprises a mapping relation between a plurality of translated program language resources corresponding to each target language type and each target language type; and generating a translated resource file corresponding to each target language type according to the second mapping relation file, and outputting and displaying the translated resource files.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for translating a programming language resource, the method comprising:
receiving a resource translation request, wherein the resource translation request comprises a resource file to be translated and at least one target language type, and the resource file to be translated comprises a plurality of program language resources to be translated;
generating a first mapping relation file according to the resource file to be translated and at least one target language type, and outputting and displaying the first mapping relation file, wherein the first mapping relation file comprises mapping relations between a plurality of program language resources to be translated and each target language type;
receiving a resource generation request, wherein the resource generation request comprises a second mapping relation file, and the second mapping relation file comprises a mapping relation between a plurality of translated program language resources corresponding to each target language type and each target language type;
and generating a translated resource file corresponding to each target language type according to the second mapping relation file, and outputting and displaying the translated resource files.
2. The method of claim 1, wherein receiving a resource translation request comprises:
receiving the resource translation request, wherein the resource translation request comprises a first compressed file and at least one target language type, and the first compressed file comprises the resource file to be translated;
decompressing the first compressed file, and filtering the resource file not to be translated to obtain the resource file to be translated.
3. The method of claim 2, wherein after said receiving the resource translation request, the method further comprises:
judging whether the first compressed file is saved or not according to a suffix name corresponding to the first compressed file;
if so, determining a first storage position corresponding to the first compressed file according to a suffix name corresponding to the first compressed file;
the decompressing the first compressed file and filtering the resource file not to be translated to obtain the resource file to be translated includes:
obtaining the first compressed file at the first storage location;
decompressing the first compressed file;
and filtering the resource file which is not to be translated according to a preset rule to obtain the resource file to be translated.
4. The method according to claim 1, wherein the resource file to be translated further includes a unique identifier corresponding to each of the program language resources to be translated; generating a first mapping relation file according to the resource file to be translated and at least one target language type, wherein the generating of the first mapping relation file comprises the following steps:
acquiring a plurality of program language resources to be translated and a unique identifier corresponding to each program language resource to be translated from the resource file to be translated;
and generating the first mapping relation file according to the plurality of program language resources to be translated, the unique identifier corresponding to each program language resource to be translated and at least one target language type.
5. The method of claim 1, wherein after the receiving a resource generation request, the method further comprises:
judging whether the second mapping relation file is stored or not according to a suffix name corresponding to the second mapping relation file;
and if so, determining a second storage position corresponding to the second mapping relation file according to the suffix name corresponding to the second mapping relation file.
6. The method according to claim 5, wherein the second mapping relationship file further contains a unique identifier corresponding to each of the translated program language resources; generating a translated resource file corresponding to each target language type according to the second mapping relation file, including:
obtaining the second mapping relation file at the second storage position;
acquiring a plurality of translated program language resources corresponding to each target language type and a unique identifier corresponding to each translated program language resource in the second mapping relation file;
and generating a translated resource file corresponding to each target language type according to the plurality of translated program language resources corresponding to each target language type and the unique identifier corresponding to each translated program language resource.
7. The method according to claim 1, wherein after generating the translated resource file corresponding to each of the target language classes according to the second mapping relationship file, the method further comprises:
carrying out fault tolerance inspection processing on the translated resource file through a preset regular expression;
and highlighting the errors in the translated resource files according to the fault tolerance inspection result.
8. An apparatus for translating a program language resource, the apparatus comprising:
the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a resource translation request, the resource translation request comprises a resource file to be translated and at least one target language type, and the resource file to be translated comprises a plurality of program language resources to be translated;
a first generating unit, configured to generate a first mapping relationship file according to the resource file to be translated and the at least one target language type received by the first receiving unit, where the first mapping relationship file includes mapping relationships between multiple program language resources to be translated and each target language type;
the first output unit is used for outputting and displaying the first mapping relation file generated by the first generation unit;
a second receiving unit, configured to receive a resource generation request, where the resource generation request includes a second mapping relationship file, and the second mapping relationship file includes a mapping relationship between a plurality of translated program language resources corresponding to each target language category and each target language category;
a second generating unit, configured to generate a translated resource file corresponding to each target language type according to the second mapping relationship file received by the second receiving unit;
and the second output unit is used for outputting and displaying the translated resource file generated by the second generation unit.
9. An electronic device, comprising:
at least one processor;
and at least one memory, bus connected with the processor; wherein,
the processor and the memory complete mutual communication through the bus;
the processor is configured to call the program instructions in the memory to execute the translation method of the program language resource according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method for translating a program language resource according to any one of claims 1 to 7.
CN201810622819.XA 2018-06-15 2018-06-15 Translation method and device for program language resources Active CN109062906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810622819.XA CN109062906B (en) 2018-06-15 2018-06-15 Translation method and device for program language resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810622819.XA CN109062906B (en) 2018-06-15 2018-06-15 Translation method and device for program language resources

Publications (2)

Publication Number Publication Date
CN109062906A true CN109062906A (en) 2018-12-21
CN109062906B CN109062906B (en) 2022-07-01

Family

ID=64820370

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810622819.XA Active CN109062906B (en) 2018-06-15 2018-06-15 Translation method and device for program language resources

Country Status (1)

Country Link
CN (1) CN109062906B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990108A (en) * 2019-12-24 2020-04-10 中国银行股份有限公司 Entry translation method and device applied to multi-language APP
CN111160045A (en) * 2019-12-27 2020-05-15 苏州亿歌网络科技有限公司 Game resource file translation method, device and equipment
CN112906404A (en) * 2021-04-26 2021-06-04 腾讯音乐娱乐科技(深圳)有限公司 Translation document verification method, electronic device and readable storage medium
CN114518920A (en) * 2020-11-20 2022-05-20 浙江宇视科技有限公司 Web language display method, device, medium and electronic equipment based on APP hybrid development

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693221A (en) * 2011-08-29 2012-09-26 新奥特(北京)视频技术有限公司 Method and system for converting resource file language
US20120265518A1 (en) * 2011-04-15 2012-10-18 Andrew Nelthropp Lauder Software Application for Ranking Language Translations and Methods of Use Thereof
US20130185703A1 (en) * 2012-01-17 2013-07-18 Texas Instruments Incorporated Systems and methods for software instruction translation from a high-level language to a specialized instruction set
CN103309647A (en) * 2012-03-08 2013-09-18 鸿富锦精密工业(深圳)有限公司 Application program multi-language support system and method
CN104317788A (en) * 2014-11-03 2015-01-28 上海鼎讯电子有限公司 Android multi-language translation method and device
CN107451128A (en) * 2017-08-04 2017-12-08 深圳Tcl新技术有限公司 Multilingual code adaptation method, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120265518A1 (en) * 2011-04-15 2012-10-18 Andrew Nelthropp Lauder Software Application for Ranking Language Translations and Methods of Use Thereof
CN102693221A (en) * 2011-08-29 2012-09-26 新奥特(北京)视频技术有限公司 Method and system for converting resource file language
US20130185703A1 (en) * 2012-01-17 2013-07-18 Texas Instruments Incorporated Systems and methods for software instruction translation from a high-level language to a specialized instruction set
CN103309647A (en) * 2012-03-08 2013-09-18 鸿富锦精密工业(深圳)有限公司 Application program multi-language support system and method
CN104317788A (en) * 2014-11-03 2015-01-28 上海鼎讯电子有限公司 Android multi-language translation method and device
CN107451128A (en) * 2017-08-04 2017-12-08 深圳Tcl新技术有限公司 Multilingual code adaptation method, equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990108A (en) * 2019-12-24 2020-04-10 中国银行股份有限公司 Entry translation method and device applied to multi-language APP
CN111160045A (en) * 2019-12-27 2020-05-15 苏州亿歌网络科技有限公司 Game resource file translation method, device and equipment
CN111160045B (en) * 2019-12-27 2021-03-23 苏州亿歌网络科技有限公司 Game resource file translation method, device and equipment
CN114518920A (en) * 2020-11-20 2022-05-20 浙江宇视科技有限公司 Web language display method, device, medium and electronic equipment based on APP hybrid development
CN112906404A (en) * 2021-04-26 2021-06-04 腾讯音乐娱乐科技(深圳)有限公司 Translation document verification method, electronic device and readable storage medium
CN112906404B (en) * 2021-04-26 2023-10-13 腾讯音乐娱乐科技(深圳)有限公司 Translation document verification method, electronic device, and readable storage medium

Also Published As

Publication number Publication date
CN109062906B (en) 2022-07-01

Similar Documents

Publication Publication Date Title
CN109062906B (en) Translation method and device for program language resources
CN107562467B (en) Page rendering method, device and equipment
CN108156022B (en) Service calling method and device and electronic equipment
CN110020353B (en) Method and device for constructing webpage form
CN112579118B (en) Method, device, system, medium and equipment for updating configuration information of micro-service
CN107479868B (en) Interface loading method, device and equipment
CN108363588B (en) Method for realizing interaction between web and native function, electronic device and readable storage medium
CN110362547B (en) Method and device for encoding, analyzing and storing log file
CN110362792B (en) Method and device for converting RN file into applet file and conversion equipment
CN111464598A (en) Data pushing method and device
CN111818175A (en) Enterprise service bus configuration file generation method, device, equipment and storage medium
CN112947900B (en) Web application development method and device, server and development terminal
CN113672224A (en) Method and device for generating small program page code and computer equipment
CN115544304A (en) File analysis method and device, readable storage medium and file analysis equipment
CN110020343B (en) Method and device for determining webpage coding format
CN112733510A (en) Financial certificate generation method, device, equipment and computer readable storage medium
CN109814916B (en) IVR flow configuration method, device, storage medium and server
CN112491943A (en) Data request method, device, storage medium and electronic equipment
CN113051202A (en) Interface adaptation method, device, electronic equipment and computer readable storage medium
CN109068286B (en) Information analysis method, medium and equipment
CN112948474A (en) Data export method, device, equipment and computer readable storage medium
CN116303622A (en) Database query method, device, equipment and storage medium
CN114124883B (en) Data access method and device based on cloud storage address, computer equipment and medium
CN116049114A (en) Processing method, processor and storage medium for internationalization log
CN110134843B (en) Target file generation method and device

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
TA01 Transfer of patent application right

Effective date of registration: 20220614

Address after: 210034 floor 8, building D11, Hongfeng Science Park, Nanjing Economic and Technological Development Zone, Jiangsu Province

Applicant after: New Technology Co.,Ltd.

Address before: 100094 1001, 10th floor, office building a, 19 Zhongguancun Street, Haidian District, Beijing

Applicant before: MOBVOI INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant