CN111988384B - Information transmission method and device, electronic equipment and storage medium - Google Patents

Information transmission method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111988384B
CN111988384B CN202010796786.8A CN202010796786A CN111988384B CN 111988384 B CN111988384 B CN 111988384B CN 202010796786 A CN202010796786 A CN 202010796786A CN 111988384 B CN111988384 B CN 111988384B
Authority
CN
China
Prior art keywords
target
translation
service
mapping relation
language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010796786.8A
Other languages
Chinese (zh)
Other versions
CN111988384A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010796786.8A priority Critical patent/CN111988384B/en
Publication of CN111988384A publication Critical patent/CN111988384A/en
Application granted granted Critical
Publication of CN111988384B publication Critical patent/CN111988384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/55Rule-based translation
    • 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

Abstract

The application discloses an information transmission method, an information transmission device, electronic equipment and a storage technology, and relates to the technical field of API (application program interface) gateways, intelligent search and information flow. The specific implementation scheme is as follows: acquiring original service response information sent to a client by an API (application program interface) server; acquiring target translation service content of a target conversion language matched with the target service content; and generating new service response information according to the target translation service content, and sending the new service response information to the client. According to the scheme, the problems that each API server carries out international processing on the original service response information according to languages, configuration is complex, maintenance is difficult, repeated development is carried out, irrelevant logic except business is increased, and system complexity is increased are solved, conversion of the original service information is achieved at the API gateway, configuration is simple, repeated development is not needed, irrelevant logic except business is not increased, and system complexity is not increased.

Description

Information transmission method and device, electronic equipment and storage medium
Technical Field
The present Application relates to the field of computer technologies, and in particular, to an Application Programming Interface (API) gateway, an intelligent search and information flow technology, and in particular, to an information transmission method and apparatus, an electronic device, and a storage medium.
Background
The API gateway is one of the basic services in the microservice architecture, and in the microservice architecture, the API gateway serves as a unified gateway for traffic and processes all requests and responses.
At present, for partial interface response results of the API server, especially error prompt type response results, the API server is required to internationally process response contents, that is, content information of corresponding languages is displayed according to the language used by the user.
Although each API server can carry out internationalization processing on the response result according to the language, the configuration is complex, the maintenance is difficult, the repeated development is realized, irrelevant logic except for business is increased, and the system complexity is increased.
Disclosure of Invention
The application provides an information transmission method, an information transmission device, information transmission equipment and a storage medium.
According to an aspect of the present application, there is provided an information transmission method applied to an API gateway, including:
acquiring original service response information sent by an API (application programming interface) server to a client, wherein the original service response information comprises target service content in a standard language and a target conversion language matched with the client;
acquiring target translation service content of the target conversion language matched with the target service content;
and generating new service response information according to the target translation service content, and sending the new service response information to the client.
According to another aspect of the present application, there is provided an information transmission method applied to an application program interface API server, including:
acquiring a service request of a target conversion language sent by a client, wherein the service request is forwarded and acquired through an API gateway;
converting the service request into a standard service request in a standard language according to a preset translation rule, and generating target service content in the standard language according to the standard service request;
generating original service response information according to the target service content of the standard language, wherein the original service response information comprises: target service content in a standard language and a target conversion language matched with the client;
sending the original service response information to an API gateway;
the API gateway is used for converting the target service content of the standard language in the original service response information into the target translation service content of the target conversion language and sending the new service response information generated by conversion to the client.
According to another aspect of the present application, there is provided an information transmission apparatus applied to an API gateway, including:
the system comprises an original service response information acquisition module, a service conversion module and a service conversion module, wherein the original service response information acquisition module is used for acquiring original service response information sent by an API (application programming interface) server to a client, and the original service response information comprises target service content in a standard language and a target conversion language matched with the client;
the target translation service content acquisition module is used for acquiring the target translation service content of the target conversion language matched with the target service content;
and the new service response information sending module is used for generating new service response information according to the target translation service content and sending the new service response information to the client.
According to another aspect of the present application, there is provided an information transmission apparatus applied to an API server, including:
the service request acquisition module is used for acquiring a service request of a target conversion language sent by a client, and the service request is forwarded and acquired through an API gateway;
the service request conversion module is used for converting the service request into a standard service request in a standard language according to a preset translation rule and generating target service content in the standard language according to the standard service request;
an original service response information generating module, configured to generate original service response information according to the target service content in the standard language, where the original service response information includes: target service content in a standard language and a target conversion language matched with the client;
the original service response information sending module is used for sending the original service response information to the API gateway;
the API gateway is used for converting the target service content of the standard language in the original service response information into the target translation service content of the target conversion language and sending the new service response information generated by conversion to the client.
According to another aspect of the present application, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of information transfer as described in any of the embodiments herein.
According to another aspect of the present application, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the information transmission method according to any one of the embodiments of the present application.
According to the technology of the application, the conversion of the original service information is realized in the API gateway, the configuration is simple, repeated development is not needed, irrelevant logic except business is not increased, and the complexity of a system is not increased.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a schematic diagram of an information transmission method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an information transmission method according to an embodiment of the present application;
FIG. 3a is a schematic diagram of an information transmission method according to an embodiment of the present application;
FIG. 3b is a diagram illustrating a translation of a service content in a standard language according to a direct mapping relationship according to an embodiment of the present application;
FIG. 3c is a schematic diagram illustrating a translation of a service content in a standard language according to a regular matching mapping relationship according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an information transmission method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an information transmission method according to an embodiment of the present application;
FIG. 6 is a block diagram of an information transmission apparatus according to an embodiment of the present application;
FIG. 7 is a block diagram of an information transfer device according to an embodiment of the present application;
fig. 8 is a block diagram of an electronic device for implementing the information transmission method according to the embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of an information transmission method according to an embodiment of the present application, where the present embodiment is suitable for a case where service response information is converted and transmitted through an API gateway, and the method may be executed by an information transmission apparatus, where the apparatus may be implemented in a software and/or hardware manner, and is specifically configured in an electronic device, and in this embodiment, the electronic device may be an API gateway. Specifically, referring to fig. 1, the method specifically includes the following steps:
s110, original service response information sent to the client by the API server is obtained.
The original service response information comprises target service content in a standard language and a target conversion language matched with the client. It should be noted that the display form of the target service content in the standard language related in this embodiment may be a character string composed of letters, numbers, or symbols; the target conversion language matched with the client can be a standard language (for example, English) or other languages except the standard language; for example, the language is chinese, korean, or japanese, but the present embodiment is not limited thereto. Optionally, the user may set any language as the target conversion language at the client according to the self requirement.
In an optional implementation manner of this embodiment, the API gateway is a bridge for data transmission between the client and the API server, and when the API gateway receives the service request information sent by the client, the API gateway forwards the service request information to the corresponding API server according to the pre-stored API server configuration information; further, the API server side can respond to the received service request information, generate service response information and send the service information to the API gateway; it should be noted that the service response information sent by the API server and received by the API gateway is the original service response information in this embodiment.
Optionally, the target service content in the standard language included in the original service response information received by the API gateway may be response content of the service request information sent by the API server to the client, for example, the service request information sent by the client is a Payment request, and the response content of the API server to the service request information may be "Payment success", "resource, your credit running low", or "invoke parameter", and the like, which is not limited in this embodiment.
And S120, acquiring the target translation service content of the target conversion language matched with the target service content.
In an optional implementation manner of this embodiment, after acquiring the original service information sent by the API server to the client, the API gateway may further acquire target translation service content in a target conversion language matched with the target service content in the received original service information.
In a specific example of this embodiment, after acquiring the original service information sent by the API server to the client, the API gateway may query mapping content corresponding to the target service content in the translation mapping relationship table, and further translate the mapping content into a language corresponding to the target conversion language, so as to obtain final target translation service content. Illustratively, if the target conversion language is chinese, after the mapping content corresponding to the target service content is queried in the translation mapping relationship table, the mapping content may be translated into chinese, and then the target translation service content in the display form of chinese is obtained.
In another specific example of this embodiment, after acquiring the original service information sent by the API server to the client, the API gateway may query, in the translation mapping relationship table, translation service contents corresponding to both the target service content and the target conversion language, and determine the translation service contents as final target translation service contents.
S130, generating new service response information according to the target translation service content, and sending the new service response information to the client.
In an optional implementation manner of this embodiment, after acquiring the target translation service content in the target conversion language matched with the target service content, the API gateway may further generate a new service response message according to the target translation service content, and send the new service response message to the client.
In this embodiment, according to the target translation service content, the original service response information provided by the API server may be converted into new service response information, and the new service response information is sent to the client for reference and use by the user. It can be understood that the original service response information is converted into new service response information, and the original service response information can be sent to the client in a popular and easily understood language.
According to the scheme of the embodiment, the API gateway acquires original service response information sent to the client by the API server; acquiring target translation service content of a target conversion language matched with the target service content; according to the method, new service response information is generated according to target translation service content, and is sent to the client, so that the problems that each API server carries out internationalization processing on original service response information according to languages, configuration is complex, maintenance is difficult, repeated development is carried out, irrelevant logic except business is increased, and system complexity is increased are solved, conversion of the original service information is achieved at the API gateway, configuration is simple, repeated development is not needed, irrelevant logic except business is not increased, and system complexity is not increased.
Fig. 2 is a schematic diagram of an information transmission method according to an embodiment of the present application, where the present embodiment is a further refinement of the foregoing technical solution, and the technical solution in the present embodiment may be combined with various alternatives in one or more of the foregoing embodiments. As shown in fig. 2, the information transmission method includes the following steps:
s210, original service response information sent to the client by the API server is obtained.
S220, in the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
Wherein, the translation mapping relation table comprises: the mapping relation among the service contents of the standard language, the conversion language and the translation service contents of the conversion language. It should be noted that the translation mapping relationship table may include mapping relationships between service contents of multiple standard languages, translation services contents of multiple conversion languages, and translation services contents of multiple conversion languages.
Illustratively, the translation mapping table may include: standard language service content A, B and C; transform languages A, B and C; and translation service contents A, B and C of the conversion language; wherein, one mapping relationship in the translation mapping relationship table may be: "service content a in standard language, conversion language a, and translation service content a in conversion language"; another mapping in the translation mapping table may be: "service contents B in standard language, conversion language B, and translation service contents B in conversion language".
In a specific example of this embodiment, a translation mapping table related in this embodiment may be as shown in table 1.
TABLE 1A translation mapping relationship table
Service content in standard languages Language conversion Translation service contents for converting languages
A A A
B B B
In an optional implementation manner of this embodiment, after the API gateway obtains the original service response information sent by the API server to the client, a target translation mapping relationship corresponding to both the target conversion language and the target service content may be obtained by querying in the translation mapping relationship table.
For example, after the target service content included in the original service response information is queried in the service content of the standard language in the translation mapping relationship table and the target conversion language included in the original service response information is queried in the conversion language in the translation mapping relationship table, the target translation mapping relationship corresponding to both the target conversion language and the target service content may be determined; for example, if the target translation language is a translation language a and the target service content is a service content a in a standard language, the target translation mapping relationship corresponding to both the target translation language and the target service content may be determined as the second row in table 1.
And S230, acquiring the target translation service content in the target translation mapping relation.
In an optional implementation manner of this embodiment, after the target translation mapping relationship corresponding to the target conversion language and the target service content at the same time is obtained through query in the translation mapping relationship table, the target translation service content may be further obtained in the target translation mapping relationship.
For example, in the above example, after determining that the target translation mapping relationship corresponding to both the target conversion language and the target service content is the second row in table 1, the target translation service content may be further determined to be the translation service content a of the conversion language.
And S240, generating new service response information according to the target translation service content, and sending the new service response information to the client.
In the scheme of this embodiment, a target translation mapping relation corresponding to both a target conversion language and target service content is obtained by querying in a translation mapping relation table; in the target translation mapping relation, target translation service content is obtained, the target translation content can be quickly obtained, and a basis is provided for subsequently generating new service response information.
Fig. 3a is a schematic diagram of an information transmission method according to an embodiment of the present application, where the present embodiment is a further refinement of the foregoing technical solution, and the technical solution in the present embodiment may be combined with various alternatives in one or more of the foregoing embodiments. As shown in fig. 3a, the information transmission method includes the following steps:
s310, original service response information sent to the client by the API server is obtained.
S320, obtaining the target translation service content of the target conversion language matched with the target service content.
S321, in the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
S322, judging whether a target translation mapping relation which is simultaneously corresponding to the target conversion language and the target service content is obtained by inquiring in at least one direct mapping relation of the translation mapping relation table. If not, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content in at least one translation regular matching mapping relation in the translation mapping relation table.
Optionally, the type of translation mapping relationship involved in this embodiment may include: a direct mapping relationship, a regular matching mapping relationship, or a direct mapping relationship and a regular matching mapping relationship; in the regular matching mapping relationship, the service content of the standard language includes at least one regular expression, and it should be noted that the regular expression involved in this embodiment may be a larger expression created by combining small expressions together with a plurality of meta characters and operators. The components of the regular expression may be individual characters, a collection of characters, a range of characters, a selection between characters, or any combination of all of these components.
In an optional implementation manner of this embodiment, in the translation mapping relationship table, querying and obtaining a target translation mapping relationship simultaneously corresponding to the target conversion language and the target service content may include: judging whether a target translation mapping relation which simultaneously corresponds to the target conversion language and the target service content is obtained by inquiring in at least one direct mapping relation of the translation mapping relation table; if not, in at least one translation regular matching mapping relation in the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
For example, it may be determined whether a target translation mapping relation corresponding to both the target conversion language and the target service content may be queried in a plurality of direct mapping relations of the translation mapping relation; if yes, the target translation mapping relation is the target translation mapping relation which is required to be inquired and obtained; if not, that is, the target translation mapping relation corresponding to the target conversion language and the target service content at the same time cannot be queried in the multiple direct mapping relations of the translation mapping relation, the target translation mapping relation corresponding to the target conversion language and the target service content at the same time can be queried and obtained in at least one translation regular matching mapping relation of the translation mapping relation table.
The method has the advantages that the efficiency of searching the direct mapping relation in the translation mapping relation table is far higher than that of searching the regular matching mapping relation, so that the direct mapping relation is firstly inquired, and when the target translation mapping relation cannot be inquired in the direct mapping relation, the regular matching mapping relation is inquired, the target mapping relation can be efficiently and accurately searched, and a basis is provided for accurately determining the target translation service content subsequently.
S323, in the target translation mapping relation, obtaining the target translation service content.
In another optional implementation manner of this embodiment, if it is determined that the target translation mapping relationship corresponding to the target conversion language and the target service content at the same time is a direct mapping relationship, the target translation service content may be obtained in the direct mapping relationship; if the target translation mapping relation corresponding to the target conversion language and the target service content is determined to be a regular matching mapping relation, the target translation service content can be obtained in the regular matching mapping relation.
For better understanding of the present embodiment, fig. 3b illustrates a schematic diagram of translating the service content of the standard language according to the direct mapping relationship; FIG. 3c illustrates a schematic diagram of translating service content in a standard language according to a regular matching mapping relationship; wherein 310 is the service content of the standard language, 320 is the translation service content of the conversion language; it should be noted that the standard language and the converted language referred to in fig. 3b and fig. 3c are both english.
S330, generating new service response information according to the target translation service content, and sending the new service response information to the client.
In the solution of this embodiment, it is determined whether to query at least one direct mapping relationship in the translation mapping relationship table to obtain a target translation mapping relationship corresponding to both the target conversion language and the target service content. If not, in at least one translation regular matching mapping relation of the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content, so that the target mapping relation can be efficiently and accurately searched, and a basis is provided for accurately determining the target translation service content subsequently.
Fig. 4 is a schematic diagram of an information transmission method according to an embodiment of the present application, where the present embodiment is a further refinement of the foregoing technical solution, and the technical solution in the present embodiment may be combined with various alternatives in one or more of the foregoing embodiments. As shown in fig. 4, the information transmission method includes the following steps:
s410, acquiring original service response information sent to the client by the API server.
S420, inquiring and acquiring a target translation mapping relation which simultaneously corresponds to a target service type, a target context type, a target conversion language and target service content in a translation mapping relation table; and acquiring the target translation service content in the target translation mapping relation.
Wherein, the translation mapping relation table comprises: the mapping relation among the service type, the context type, the service content of the standard language, the conversion language and the translation service content of the conversion language. The Service types may include Product Micro Service, recommended Micro Service, Catalog Micro Service, and Review Micro Service, which are not limited in this embodiment.
In an optional implementation manner of this embodiment, after acquiring the original service response information sent by the API server to the client, the API gateway may further query and acquire, in the translation mapping relationship table, a target translation mapping relationship simultaneously corresponding to the target service type, the target context type, the target conversion language, and the target service content.
For example, a translation mapping table involved in this embodiment may be as shown in table 2.
TABLE 2A translation mapping relationship table
Figure BDA0002625929620000101
As can be seen from table 2, the target translation service content satisfying the service type "ServiceA", the Context type "Context _ 1", the target conversion language "zh-cn", and the target service content "Invalid parameter" at the same time is "parameter error". It will be appreciated that the mapping relationship table referred to in table 2 is a direct mapping relationship, and in this example, the API gateway translates the original service response information "invaid parameter" into the target translation service content "parameter is wrong".
In another specific example of this embodiment, a translation mapping table related in this embodiment may be as shown in table 3.
TABLE 3A translation mapping relationship table
Figure BDA0002625929620000102
Figure BDA0002625929620000111
As can be seen from table 2, for a target translation service content satisfying both the service type "ServiceA", the Context type "Context _ 1", the target conversion language "zh-cn", and the target service content "Parameter { { Parameter name } } short the { { max } }" the value of "Parameter name } should be smaller than { { max } }". It will be appreciated that the mapping relationship table referred to in table 2 is a regular matching mapping relationship, and in this example, the API gateway translates the raw service response information "Parameter { { parameterName } } shouldless then { { max } }" into the target translation service content "the value of Parameter { { parameterName } } should be less than { { max } }".
S430, generating new service response information according to the target translation service content, and sending the new service response information to the client.
According to the scheme of the embodiment, the API gateway queries and acquires the target translation mapping relation which simultaneously corresponds to the target service type, the target context type, the target conversion language and the target service content in the translation mapping relation table, so that the original service response information can be accurately converted, irrelevant logic except for business is not added at the API server, and the complexity of a system is not increased.
Fig. 5 is a schematic diagram of an information transmission method according to an embodiment of the present application, where the embodiment is suitable for a case where service response information is converted and transmitted by an API server, and the method may be executed by an information transmission apparatus, where the apparatus may be implemented in a software and/or hardware manner, and is specifically configured in an electronic device, and in this embodiment, the electronic device may be an API server. Specifically, referring to fig. 5, the method specifically includes the following steps:
s510, acquiring a service request of the target conversion language sent by the client, and forwarding and acquiring the service request through the API gateway.
In an optional implementation manner of this embodiment, after receiving a service request sent by a client, an API gateway forwards the service request to an API server, so that the API server obtains the service request sent by the client.
In a specific example of this embodiment, the display language of the service request sent by the client in this embodiment may be a target conversion language for the client to want to obtain the service response returned by the API server; illustratively, if the displayed language of the service request is the chinese language, the client wants to obtain the target converted language of the service response returned by the API server, which is also the chinese language; if the displayed language of the service request is korean, the client wishes to obtain the target translation language of the service response returned by the API server as korean.
In another specific example of this embodiment, the service request sent by the client may include a target translation language; for example, the client sends a service request including an instruction for converting the target language into chinese, japanese, or korean, and the like.
S520, converting the service request into a standard service request in a standard language according to a preset translation rule, and generating target service content in the standard language according to the standard service request.
In an optional implementation manner of this embodiment, after acquiring the service request of the target conversion language sent by the client, the API server may further convert the service request into a standard service request of a standard language according to a preset translation rule, and generate the target service content of the standard language according to the standard service request.
Illustratively, if the display language of the service request of the target conversion language obtained by the API server from the client is "chinese", and the display language of the service request of the target conversion language is a non-standard language, the received service request needs to be converted into a standard service request according to a preset translation rule, for example, a chinese-english translation rule, and then the target service content of the standard language is generated according to the standard service request.
S530, generating original service response information according to the target service content of the standard language.
In an optional implementation manner of this embodiment, after the API server generates the target service content in the standard language, the API server may further generate original service information according to the generated target service content in the standard language; wherein, the generated original service response information comprises: target service content in standard language, and target conversion language matched with the client.
And S540, sending the original service response information to the API gateway.
The API gateway is used for converting target service contents of standard languages in the original service response information into target translation service contents of target conversion languages and sending new service response information generated through conversion to the client.
In an optional implementation manner of this embodiment, after the API server generates the original response information, the API server may further send the original response information to the API gateway, and then the API gateway may further convert the original service response information, generate new service response information, and send the new service response information to the client, so as to be viewed by the user.
According to the scheme of the embodiment, an API server side obtains a service request of a target conversion language sent by a client side; converting the service request into a standard service request of a standard language according to a preset translation rule, and generating target service content of the standard language according to the standard service request; generating original service response information according to the target service content of the standard language; the original service response information is sent to the API gateway, so that the obtained service request is converted into the original service response information, the original service response information is sent to the API gateway, a basis is provided for the subsequent conversion of the original service response information by the API gateway, non-business logic cannot be added to the API server, and the complexity of a system cannot be increased.
Fig. 6 is a block diagram of an information transmission apparatus according to an embodiment of the present application, which may perform the information transmission method mentioned in any embodiment of the present application, and may be implemented by software and/or hardware. Specifically, referring to fig. 6, the apparatus specifically includes: an original service response information acquisition module 610, a target translation service content acquisition module 620 and a new service response information sending module 630.
An original service response information obtaining module 610, configured to obtain original service response information sent by an API server to a client, where the original service response information includes target service content in a standard language and a target conversion language matched with the client;
a target translation service content obtaining module 620, configured to obtain target translation service content of a target conversion language matched with the target service content;
and a new service response information sending module 630, configured to generate new service response information according to the target translation service content, and send the new service response information to the client.
According to the scheme of the embodiment, the API gateway acquires original service response information sent by an API server to a client through an original service response information acquisition module; acquiring target translation service content of a target conversion language matched with the target service content through a target translation service content acquisition module; the new service response information is generated by the new service response information sending module according to the target translation service content, and the new service response information is sent to the client, so that the problems that each API server carries out internationalization processing on the original service response information according to languages, configuration is complex, maintenance is difficult, repeated development is carried out, irrelevant logic except business is added, and system complexity is increased are solved, conversion of the original service information is realized at the API gateway, configuration is simple, repeated development is not needed, irrelevant logic except business is not added, and system complexity is not increased.
Optionally, the target translation service content obtaining module 620 includes: a target translation relation query submodule and a target translation service content acquisition submodule;
the target translation relation query submodule is used for querying and acquiring a target translation mapping relation which simultaneously corresponds to the target conversion language and the target service content in the translation mapping relation table;
the target translation service content acquisition submodule is used for acquiring target translation service content in the target translation mapping relation;
wherein, the translation mapping relation table comprises: the mapping relation among the service contents of the standard language, the conversion language and the translation service contents of the conversion language.
Optionally, the types of translation mapping relations involved in this embodiment include: a direct mapping relationship and/or a regular matching mapping relationship; in the regular matching mapping relation, the service content of the standard language comprises at least one regular expression.
Optionally, the target translation relation query sub-module,
the translation mapping table is specifically used for judging whether a target translation mapping relation which corresponds to the target conversion language and the target service content at the same time is obtained by inquiring in at least one direct mapping relation in the translation mapping relation table;
if not, in at least one translation regular matching mapping relation in the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
Optionally, the original service response information related in this embodiment further includes: a target service type and a target context type;
the target translation relation query submodule is also specifically used for querying and acquiring a target translation mapping relation which simultaneously corresponds to the target service type, the target context type, the target conversion language and the target service content in the translation mapping relation table;
wherein, the translation mapping relation table comprises: the mapping relation among the service type, the context type, the service content of the standard language, the conversion language and the translation service content of the conversion language.
The information transmission device can execute the information transmission method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. For details of the information transmission method provided in any embodiment of the present application, reference may be made to the technical details not described in detail in this embodiment.
Fig. 7 is a block diagram of an information transmission apparatus according to an embodiment of the present application, which may perform the information transmission method mentioned in any embodiment of the present application, and may be implemented by software and/or hardware. Specifically, referring to fig. 7, the apparatus specifically includes: a service request acquisition module 710, a service request conversion module 720, an original service response information generation module 730, and an original service response information transmission module 740.
A service request obtaining module 710, configured to obtain a service request of a target translation language sent by a client, where the service request is forwarded and obtained through an API gateway;
the service request conversion module 720 is configured to convert the service request into a standard service request in a standard language according to a preset translation rule, and generate a target service content in the standard language according to the standard service request;
an original service response information generating module 730, configured to generate original service response information according to the target service content in the standard language, where the original service response information includes: target service content in a standard language and a target conversion language matched with the client;
an original service response information sending module 740, configured to send the original service response information to the API gateway;
the API gateway is used for converting target service contents of standard languages in the original service response information into target translation service contents of target conversion languages and sending new service response information generated through conversion to the client.
In the scheme of this embodiment, an API server obtains a service request of a target translation language sent by a client through a service request obtaining module; the service request providing conversion module converts the service request into a standard service request in a standard language according to a preset translation rule and generates target service content in the standard language according to the standard service request; providing an original service response information generation module to generate original service response information according to the target service content of the standard language; the original service response information sending module is provided to send the original service response information to the API gateway, so that the obtained service request is converted into the original service response information, the original service response information is sent to the API gateway, a basis is provided for the subsequent API gateway to convert the original service response information, non-business logic cannot be added to an API server side, and the complexity of a system cannot be increased.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 8 is a block diagram of an electronic device for implementing the information transmission method according to the embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 8, the electronic apparatus includes: one or more processors 801, memory 802, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 8 illustrates an example of a processor 801.
The memory 802 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of information transfer provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of information transmission provided by the present application.
The memory 802 serves as a non-transitory computer-readable storage medium, and may be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules corresponding to the method of information transmission in the embodiments of the present application (for example, the original service response information obtaining module 610, the target translation service content obtaining module 620, and the new service response information sending module 630 shown in fig. 6, or the service request obtaining module 710, the service request converting module 720, the original service response information generating module 730, and the original service response information sending module 740 shown in fig. 7). The processor 801 executes various functional applications of the server and data processing by running non-transitory software programs, instructions, and modules stored in the memory 802, that is, implements the method of information transmission in the above-described method embodiments.
The memory 802 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device for information transmission, and the like. Further, the memory 802 may include high speed random access memory and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 802 optionally includes memory located remotely from the processor 801, which may be connected to an information-bearing electronic device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method of information transmission may further include: an input device 803 and an output device 804. The processor 801, the memory 802, the input device 803, and the output device 804 may be connected by a bus or other means, and are exemplified by a bus in fig. 8.
The input device 803 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic device for information transfer, such as a touch screen, keypad, mouse, track pad, touch pad, pointer stick, one or more mouse buttons, track ball, joystick, or other input device. The output devices 804 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, the problems that each API server carries out international processing on the original service response information according to languages, configuration is complicated, maintenance is difficult, repeated development is carried out, irrelevant logic except business is increased, and system complexity is increased are solved.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. An information transmission method applied to an Application Program Interface (API) gateway comprises the following steps:
acquiring original service response information sent by an API (application programming interface) server to a client, wherein the original service response information comprises target service content in a standard language and a target conversion language matched with the client; the target service content is response content of service request information sent by an API (application programming interface) server side to a client side;
in a translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content; wherein, the translation mapping relation table comprises: the service content of the standard language, the conversion language and the mapping relation between the translation service content of the conversion language;
acquiring the target translation service content in the target translation mapping relation; wherein the type of the translation mapping relationship comprises: regular matching mapping relation; in the regular matching mapping relation, the service content of the standard language comprises at least one regular expression; the regular matching mapping relation is used for inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content;
and generating new service response information according to the target translation service content, and sending the new service response information to the client.
2. The method of claim 1, wherein the type of translation mapping further comprises: and (4) direct mapping relation.
3. The method according to claim 2, wherein the querying, in the translation mapping relationship table, to obtain a target translation mapping relationship corresponding to both the target conversion language and the target service content includes:
judging whether a target translation mapping relation which corresponds to the target conversion language and the target service content at the same time is obtained by inquiring in at least one direct mapping relation in the translation mapping relation table;
if not, in at least one translation regular matching mapping relation in the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
4. The method of claim 1, wherein the original service response information further comprises: a target service type and a target context type;
the querying and obtaining a target translation mapping relation corresponding to the target conversion language and the target service content in the translation mapping relation table includes:
in a translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target service type, the target context type, the target conversion language and the target service content;
wherein the translation mapping table comprises: the mapping relation among the service type, the context type, the service content of the standard language, the conversion language and the translation service content of the conversion language.
5. An information transmission method is applied to an Application Program Interface (API) server and comprises the following steps:
acquiring a service request of a target conversion language sent by a client, wherein the service request is forwarded and acquired through an API gateway;
converting the service request into a standard service request in a standard language according to a preset translation rule, and generating target service content in the standard language according to the standard service request;
generating original service response information according to the target service content of the standard language, wherein the original service response information comprises: target service content in a standard language and a target conversion language matched with the client;
sending the original service response information to an API gateway;
the API gateway is used for converting target service contents of a standard language in the original service response information into target translation service contents of a target conversion language and sending new service response information generated by conversion to the client;
wherein the determining process of the target translation service content comprises:
in a translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content; wherein, the translation mapping relation table comprises: the service content of the standard language, the conversion language and the mapping relation between the translation service content of the conversion language;
acquiring the target translation service content in the target translation mapping relation; wherein the type of the translation mapping relationship comprises: a regular matching mapping relation; in the regular matching mapping relation, the service content of the standard language comprises at least one regular expression; and the regular matching mapping relation is used for inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
6. An information transmission device applied to an API gateway comprises:
the system comprises an original service response information acquisition module, a service processing module and a service processing module, wherein the original service response information acquisition module is used for acquiring original service response information sent by an API (application program interface) server to a client, and the original service response information comprises target service content in a standard language and a target conversion language matched with the client; the target service content is response content of service request information sent by an API (application programming interface) server side to a client side;
a target translation service content obtaining module, configured to obtain a target translation service content of the target conversion language matched with the target service content;
the new service response information sending module is used for generating new service response information according to the target translation service content and sending the new service response information to the client;
wherein, the target translation service content obtaining module includes: a target translation relation query submodule and a target translation service content acquisition submodule;
the target translation relation query submodule is used for querying and acquiring a target translation mapping relation which simultaneously corresponds to the target conversion language and the target service content in a translation mapping relation table; wherein, the translation mapping relation table comprises: the service content of the standard language, the conversion language and the mapping relation between the translation service content of the conversion language;
the target translation service content obtaining submodule is used for obtaining the target translation service content in the target translation mapping relation; wherein the type of the translation mapping relationship comprises: a regular matching mapping relation; in the regular matching mapping relation, the service content of the standard language comprises at least one regular expression; and the regular matching mapping relation is used for inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
7. The apparatus of claim 6, wherein the type of translation mapping further comprises: and (4) direct mapping relation.
8. The apparatus of claim 7, wherein the target translation relationship query submodule,
specifically, the translation processing unit is configured to determine whether to query at least one direct mapping relationship in the translation mapping relationship table to obtain a target translation mapping relationship corresponding to the target conversion language and the target service content at the same time;
if not, in at least one translation regular matching mapping relation in the translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
9. The apparatus of claim 8, wherein the original service response information further comprises: a target service type and a target context type;
the target translation relationship query submodule is further specifically configured to query and acquire a target translation mapping relationship corresponding to the target service type, the target context type, the target conversion language and the target service content at the same time in a translation mapping relationship table;
wherein the translation mapping table comprises: the mapping relation among the service type, the context type, the service content of the standard language, the conversion language and the translation service content of the conversion language.
10. An information transmission device applied to an API server side comprises:
the service request acquisition module is used for acquiring a service request of a target conversion language sent by a client, and the service request is forwarded and acquired through an API gateway;
the service request conversion module is used for converting the service request into a standard service request in a standard language according to a preset translation rule and generating target service content in the standard language according to the standard service request;
an original service response information generating module, configured to generate original service response information according to the target service content in the standard language, where the original service response information includes: target service content in a standard language and a target conversion language matched with the client;
the original service response information sending module is used for sending the original service response information to the API gateway;
the API gateway is used for converting target service contents of a standard language in the original service response information into target translation service contents of a target conversion language and sending new service response information generated by conversion to the client;
the determination process of the target translation service content comprises the following steps:
in a translation mapping relation table, inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content; wherein, the translation mapping relation table comprises: the service content of the standard language, the conversion language and the mapping relation between the translation service content of the conversion language;
acquiring the target translation service content in the target translation mapping relation; wherein the type of the translation mapping relationship comprises: a regular matching mapping relation; in the regular matching mapping relation, the service content of the standard language comprises at least one regular expression; and the regular matching mapping relation is used for inquiring and acquiring a target translation mapping relation simultaneously corresponding to the target conversion language and the target service content.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 4, or claim 5.
12. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the information transmission method of any one of claims 1 to 4 or claim 5.
CN202010796786.8A 2020-08-10 2020-08-10 Information transmission method and device, electronic equipment and storage medium Active CN111988384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010796786.8A CN111988384B (en) 2020-08-10 2020-08-10 Information transmission method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010796786.8A CN111988384B (en) 2020-08-10 2020-08-10 Information transmission method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111988384A CN111988384A (en) 2020-11-24
CN111988384B true CN111988384B (en) 2022-08-30

Family

ID=73445367

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010796786.8A Active CN111988384B (en) 2020-08-10 2020-08-10 Information transmission method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111988384B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113784354B (en) * 2021-09-17 2024-04-09 城云科技(中国)有限公司 Request conversion method and device based on gateway
CN114268466B (en) * 2021-12-02 2023-07-21 中国联合网络通信集团有限公司 Encoding processing method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106156080A (en) * 2015-03-31 2016-11-23 阿里巴巴集团控股有限公司 The method and apparatus of dynamic page conversion
CN106156128A (en) * 2015-04-08 2016-11-23 阿里巴巴集团控股有限公司 A kind of realize website multi-lingual mention multiple domain name service method and device
CN108512903A (en) * 2018-02-27 2018-09-07 深圳乐信软件技术有限公司 A kind of exception information processing method, device, storage medium and API gateway
CN110347560A (en) * 2019-07-19 2019-10-18 深圳前海微众银行股份有限公司 Abnormal prompt method, apparatus, system, equipment and the medium of big data product

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10248653B2 (en) * 2014-11-25 2019-04-02 Lionbridge Technologies, Inc. Information technology platform for language translation and task management
US10417349B2 (en) * 2017-06-14 2019-09-17 Microsoft Technology Licensing, Llc Customized multi-device translated and transcribed conversations
CN110381101B (en) * 2018-04-13 2024-01-12 北京京东尚科信息技术有限公司 API gateway control system, control method, equipment and medium
CN111177318A (en) * 2019-12-23 2020-05-19 杭州安恒信息技术股份有限公司 Method, device and computer readable storage medium for executing international business

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106156080A (en) * 2015-03-31 2016-11-23 阿里巴巴集团控股有限公司 The method and apparatus of dynamic page conversion
CN106156128A (en) * 2015-04-08 2016-11-23 阿里巴巴集团控股有限公司 A kind of realize website multi-lingual mention multiple domain name service method and device
CN108512903A (en) * 2018-02-27 2018-09-07 深圳乐信软件技术有限公司 A kind of exception information processing method, device, storage medium and API gateway
CN110347560A (en) * 2019-07-19 2019-10-18 深圳前海微众银行股份有限公司 Abnormal prompt method, apparatus, system, equipment and the medium of big data product

Also Published As

Publication number Publication date
CN111988384A (en) 2020-11-24

Similar Documents

Publication Publication Date Title
EP3848819A1 (en) Method and apparatus for retrieving video, device and medium
EP3832484A2 (en) Semantics processing method, semantics processing apparatus, electronic device, and medium
CN110489440B (en) Data query method and device
CN110727434B (en) Rendering method, rendering device, electronic equipment and storage medium
CN111988384B (en) Information transmission method and device, electronic equipment and storage medium
WO2016115261A1 (en) Displaying information in multiple languages based on optical code reading
EP3832492A1 (en) Method and apparatus for recommending voice packet, electronic device, and storage medium
CN111026931A (en) Data query method, device, equipment and medium
US20220068277A1 (en) Method and apparatus of performing voice interaction, electronic device, and readable storage medium
CN111881385A (en) Push content generation method, device, equipment and readable storage medium
CN111259125A (en) Voice broadcasting method and device, intelligent sound box, electronic equipment and storage medium
CN110545324A (en) Data processing method, device, system, network equipment and storage medium
US20210216713A1 (en) Method, apparatus, device and storage medium for intelligent response
CN110517079B (en) Data processing method and device, electronic equipment and storage medium
CN112379951A (en) Service interface access method, device, electronic equipment and medium
KR100466215B1 (en) Implementation of Web-GIS system for sharing geospatial data
US11838294B2 (en) Method for identifying user, storage medium, and electronic device
CN112559867B (en) Business content output method, device, equipment, storage medium and program product
US11508044B2 (en) Method for translating image, method for training image translation model
CN111177558B (en) Channel service construction method and device
CN113220982A (en) Advertisement searching method, device, electronic equipment and medium
CN111352685A (en) Input method keyboard display method, device, equipment and storage medium
CN108962398B (en) Hospital information acquisition method and device
CN111078736A (en) Data aggregation processing method and device, terminal and storage medium
CN112269517B (en) Generation method and device of interactive interface

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant