Data processing method and device, computer equipment and readable storage medium
By extracting and replacing the strings to be converted in the application client construction file and generating construction files of different language types, the problem of high intrusion and operation consumption of development files in the existing technology is solved, and the development efficiency is improved and the operation consumption is reduced.
Patent Information
- Application Number
- CN202311113755.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-02-28
AI Technical Summary
The existing application client transformation method requires intrusion into the development files for multilingual copywriting, and multiple replacements during the operation stage, increasing the project volume and operation consumption. At the same time, due to the need to install an open source framework, the construction file volume is increased.
By obtaining the construction files associated with the application client, extracting the string to be converted, and generating the corresponding converted strings according to the locale, replacing the string to be converted, and generating construction files of different language types without intruding into the development files and modifying them in the runtime stage.
It improves the development efficiency of application clients, reduces operational consumption, and avoids the problem of building file size increase.
Smart Images

Figure CN119538942A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a data processing method, apparatus, computer equipment, and readable storage medium. Background Art
[0002] The existing application client transformation method can introduce the open source framework into an existing project (the existing project can include development files) before the front-end project is built (that is, before the build file associated with the application client is generated based on the development file, which can also be called the development stage), and use the open source framework to replace the text to be translated in the project with a translation function (for example, replace the text "Hello everyone" with the first language type in the development file with the translation function "i18next.t('key')"), and then build the file of the replaced project to obtain the build file, and publish the build file to the business server.
[0003] However, the open source framework needs to determine the language environment used by the application client during operation, and then replace the translation function in the build file according to the language environment used by the application client (for example, when the language environment used by the application client is a second language type, the default string is replaced by a copy of the second language type). Therefore, the existing application client transformation method needs to invade the development file to replace the copy that needs to be displayed in multiple languages with the translation function one by one, and replace the translation function with the copy of the specified language environment one by one during the operation stage, thereby increasing the transformation engineering workload of the application client and reducing the development efficiency of the application client. In addition, since the existing application client transformation method needs to install the open source framework, it will cause the size of the build file to increase, thereby increasing the consumption of the application client during operation. Summary of the invention
[0004] The embodiments of the present application provide a data processing method, apparatus, computer device, and readable storage medium, which can improve the development efficiency of an application client and reduce the operating consumption of the application client.
[0005] On the one hand, an embodiment of the present application provides a data processing method, including:
[0006] Acquire a first build file associated with the application client, extract character strings from the first build file, and obtain character strings to be converted in the first build file; the first build file has a first language type;
[0007] Obtaining a converted string corresponding to the string to be converted, replacing the string to be converted with the converted string, and generating a second build file associated with the application client; the second build file has a second language type; the first language type and the second language type are different;
[0008] The first build file and the second build file are published to the business server; the business server is used to receive a client access request for an application client sent by the first terminal device; the business server is also used to determine a target language type from the first language type and the second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0009] An embodiment of the present application provides a data processing device, including:
[0010] A file acquisition module is used to acquire a first construction file associated with the application client, extract character strings from the first construction file, and obtain character strings to be converted in the first construction file; the first construction file has a first language type;
[0011] A file generation module, used for obtaining a converted string corresponding to the string to be converted, replacing the string to be converted with the converted string, and generating a second build file associated with the application client; the second build file has a second language type; the first language type and the second language type are different;
[0012] A file publishing module is used to publish a first build file and a second build file to a business server; the business server is used to receive a client access request for an application client sent by a first terminal device; the business server is also used to determine a target language type from a first language type and a second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0013] Among them, the file acquisition module includes:
[0014] A file acquisition unit, used to acquire a development file associated with the application client; the development file is obtained by writing a file on the application client in a first language type;
[0015] The file construction unit is used to construct the development file to generate a first construction file associated with the application client.
[0016] The file acquisition module is specifically used to copy the first build file to generate the copied first build file;
[0017] A file acquisition module, specifically used to extract character strings from the first built file after the file is copied, to obtain the character strings to be converted in the first built file after the file is copied;
[0018] The file generation module is specifically used to obtain a converted string corresponding to the to-be-converted string, replace the to-be-converted string in the copied first build file with the converted string, and generate a second build file associated with the application client.
[0019] The first build file is located in the first file directory for the application client;
[0020] A file acquisition module, specifically used to acquire a second file directory for the application client; the second file directory and the first file directory have the same parent directory;
[0021] The file acquisition module is specifically used to copy the first built file in the first file directory to the second file directory to obtain the copied first built file in the second file directory.
[0022] Among them, the file acquisition module includes:
[0023] A string acquisition unit, used for reading the first construction file as a file string, and acquiring a non-comment string from the file string;
[0024] An expression generation unit, used to generate a regular expression for the first build file, match the regular expression with a non-comment string, and obtain a string matching the regular expression from the non-comment string;
[0025] The character string determination unit is used to determine the character string matching the regular expression as the character string to be converted in the first construction file.
[0026] Among them, the file generation module includes:
[0027] A string deduplication unit is used to perform string deduplication on the string to be converted and generate a deduplicated string to be converted;
[0028] A string deduplication unit, used to compare the deduplicated string to be converted with the translation cache to generate a cache comparison result;
[0029] A first acquisition unit is configured to acquire a converted string corresponding to the deduplicated string to be converted from the translation result corresponding to the deduplicated string to be converted if the cache comparison result indicates that the translation cache includes a translation result corresponding to the deduplicated string to be converted;
[0030] The second acquisition unit is used to call the translation method provided by the language conversion library if the cache comparison result indicates that the translation cache does not include the translation result corresponding to the deduplicated string to be converted, and perform language conversion on the deduplicated string to be converted through the translation method to generate a converted string corresponding to the deduplicated string to be converted; the language conversion library is initialized through a configuration file; the configuration file includes string conversion rules between the first language type and the second language type.
[0031] The device further comprises:
[0032] A hash operation module, used to perform a hash operation on the second build file to generate a file hash value corresponding to the second build file;
[0033] A name determination module is used to determine the file name of the second build file according to the file hash value; the file name of the second build file is different from the file name of the first build file; the file name of the first build file and the file name of the second build file are used to distinguish the first build file from the second build file.
[0034] On the one hand, an embodiment of the present application provides a data processing method, including:
[0035] receiving a first build file and a second build file published by a second terminal device; the first build file has a first language type; the second build file has a second language type; the first language type and the second language type are different; the first build file and the second build file are both associated with an application client; the second build file is generated by replacing a string to be converted by a converted string corresponding to the string to be converted in the first build file; the string to be converted is obtained by extracting a string from the first build file;
[0036] A client access request for an application client sent by a first terminal device is received, a target language type is determined from a first language type and a second language type based on the client access request, and a target build file corresponding to the target language type is returned to the first terminal device; the target build file is a first build file or a second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0037] An embodiment of the present application provides a data processing device, including:
[0038] The file receiving module is used to receive a first build file and a second build file published by a second terminal device; the first build file has a first language type; the second build file has a second language type; the first language type and the second language type are different; the first build file and the second build file are both associated with the application client; the second build file is generated by replacing the string to be converted by the converted string corresponding to the string to be converted in the first build file; the string to be converted is obtained by extracting the string from the first build file;
[0039] A request receiving module is used to receive a client access request for an application client sent by a first terminal device, determine a target language type from a first language type and a second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device; the target build file is a first build file or a second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0040] The client access request includes session language information; the first construction file is located in the first server directory, and the second construction file is located in the second server directory;
[0041] A request receiving module, specifically configured to determine the language type indicated in the first language type and the second language type of the conversation language information as the target language type;
[0042] The request receiving module is specifically used to rewrite the client access request according to the target language type to obtain the rewritten client access request; the file path in the rewritten client access request points to the target server directory corresponding to the target language type; if the target language type is the first language type, the target server directory is the first server directory; if the target language type is the second language type, the target server directory is the second server directory;
[0043] The request receiving module is specifically configured to return the target build file corresponding to the target language type in the target server directory to the first terminal device.
[0044] The client access request includes header information; the header information includes an object proxy; the first build file is located in a first server directory, and the second build file is located in a second server directory;
[0045] a request receiving module, specifically configured to, if the object proxy includes a type string corresponding to the first language type, determine the first language type as a target language type, determine the first build file in the first server directory as a target build file corresponding to the target language type, and return the target build file to the first terminal device;
[0046] The request receiving module is specifically used to determine the second language type as the target language type if the object proxy does not include the type string corresponding to the first language type, determine the second build file in the second server directory as the target build file corresponding to the target language type, and return the target build file to the first terminal device.
[0047] The device further comprises:
[0048] A content acquisition module, used to receive a dynamic data acquisition request sent by the first terminal device, and acquire dynamic content corresponding to the dynamic data acquisition request;
[0049] a content returning module, configured to return the dynamic content to the first terminal device if the language type of the dynamic content is the same as the language type displayed in the application client of the first terminal device;
[0050] The content return module is used to translate the dynamic content through a translation service if the language type of the dynamic content is different from the language type displayed in the application client of the first terminal device, obtain the translated dynamic content, and return the translated dynamic content to the first terminal device; the language type of the translated dynamic content is the same as the language type displayed in the application client of the first terminal device.
[0051] An embodiment of the present application provides a computer device, including: a processor and a memory;
[0052] The processor is connected to the memory, wherein the memory is used to store a computer program. When the computer program is executed by the processor, the computer device executes the method provided in the embodiment of the present application.
[0053] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.
[0054] In one aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in the embodiment of the present application.
[0055] In an embodiment of the present application, a terminal device may obtain a first build file associated with an application client, extract a string from the first build file, obtain a string to be converted in the first build file, and then obtain a converted string corresponding to the string to be converted, replace the string to be converted with the converted string, and generate a second build file associated with the application client. The first build file has a first language type, the second build file has a second language type, and the first language type and the second language type are different. Further, the terminal device may publish the first build file and the second build file to a business server. The business server is used to receive a client access request for an application client sent by the terminal device, and the business server is also used to determine a target language type in the first language type and the second language type based on the client access request, and return a target build file corresponding to the target language type to the terminal device. The target build file is the first build file or the second build file; if the target build file is the first build file, the first build file is used to instruct the terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the terminal device to display an application client with the second language type. It can be seen that the embodiment of the present application does not need to intrusively (Intrusive, in computer software, intrusion usually refers to the need to make specific modifications based on the existing code to complete a specific function) develop files, but after the front-end project is built (that is, after the build file associated with the application client is generated based on the development file), the first build file in the build phase is translated to obtain the second build file. Therefore, the embodiment of the present application does not need to modify the first build file in the running stage, but directly obtains the build files corresponding to different language types according to the language environment used by the application client, thereby improving the development efficiency of the application client. In addition, the embodiment of the present application does not need to install an open source framework to achieve the replacement of the translation function, and will not increase the overhead of the application client when it is running, thereby reducing the running consumption of the application client. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0057] Figure 1 It is a structural diagram of a network architecture provided by an embodiment of the present application;
[0058] Figure 2This is a schematic diagram of a scenario for data interaction provided by an embodiment of the present application;
[0059] Figure 3 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0060] Figure 4 This is a schematic diagram of a scenario for copying files provided in an embodiment of the present application;
[0061] Figure 5 It is a schematic diagram of a scenario of translating a character string provided in an embodiment of the present application;
[0062] Figure 6 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0063] Figure 7 This is a schematic diagram of a scenario for publishing a file provided in an embodiment of the present application;
[0064] Figure 8 It is a flowchart of a data processing method provided in an embodiment of the present application;
[0065] Fig. 9 is a schematic diagram of a language switching scenario provided by an embodiment of the present application;
[0066] Fig.10 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0067] Fig.11 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;
[0068] Fig.12 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0070] For details, see Figure 1 , Figure 1 Schematic diagram of a network architecture provided by an embodiment of the present application. Figure 1As shown, the network architecture may include a service server 2000 and a terminal device cluster. The terminal device cluster may specifically include one or more terminal devices, and the number of terminal devices in the terminal device cluster is not limited. Figure 1 As shown, the multiple terminal devices may specifically include terminal device 3000a, terminal device 3000b, terminal device 3000c, ..., terminal device 3000n; terminal device 3000a, terminal device 3000b, terminal device 3000c, ..., terminal device 3000n may respectively be directly or indirectly connected to the business server 2000 via wired or wireless communication, so that each terminal device may exchange data with the business server 2000 via the network connection.
[0071] Each terminal device in the terminal device cluster may include: smart phones, tablet computers, laptop computers, desktop computers, intelligent voice interaction devices, smart home appliances (e.g., smart TVs), wearable devices, vehicle terminals, aircraft, and other smart terminals with data processing functions. The vehicle terminal may be a terminal device in smart transportation scenarios and assisted driving scenarios. It should be understood that Figure 1 Each terminal device in the terminal device cluster shown in the figure can be installed with an application client having a data processing function. When the application client runs in each terminal device, it can be respectively connected to the above Figure 1 The business servers 2000 shown perform data interaction.
[0072] Among them, the application client may specifically include: a browser, a car client, a smart home client, an entertainment client (e.g., a game client), a multimedia client (e.g., a video client), a social client, and an information client (e.g., a news client). Among them, the application client in the embodiment of the present application may be integrated in a certain client (e.g., a social client), and the application client may also be an independent client (e.g., a browser). The embodiment of the present application does not limit the type of the application client. Specifically, the application client in the embodiment of the present application may be a browser or a non-browser with an embedded web page.
[0073] Among them, Figure 1The business server 2000 shown can be a business server corresponding to an application client. The business server 2000 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0074] For ease of understanding, the embodiments of the present application may refer to users as objects, where objects may include a first object and a second object. For ease of understanding, the embodiments of the present application may refer to a terminal device corresponding to a first object as a first terminal device, and a terminal device corresponding to a second object as a second terminal device. The embodiments of the present application may arbitrarily select a terminal device in the above-mentioned terminal device cluster as the first terminal device, and arbitrarily select a terminal device in the above-mentioned terminal device cluster as the second terminal device. For example, the embodiments of the present application may refer to the terminal device 3000c in the above-mentioned terminal device cluster as the first terminal device, and the terminal device 3000a in the above-mentioned terminal device cluster as the second terminal device.
[0075] Among them, both the first terminal device and the second terminal device may be installed with an application client having a data processing function. At this time, the first terminal device may implement data interaction with the business server 2000 through the application client, and the second terminal device may implement data interaction with the business server 2000 through the application client. It can be understood that the first terminal device and the second terminal device may be the same terminal device (that is, the first object and the second object may be the same object), or the first terminal device and the second terminal device may be different terminal devices (that is, the first object and the second object may be different objects). The embodiment of the present application is described by taking the first terminal device and the second terminal device as different terminal devices as an example.
[0076] It should be understood that the application client in the embodiment of the present application may be an application client with internationalization (i18n) requirements, which refers to the process of decoupling software (i.e., application client) from specific languages and regions when designing it. When the software is ported to different languages and regions, it is possible to freely switch and display application clients with different language types without making a lot of internal adjustments and modifications.
[0077] The second object may publish the first build file and the second build file associated with the application client to the business server through the second terminal device, and the first object may obtain the first build file or the second build file from the business server 2000 through the application client in the first terminal device. The first build file and the second build file have different language types (for example, the first build file has a first language type, and the second build file has a second language type), and the second build file is generated based on the first build file.
[0078] It should be understood that the embodiments of the present application do not limit the specific language types of the first language type and the second language type. For example, the first language type may be Simplified Chinese, and the second language type may be Traditional Chinese; the first language type may be Simplified Chinese, and the second language type may be English; the first language type may be English, and the second language type may be Traditional Chinese.
[0079] For further understanding, please refer to Figure 2 , Figure 2 Schematic diagram of a scenario for data interaction provided by an embodiment of the present application. Figure 2 The service server 20a shown may be the above Figure 1 The service server 2000 in the corresponding embodiment is as follows: Figure 2 The first terminal device 20b shown can be the above Figure 1 The first terminal device in the corresponding embodiment, such as Figure 2 The second terminal device 20c shown can be the above Figure 1 The second terminal device in the corresponding embodiment. The object corresponding to the first terminal device 20b may be the object 21a (ie, the first object 21a), and the object corresponding to the second terminal device 20c may be the object 21b (ie, the second object 21b).
[0080] like Figure 2 As shown, when the application client needs to be published, the object 21b can obtain the first construction file (for example, the first construction file 22a) associated with the application client through the second terminal device 20c, extract the character string of the first construction file 22a, and obtain the character string to be converted in the first construction file 22a. The first construction file 22a has a first language type, and since the character string to be converted is extracted from the first construction file 22a, the character string to be converted also has the first language type.
[0081] Furthermore, the object 21b can obtain the converted string corresponding to the string to be converted through the second terminal device 20c, and replace the string to be converted in the first build file 22a with the converted string to generate a second build file associated with the application client (for example, the second build file 22b). The converted string has the second language type, and since the second build file 22b is obtained by replacing the unconverted string with the converted string, the second build file 22b also has the second language type.
[0082] like Figure 2 As shown, the object 21b can execute step S21 through the second terminal device 20c, and publish the first build file 22a and the second build file 22b to the business server 20a through step S21, so that the business server 20a can receive the first build file 22a and the second build file 22b published by the second terminal device 20c, and store the first build file 22a and the second build file 22b. At this time, the second terminal device 20c successfully publishes the application client, which means that the application client published in the business server 20a can be accessed by the terminal device (for example, the first terminal device 20b).
[0083] like Figure 2 As shown, when the application client needs to be accessed, the object 21a can execute step S22 through the first terminal device 20b, and send a client access request for the application client to the business server 20a through step S22. In this way, the business server 20a can receive the client access request sent by the first terminal device 20b, determine the target language type in the first language type and the second language type based on the client access request, and obtain the target construction file corresponding to the target language type. The client access request may include the language environment used by the application client in the first terminal device 20b, and the business server 20a can determine the target language type in the first language type and the second language type based on the language environment used by the application client in the first terminal device 20b.
[0084] Among them, the target build file is the first build file 22a or the second build file 22b; when the target language type is the first language type, the business server 20a can determine the first build file 22a as the target build file corresponding to the target language type; optionally, when the target language type is the second language type, the business server 20a can determine the second build file 22b as the target build file corresponding to the target language type.
[0085] Further, the business server 20a may execute step S23, and return the target build file corresponding to the target language type to the first terminal device 20b through step S23, so that the first terminal device 20b can receive the target build file returned by the business server 20a. It can be understood that if the target build file is the first build file 22a, the first terminal device 20b can display the application client with the first language type based on the first build file 22a; optionally, if the target build file is the second build file 22b, the first terminal device 20b can display the application client with the second language type based on the second build file 22b.
[0086] It should be understood that when the first terminal device 20b displays an application client of the first language type, the first terminal device 20b can respond to the language switching operation performed by the object 21a on the application client, obtain the second build file 22b of the second language type from the business server 20a, and switch the application client of the first language type to the application client of the second language type based on the second build file 22b (i.e., display the application client of the second language type). Similarly, when the first terminal device 20b displays an application client of the second language type, the first terminal device 20b can respond to the language switching operation performed by the object 21a on the application client, obtain the first build file 22a of the first language type from the business server 20a, and switch the application client of the second language type to the application client of the first language type based on the first build file 22a (i.e., display the application client of the first language type).
[0087] It can be seen that, after the front-end project is built, the embodiment of the present application can obtain a new build product (the new build product includes a second build file of a second language type) by translating the file in the build product (i.e., the first build file of the first language type). In this way, when the application client is accessed using the first language type, the program of the build product of the first language type can be provided to the terminal device for operation; when the application client is accessed using the second language type, the program of the build product of the second language type can be provided to the terminal device for operation, so that the build file does not need to be modified during the operation phase through the open source framework, thereby improving the development efficiency of the application client while reducing the operation consumption of the application client.
[0088] For further information, see Figure 3 , Figure 3 This is a flow chart of a data processing method provided by an embodiment of the present application. The method can be executed by a service server, or by a terminal device, or by both a service server and a terminal device. The service server can be the above-mentioned Figure 2The corresponding service server 20a in the embodiment, the terminal device can be the above Figure 2 The first terminal device 20b or the second terminal device 20c of the corresponding embodiment. For ease of understanding, the embodiment of the present application takes the method executed by the second terminal device as an example for explanation. Among them, the data processing method may include the following steps S101-S103:
[0089] Step S101, obtaining a first build file associated with an application client, extracting strings from the first build file, and obtaining strings to be converted in the first build file;
[0090] Specifically, the second terminal device can obtain a development file associated with the application client. The development file is obtained by writing a file on the application client in a first language type, and the development file can be an existing project or a new project. When the development file is an existing project, the embodiment of the present application can complete the internationalization transformation of the existing project at a low cost. Furthermore, the second terminal device can perform file construction on the development file to generate a first construction file associated with the application client. The first construction file has a first language type. Furthermore, the second terminal device can perform string extraction on the first construction file to obtain a string to be converted in the first construction file.
[0091] Among them, the file formats of the development file and the first build file can be the same or different, and the embodiments of the present application do not limit the file formats of the development file and the first build file. For example, the file formats of the development file and the first build file can both be JS files, and JS files are a type of JavaScript source code files. In addition, the development file can also be referred to as business logic. In computer software, business logic refers to code written according to real-world needs or required functions, which is used to control the main behavior of the application (i.e., the application client).
[0092] Among them, file construction can be referred to as construction (i.e. Build), which is the process of generating executable application files (i.e. executable files) from source code through tools (for example, file construction can be processed by compression, obfuscation, etc.), and the generated executable files are the construction products. Correspondingly, file construction can correspond to the build phase (Build Time), which refers to the phase in software development where code is converted into executable files or Web (i.e. web page) applications.
[0093] Among them, the specific process of the second terminal device extracting the string from the first construction file can be described as: the second terminal device can read the first construction file as a file string, and obtain the non-comment string from the file string. Further, the second terminal device can generate a regular expression for the first construction file, match the regular expression with the non-comment string, and obtain the string matching the regular expression from the non-comment string. Among them, the embodiment of the present application does not limit the number of regular expressions. For example, the regular expression can be "[^\x00-\xff]", and the regular expression "[^\x00-\xff]" can be used to match non-ASCII code characters (i.e., double-byte characters). Further, the second terminal device can determine the string matching the regular expression as the string to be converted in the first construction file. Therefore, the embodiment of the present application can quickly and accurately extract the string to be converted through a regular expression.
[0094] Wherein, the first construction file may include comment text and non-comment text, the file string may include comment strings corresponding to the comment text and non-comment strings corresponding to the non-comment text, and the comment strings and non-comment strings may be divided into strings by comment identifiers (i.e., the file string may be divided into strings by comment identifiers to obtain comment strings and non-comment strings in the file string). Wherein, the comment identifier may include a single-line comment identifier (for example, a single-line comment identifier may be " / / ", and the string after " / / " in a single line may be regarded as a comment string) and a multi-line comment identifier (for example, a multi-line comment identifier may be " / ** / ", and the string between " / *" and "* / " in multiple lines may be regarded as a comment string).
[0095] Optionally, the specific process of the second terminal device extracting the string from the first construction file can be described as follows: the second terminal device can read the first construction file as a file string, and obtain the non-annotation string from the file string. Further, the second terminal device can perform word segmentation processing on the non-annotation string to obtain the string segmentation in the non-annotation string. Further, the second terminal device can input the string segmentation into a feature extraction model, perform feature extraction on the string segmentation through the feature extraction model, and obtain the segmentation feature corresponding to the string segmentation. Further, the second terminal device can determine the language type corresponding to the string segmentation based on the segmentation feature corresponding to the string segmentation, and then determine the string to be converted in the first construction file based on the language type corresponding to the string segmentation. Therefore, the embodiment of the present application can quickly and accurately extract the string to be converted through the feature extraction model. For example, when the first language type is simplified Chinese, the second terminal device can obtain the string segmentation corresponding to simplified Chinese from the non-annotation string, and then determine the string segmentation corresponding to simplified Chinese as the string to be converted. For another example, when the first language type is Traditional Chinese, the second terminal device may obtain the string segmentation corresponding to Traditional Chinese from the non-annotation string, and then determine the string segmentation corresponding to Traditional Chinese as the string to be converted.
[0096] It is understandable that the second terminal device can obtain the first build file associated with the application client, copy the first build file, and generate the copied first build file. Further, the second terminal device can extract the string from the copied first build file to obtain the string to be converted in the copied first build file.
[0097] Among them, the first build file is located in the first file directory for the application client. It should be understood that the specific process of the second terminal device copying the first build file can be described as: the second terminal device can obtain the second file directory for the application client. Among them, the second file directory and the first file directory have the same parent directory. Further, the second terminal device copies the first build file in the first file directory to the second file directory to obtain the first build file after the file is copied in the second file directory. In other words, the second terminal device can copy the file (i.e., the first build file) constructed based on the first language type from the first file directory to the second file directory by copying.
[0098] Similarly, the specific process of the second terminal device performing string extraction on the first build file after the file is copied can be described as: the second terminal device can read the first build file after the file is copied as a file string, and obtain a non-comment string from the file string. Further, the second terminal device can generate a regular expression for the first build file after the file is copied, match the regular expression with the non-comment string, and obtain a string matching the regular expression from the non-comment string. Further, the second terminal device can determine the string matching the regular expression as the string to be converted in the first build file after the file is copied. Similarly, optionally, the second terminal device can perform string extraction on the first build file after the file is copied through a feature extraction model, which will not be described in detail here.
[0099] Among them, when the second terminal device copies the first build file, it needs to consider the relevant file path of the copy operation (for example, create a second file directory for the application client in advance) and permissions (for example, ensure that the second file directory for the application client has write permissions, and ensure that the first file directory for the application client has read permissions) to ensure that the conversion is completed smoothly.
[0100] For easier understanding, see Figure 4 , Figure 4 Schematic diagram of a scenario of copying files provided by an embodiment of the present application. Figure 4 As shown, the second terminal device may include a build directory (i.e., a build product directory) and a translation directory, where the build directory is the first file directory, and the translation directory is the second file directory. The build directory may be represented as A / M1 (e.g., dist / product), the translation directory may be represented as A / M2 (e.g., dist / product_zh-HK), A (i.e., dist) may represent the parent directory of the build directory and the translation directory, and M1 (i.e., product) and M2 (i.e., product_zh-HK) may represent folders in A.
[0101] like Figure 4As shown, here we take the example that both the build directory and the translation directory include two files (that is, the build directory can include two first build files, and the translation directory can include the first build file after the two files are copied). The two files can specifically include: B1.X1.js (for example, 1.adfs.js) and B2.X2.js (for example, 2.baad.js). Among them, the files in the translation directory are obtained by copying the files in the build directory; file B1.X1.js can be expressed as A / M1 / B1.X1.js (i.e. dist / product / 1.adfs.js) in the build directory, and file B1.X1.js can be expressed as A / M2 / B1.X1.js (i.e. dist / product_zh-HK / 1.adfs.js) in the translation directory; file B2.X2.js can be expressed as A / M1 / B2.X2.js (i.e. dist / product / 2.baad.js) in the build directory, and file B2.X2.js can be expressed as A / M2 / B2.X2.js (i.e. dist / product_zh-HK / 2.baad.js) in the translation directory.
[0102] Step S102, obtaining a converted string corresponding to the string to be converted, replacing the string to be converted with the converted string, and generating a second build file associated with the application client;
[0103] Specifically, the second terminal device can perform string deduplication on the string to be converted to generate a deduplicated string to be converted. Further, the second terminal device can compare the deduplicated string to be converted with the translation cache to generate a cache comparison result. Among them, the second terminal device can write the deduplicated string to be converted into a string array, and then compare each string to be converted in the string array with the translation cache to generate a cache comparison result corresponding to each string to be converted in the string array. Further, the second terminal device can obtain the converted string corresponding to the deduplicated string to be converted based on the cache comparison result. Further, the second terminal device can replace the string to be converted with the converted string to generate a second build file associated with the application client. Among them, the second build file has a second language type, and the first language type and the second language type are different.
[0104] It can be understood that the second terminal device can obtain the converted string corresponding to the string to be converted, and replace the string to be converted in the first build file after the file is copied with the converted string to generate a second build file associated with the application client. In other words, the second terminal device can replace the string to be converted in the first build file after the file is copied with the converted string.
[0105] Since the second build file is generated by replacing the converted string in the first build file after the file is copied, and the first build file after the file is copied is the same as the first build file, the file formats of the first build file and the second build file are the same. For example, the file formats of the first build file and the second build file can both be JS files.
[0106] Among them, the specific process of the second terminal device obtaining the converted string corresponding to the deduplicated string to be converted based on the cache comparison result can be described as: if the cache comparison result indicates that the translation cache includes the translation result corresponding to the deduplicated string to be converted (that is, the second terminal device translates the deduplicated string to be converted), then the second terminal device can obtain the converted string corresponding to the deduplicated string to be converted from the translation result corresponding to the deduplicated string to be converted. Optionally, if the cache comparison result indicates that the translation cache does not include the translation result corresponding to the deduplicated string to be converted (that is, the second terminal device has not translated the deduplicated string to be converted), the second terminal device can call the translation method provided by the language conversion library (that is, the API (Application Programming Interface) provided by the language conversion library), perform language conversion on the deduplicated string to be converted through the translation method, and generate the converted string corresponding to the deduplicated string to be converted. Among them, the language conversion library is initialized by a configuration file, and the configuration file includes string conversion rules (that is, conversion rules) between the first language type and the second language type.
[0107] Among them, optionally, the translation result corresponding to the deduplicated string to be converted may include the converted string corresponding to the deduplicated string to be converted, the number of converted strings in the translation result corresponding to the deduplicated string to be converted may be one or more, and the one or more converted strings may have different language types. Further, if the translation result corresponding to the deduplicated string to be converted includes a converted string of a second language type, the second terminal device may determine the converted string of the second language type in the translation result corresponding to the deduplicated string to be converted as the converted string corresponding to the deduplicated string to be converted. Optionally, if the translation result corresponding to the deduplicated string to be converted does not include a converted string of a second language type, the second terminal device may call the translation method provided by the language conversion library, perform language conversion on the deduplicated string to be converted through the translation method, and generate a converted string corresponding to the deduplicated string to be converted.
[0108] Further, if the cache comparison result indicates that the translation cache does not include the translation result corresponding to the deduplicated string to be converted, the second terminal device can also determine the converted string corresponding to the deduplicated string to be converted as the translation result corresponding to the deduplicated string to be converted after generating the converted string corresponding to the deduplicated string to be converted, and then write the translation result corresponding to the deduplicated string to be converted into the translation cache. Among them, by means of the translation cache, it is not necessary to perform language conversion on the deduplicated string to be converted by a translation method, but directly obtain the converted string corresponding to the deduplicated string to be converted from the translation cache, thereby improving the efficiency of obtaining the converted string corresponding to the deduplicated string to be converted. Therefore, the embodiment of the present application can use a cache mechanism to speed up the translation process, avoid repeated translation of the same string, and improve translation performance (i.e., achieve high performance translation, high performance means that the software (i.e., the application client) has a high running speed and efficiency while completing a certain function).
[0109] It should be understood that the embodiments of the present application do not limit the specific type of the language conversion library. For example, the language conversion library may be an opencc (Open Chinese Convert) library. The opencc library is an open source project (i.e., an open source conversion library) that can support character-level (i.e., word) conversion, phrase-level (i.e., word) conversion, dialect conversion, and regional idiom conversion, etc. (i.e., the character string to be converted may be character-level, phrase-level, dialect, and regional idiom, etc.).
[0110] The second terminal device needs to install the language conversion library before calling the translation method provided by the language conversion library. The second terminal device can install the language conversion library by running an installation command in a command line. For example, when the language conversion library is an opencc library, the installation command can be "npminstall opencc-save-dev".
[0111] Among them, the second terminal device needs to create a configuration file (for example, the configuration file can be a file opencc_config.json) before initializing the language conversion library through the configuration file. The configuration file can specify the conversion rules from the first language type to the second language type or the conversion rules from the second language type to the first language type (for example, the conversion rule can be ["Go to open an account": "Go to open an account"], "Go to open an account" can be Simplified Chinese, "Go to open an account" can be Traditional Chinese), therefore, the configuration file can also be called a custom vocabulary. It should be understood that the embodiment of the present application does not limit the file location of the configuration file in the second terminal device. For example, the configuration file can be located in the project root directory, and the project root directory can be the root directory of the development file.
[0112] For easier understanding, see Figure 5 , Figure 5 Schematic diagram of a scene of translating a string provided in an embodiment of the present application. Figure 5 Steps S51 to S58 shown may be a specific process in which the second terminal device generates a second build file associated with the application client based on the first build file associated with the application client.
[0113] like Figure 5 As shown, the second terminal device can execute step S51, read the file through step S51 (i.e., read the first built file after the file is copied), and then execute step S52, extract the string to be translated in the file through step S52 (i.e., extract the string to be converted in the first built file after the file is copied). Further, the second terminal device can execute step S53, deduplicate the string to be translated and store it in an array through step S53, that is, deduplicate the string to be converted, generate the deduplicated string to be converted, and then write the deduplicated string to be converted into the string array.
[0114] like Figure 5 As shown, the second terminal device can execute step S54, through which the strings to be converted in the string array are traversed, and it is determined whether the traversal is completed. Further, if the string array traversal is completed (i.e., all the strings to be converted in the string array are traversed), the second terminal device can execute step S55, through which the traversal of the string array is ended, and a second construction file associated with the application client is obtained.
[0115] like Figure 5 As shown, optionally, if the string array has not been traversed (i.e., not all the strings to be converted in the string array have been traversed), the second terminal device can execute step S56, and determine whether there is a translation result corresponding to the deduplicated string to be converted in the cache (i.e., the translation cache) through step S56. Further, if there is a translation result corresponding to the deduplicated string to be converted in the cache, the second terminal device can execute step S58, and replace all the strings in the file with the translation result through step S58, that is, obtain the converted string corresponding to the deduplicated string to be converted from the translation result corresponding to the deduplicated string to be converted, and replace the string to be converted in the first built file after the file is copied with the converted string.
[0116] like Figure 5As shown, optionally, if there is no translation result corresponding to the deduplicated string to be converted in the cache, the second terminal device can execute step S57, translate the string through step S57, and write the translation result into the cache, that is, perform language conversion on the deduplicated string to be converted through the translation method, generate a converted string corresponding to the deduplicated string to be converted, and write the converted string corresponding to the deduplicated string to be converted into the translation cache. Further, the second terminal device can execute step S58, and replace all the strings in the file with the translation results through step S58.
[0117] Furthermore, if Figure 5 As shown, the second terminal device may execute step S54 after executing step S58, and continue to traverse the string array through step S54 until the string array traversal is completed, thereby ending the process of step S51 to step S58.
[0118] It should be understood that the second terminal device can perform a hash operation on the second build file to generate a file hash value corresponding to the second build file (i.e., the second file hash value). Further, the second terminal device can determine the file name of the second build file (i.e., the second file name) based on the file hash value (i.e., the second file hash value). Among them, the file name of the second build file (i.e., the second file name) is different from the file name of the first build file (i.e., the first file name); the file name of the first build file (i.e., the first file name) and the file name of the second build file (i.e., the first file name) are used to distinguish the first build file from the second build file.
[0119] Similarly, the file name of the first build file (i.e., the first file name) is determined according to the file hash value corresponding to the first build file (i.e., the first file hash value), and the first file hash value is generated by performing a hash operation on the first build file. Among them, the embodiment of the present application does not limit the hash algorithm used for the hash operation. For example, the second terminal device can use the md5 algorithm (MD5 Message-Digest Algorithm, MD5 information digest algorithm) to calculate the hash value (i.e., the file hash value) based on the file content (e.g., the file content of the first build file); the second terminal device can use the SHA3 algorithm (Secure Hash Algorithm 3, the third generation secure hash algorithm) to calculate the hash value based on the file content.
[0120] Therefore, by setting different file names for the first build file and the second build file, it is possible to avoid application client cache errors (i.e., avoid the application client caching old build files), which may lead to invalid translation. For example, when the file names of the first build file and the second build file are the same, the first object accesses an application client with a first language type at time T1, and the first object accesses an application client with a second language type at time T2. Time T2 is the next time after time T1. Since the application client will give priority to using the cache, at time T2, the first terminal device will obtain the first build file with the same file name as the second build file from the cache, which will cause an error in the language type of the application client. However, when the file names of the first build file and the second build file are different, at time T2, the first terminal device will not obtain the second build file from the cache, which will not cause an error in the language type of the application client.
[0121] For easier understanding, please refer to Figure 4 , the file names of the two files in the build directory and the translation directory can be B1.X1.js (i.e. 1.adfs.js) and B2.X2.js (i.e. 2.baad.js), B1.X1.js and B2.X2.js can represent the first file name of the first build file, where X1 (i.e. adfs) can represent the file hash value of the file B1.X1.js (i.e. the first file hash value), and X2 (i.e. baad) can represent the file hash value of the file B2.X2.js (i.e. the first file hash value).
[0122] Further, after generating a second build file associated with the application client (for example, a second build file corresponding to file B1.X1.js and a second build file corresponding to file B2.X2.js), the second terminal device can generate a file hash value corresponding to the second build file (i.e., a second file hash value). For example, the second file hash value of the second build file corresponding to file B1.X1.js can be X3, and the second file hash value of the second build file corresponding to file B2.X2.js can be X4.
[0123] Further, the second terminal device may determine the file name of the second build file (i.e., the second file name) according to the second file hash value corresponding to the second build file, wherein the second file name of the second build file corresponding to the file B1.X1.js may be B1.X3.js (e.g., 1.lgkd.js), and the second file name of the second build file corresponding to the file B2.X2.js may be B2.X4.js (e.g., 2.ofid.js). In other words, X3 (lgkd) may represent the file hash value (i.e., the second file hash value) of the file B1.X3.js, and X4 (i.e., ofid) may represent the file hash value (i.e., the second file hash value) of the file B2.X4.js.
[0124] Among them, since the second build file is generated based on the first build file, the number of the first build file is the same as the number of the second build file, and the embodiment of the present application does not limit the number of the first build file and the number of the second build file. In addition, the application client in the embodiment of the present application can reference the function (or method) in the non-application client, and traverse the files in the build product through the construction phase, so that the text in the third-party dependency can also be translated.
[0125] Step S103: publishing the first build file and the second build file to the business server.
[0126] It can be understood that the files in the first file directory (i.e., the first build files) are of the first language type, and the files in the second file directory (i.e., the second build files) are of the second language type. Therefore, when the second terminal device deploys the first build files and the second build files to the server, it can modify the parent directories of the first file directory and the second file directory (for example, the above Figure 4 The dist directory in the corresponding embodiment) is deployed to the business server. Accordingly, the upper directory on the business server may include two directories: a first file directory and a second file directory, so that the business server can provide files of the first language type (i.e., the first build file) and files of the second language type (i.e., the second build file) at the same time to meet different language requirements. For ease of distinction, the embodiment of the present application may refer to the first file directory on the business server as the first server directory, and the second file directory on the business server as the second server directory.
[0127] Optionally, the second terminal device may also generate a third build file based on the first build file, the third build file having a third language type, and the third language type, the second language type and the first language type are different. In this way, the second terminal device may publish the first build file, the second build file and the third build file to the business server.
[0128] Among them, the business server is used to receive a client access request for an application client sent by the first terminal device (that is, the business server that publishes the first build file and the second build file is used to receive a client access request for an application client sent by the first terminal device); the business server is also used to determine a target language type from the first language type and the second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device (that is, the business server that publishes the first build file and the second build file is also used to determine a target language type from the first language type and the second language type based on the client access request, and return the target build file corresponding to the target language type to the first terminal device).
[0129] Among them, the client access request is sent by the first terminal device when it needs to access the application client or refresh the application client; the target build file is the first build file or the second build file; when the target language type is the first language type, the target build file corresponding to the target language type is the first build file; when the target language type is the second language type, the target build file corresponding to the target language type is the second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display the application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display the application client with the second language type.
[0130] It can be seen from this that the embodiment of the present application does not need to invade the development file, but after the front-end project is built (i.e., after the build file associated with the application client is generated based on the development file), the first build file in the construction phase is translated to obtain the second build file. Therefore, the embodiment of the present application can directly obtain the build file corresponding to the different language types according to the language environment used by the application client without modifying the first build file in the operation phase, thereby improving the development efficiency of the application client. In addition, the embodiment of the present application does not need to install the open source framework to realize the replacement of the translation function, and the overhead of the application client when running will not be increased, thereby reducing the operation consumption of the application client.
[0131] For further information, see Figure 6 , Figure 6 This is a flow chart of a data processing method provided by an embodiment of the present application. The method can be executed by a service server, or by a terminal device, or by both a service server and a terminal device. The service server can be the above-mentioned Figure 2 The corresponding service server 20a in the embodiment, the terminal device can be the above Figure 2The first terminal device 20b or the second terminal device 20c of the corresponding embodiment. For ease of understanding, the embodiment of the present application takes the method executed by the business server as an example for explanation. Among them, the data processing method may include the following steps S201-S202:
[0132] Step S201, receiving a first build file and a second build file published by a second terminal device;
[0133] Among them, the first build file has a first language type, the second build file has a second language type, and the first language type and the second language type are different; the first build file and the second build file are both associated with the application client; the second build file is generated by replacing the string to be converted by the converted string corresponding to the string to be converted in the first build file, and the string to be converted is obtained by string extraction from the first build file.
[0134] The second terminal device replaces the string to be converted with the converted string corresponding to the string to be converted in the first construction file, and extracts the string from the first construction file. For details, see the above Figure 3 The description of step S101 - step S102 in the corresponding embodiment will not be repeated here.
[0135] It should be understood that after the business server receives the first build file and the second build file published by the second terminal device, the application client can be in the running stage (Runtime). The running stage refers to the stage in which the object is used after the product under development of the software (ie, the application client) is officially launched.
[0136] Step S202: receiving a client access request for an application client sent by a first terminal device, determining a target language type from a first language type and a second language type based on the client access request, and returning a target build file corresponding to the target language type to the first terminal device.
[0137] Among them, the client access request is sent by the first terminal device when it needs to access the application client or refresh the application client; the target build file is the first build file or the second build file; when the target language type is the first language type, the target build file corresponding to the target language type is the first build file; when the target language type is the second language type, the target build file corresponding to the target language type is the second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display the application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display the application client with the second language type.
[0138] Optionally, the client access request includes session language information; the first build file is located in the first server directory, and the second build file is located in the second server directory. It should be understood that the business server can determine the language type indicated in the session language information in the first language type and the second language type as the target language type. Further, the business server can rewrite the client access request by the target language type to obtain a rewritten client access request. Among them, the file path in the rewritten client access request points to the target server directory corresponding to the target language type; if the target language type is the first language type, the target server directory is the first server directory; if the target language type is the second language type, the target server directory is the second server directory. Further, the business server can return the target build file corresponding to the target language type in the target server directory to the first terminal device.
[0139] The session language information (i.e., target_language) may be the information for setting the language in the cookie, and the cookie may be the information carried by the client access request when the first terminal device sends the client access request. The cookie is a text file stored in the directory of the computer browser, which is used to record the relevant data information of the website visitor (e.g., session language information). Accordingly, the business server may determine the language type indicated by the session language information in the first language type and the second language type according to the value of the session language information (i.e., the attribute value), and point the path in the client access request to the corresponding directory; in other words, the business server may rewrite the client access request according to the value of the session language information.
[0140] It can be understood that if the attribute value of the session language information is a type string corresponding to the first language type, the service server can determine that the language type indicated by the session language information in the first language type and the second language type is the first language type; optionally, if the attribute value of the session language information is a type string corresponding to the second language type, the service server can determine that the language type indicated by the session language information in the first language type and the second language type is the second language type. For example, the first language type may be Simplified Chinese, the second language type may be Traditional Chinese, the type string corresponding to the first language type may be zh_CN or zh-CN, and the type string corresponding to the second language type may be zh_HK or zh-HK.
[0141] Optionally, the client access request includes header information (i.e., header information), and the header information includes an object proxy (i.e., the client access request includes an object proxy); the first build file is located in the first server directory, and the second build file is located in the second server directory. It should be understood that if the object proxy includes a type string corresponding to the first language type, the business server can determine the first language type as the target language type, determine the first build file in the first server directory as the target build file corresponding to the target language type, and return the target build file to the first terminal device. Optionally, if the object proxy does not include a type string corresponding to the first language type, the business server can determine the second language type as the target language type, determine the second build file in the second server directory as the target build file corresponding to the target language type, and return the target build file to the first terminal device. For example, the first language type may be Simplified Chinese, the second language type may be Traditional Chinese, and the type string corresponding to the first language type may be zh_CN or zh-CN.
[0142] The header information is part of the HTTP protocol (Hypertext Transfer Protocol), and the HTTP header information may include a request header and a response header. The response header includes the response information sent by the service server to the first terminal device, such as the response status code, the response header field, the response message body, etc.; the request header includes the request information sent by the first terminal device to the service server, such as the request method, the request URL (Uniform Resource Locator), the request header field, the request message body, etc.
[0143] The business server may determine whether the client access request includes session language information, and then obtain the session language information in the client access request when the client access request includes the session language information. Optionally, the business server may determine whether the client access request includes an object proxy when determining that the client access request does not include the session language information, and then obtain the object proxy in the client access request when the client access request includes the object proxy.
[0144] Optionally, if the client access request does not include session language information and header information, the business server may determine the default language type as the target language type and return the target build file corresponding to the target language type to the first terminal device. The default language type may be the first language type or the second language type, which is not limited in this application.
[0145] Optionally, after receiving a client access request for an application client sent by the first terminal device, the business server may also return the first build file and the second build file to the first terminal device based on the client access request, so that the first terminal device can display an application client of the first language type (i.e., display an application client of the first language type based on the first build file) or display an application client of the second language type (i.e., display an application client of the second language type based on the second build file) based on the language environment used by the application client. In other words, the first terminal device can display an application client of the first language type or display an application client of the second language type based on the stored session language information or header information.
[0146] It is understandable that the collection and processing of relevant data in this application (for example, session language information and header information) should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0147] It should be understood that the business server can receive the dynamic data acquisition request sent by the first terminal device, and obtain the dynamic content corresponding to the dynamic data acquisition request. Among them, the dynamic content can be the dynamic data obtained by the business server through the background interface, and the dynamic data can represent the non-fixed data in the application client, but the data obtained dynamically. Further, if the language type of the dynamic content is the same as the language type displayed in the application client of the first terminal device, the business server can return the dynamic content to the first terminal device. Optionally, if the language type of the dynamic content is different from the language type displayed in the application client of the first terminal device, the business server can translate the dynamic content through the translation service, obtain the dynamic content after the content translation, and return the dynamic content after the content translation to the first terminal device. Among them, the language type of the dynamic content after the content translation is the same as the language type displayed in the application client of the first terminal device; the translation service can be a translation service API built on the business server using the language conversion library. After the interface business logic is processed (that is, after the dynamic content is obtained), the business server can call the translation service to translate the interface return content (that is, dynamic content).
[0148] The business server may determine the target language type from the first language type and the second language type based on the dynamic data acquisition request, and then determine the target language type as the language type displayed in the application client of the first terminal device. The dynamic data acquisition request may include session language information or object proxy. The specific process of the business server determining the target language type based on the dynamic data acquisition request can refer to the above description of determining the target language type based on the client access request, which will not be repeated here.
[0149] For easier understanding, see Figure 7 , Figure 7 Schematic diagram of a scenario for publishing a file provided by an embodiment of the present application. Figure 7 The business server shown may include server software R1 and server software R2 (for example, server software R1 may be Nginx, and server software R2 may be Apache), and server software R1 and server software R2 may implement different functions in the business server. The server software R1 and server software R2 may be the same server software or different server software.
[0150] like Figure 7 As shown, the business server can judge the request parameters through the server software R1, that is, obtain the session language information or object proxy in the client access request, determine the target language type in the first language type and the second language type based on the session language information or the object proxy, and return the target server directory corresponding to the target language type. The business server may include a directory M1 and a directory M2, the directory M1 may be the first server directory, and the directory M2 may be the second server directory. Therefore, the directory M1 may be a directory corresponding to the first language type, and the directory M2 may be a directory corresponding to the second language type.
[0151] like Figure 7 As shown, the business server can call the translation service through the server software R2 to translate the dynamic content returned by the interface layer to obtain the translated dynamic content. Among them, the interface layer can represent the background interface provided by the business server.
[0152] like Figure 7As shown, the second terminal device can obtain the development files and configuration files (i.e., custom vocabulary) associated with the application client from the business warehouse (i.e., code warehouse, which can be a folder for storing code and used to manage the code), perform file construction on the development files, and generate a construction product W1. Among them, the construction product W1 may include one or more first construction files (for example, the first construction file 70a). Furthermore, the second terminal device can perform file translation on the first construction file 70a through a translator (Translate Engine) to obtain a second construction file 70b corresponding to the first construction file 70a, and then generate a construction product W2 based on the second construction files corresponding to one or more first construction files (for example, the second construction file 70b corresponding to the first construction file 70a).
[0153] Among them, the translator can perform the above Figure 3 Step S101-step S102 in the corresponding embodiment. In the process of the translator executing step S101-step S102, it is necessary to call the language conversion library through the adapter (Engine Adapter) and use the self-defined word library. Among them, the adapter can also be called an adaptation layer, and the adaptation layer can keep the API calls of different language conversion libraries consistent (for example, the adaptation layer can be set to call different methods for different language conversion libraries), and the underlying method calls will not change due to the replacement of the language conversion library.
[0154] like Figure 7 As shown, the second terminal device can publish build products W1 and build products W2 to the business server (i.e., upload build products W1 and build products W2), that is, publish one or more first build files to the directory M1 in the business server, and publish one or more second build files to the directory M2 in the business server.
[0155] It can be seen that, after receiving the first build file and the second build file published by the second terminal device, the business server in the embodiment of the present application can receive the client access request for the application client sent by the first terminal device, determine the target language type in the first language type and the second language type based on the client access request, and return the target build file corresponding to the target language type to the first terminal device. Therefore, the embodiment of the present application can access the directory of the corresponding language type in the business server (for example, the first server directory, the second server directory) according to the language type set by the application client, thereby improving the development efficiency of the application client and reducing the operation consumption of the application client.
[0156] For further information, see Figure 8 , Figure 8This is a flow chart of a data processing method provided by an embodiment of the present application. The method can be executed by a service server, or by a terminal device, or by both a service server and a terminal device. The service server can be the above-mentioned Figure 2 The corresponding service server 20a in the embodiment, the terminal device can be the above Figure 2 The first terminal device 20b or the second terminal device 20c of the corresponding embodiment. For ease of understanding, the embodiment of the present application takes the method executed by the first terminal device as an example for explanation. Among them, the data processing method may include the following steps S301-S302:
[0157] Step S301, sending a client access request for an application client to a business server;
[0158] The business server is further used to determine the target language type from the first language type and the second language type based on the client access request, and return the target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file.
[0159] It should be understood that when the first object needs to access the application client, the first object can send a client access request for the application client to the business server through the first terminal device. Optionally, when the first object needs to refresh the application client, the first object can send a client access request for the application client to the business server through the first terminal device. For example, the application client can be a browser, and when the first object needs to access a web page through the browser (for example, the first object accesses a link to the homepage), the first object can send a client access request for the application client to the business server through the first terminal device; when the first object needs to refresh the web page in the browser, the first object can send a client access request for the application client to the business server through the first terminal device.
[0160] The specific process of the service server determining the target language type from the first language type and the second language type based on the client access request can be found in the above Figure 6 The description of step S202 in the corresponding embodiment will not be repeated here.
[0161] Step S302: receiving a target build file returned by the business server, and displaying the application client based on the target build file.
[0162] Specifically, the first terminal device may receive the target build file returned by the business server. Further, if the target build file is the first build file, the first terminal device may display an application client of the first language type (i.e., display a web page of the first language type in the application client). Optionally, if the target build file is the second build file, the first terminal device may display an application client of the second language type (i.e., display a web page of the second language type in the application client).
[0163] It should be understood that the first terminal device can display a language switching control in the application client, that is, design a multi-language related setting button on the setting page for the object to switch the language. Among them, the language switching control may include a first language control and a second language control; optionally, the language switching control may also include other language switching controls in addition to the first language control and the second language control, and the embodiment of the present application does not limit the number of language switching controls. Further, when the first terminal device displays an application client with a first language type, the first terminal device may respond to a trigger operation performed on the second language control and switch the application client with the first language type to an application client with a second language type. Optionally, when the first terminal device displays an application client with a second language type, the first terminal device may respond to a trigger operation performed on the first language control and switch the application client with the second language type to an application client with the first language type.
[0164] It can be understood that when the first terminal device responds to the trigger operation performed by the first object on the first language control or the second language control (that is, when the first object switches the language type of the application client), the first terminal device needs to set the session language information, and save the language type selected by the first object through the session language information. If the first object performs a trigger operation on the first language control (that is, the first object switches the application client to the first language type), the first terminal device can set the session language information to the type string corresponding to the first language type; optionally, if the first object performs a trigger operation on the second language control (that is, the first object switches the application client to the second language type), the first terminal device can set the session language information to the type string corresponding to the second language type. For example, the first language type can be Simplified Chinese, the second language type can be Traditional Chinese, the type string corresponding to the first language type can be zh_CN or zh-CN, and the type string corresponding to the second language type can be zh_HK or zh-HK. At this time, the code for switching to Simplified Chinese can be "document.cookie="target_language="zh-CN";", and the code for switching to Traditional Chinese can be "document.cookie="target_language="zh-HK";", so that when the first object switches the language type of the application client, the cookie is automatically updated to record the language selection of the first object.
[0165] Furthermore, after the first terminal device sets the device session language information, it needs to reload the page (that is, the first object needs to refresh the application client, and the first terminal device needs to resend the client access request for the application client to the business server based on the set session language information) to make the setting of the session language information take effect.
[0166] For easier understanding, see Fig. 9 , Fig. 9 is a schematic diagram of a language switching scenario provided by an embodiment of the present application. Fig. 9 The client interface 90a and the client interface 90b shown may be the client interfaces of the application client in the first terminal device at different times. The first terminal device may display the first language control 91a, the second language control 91b and the language description information 91c in the client interface 90a and the client interface 90b. When the first object clicks the corresponding control (i.e., the first language control 91a or the second language control 91b), the text of the application client will switch to the corresponding language font. For ease of understanding, the first language type is simplified Chinese and the second language type is traditional Chinese as an example for explanation.
[0167] like Fig. 9As shown, when the first terminal device displays an application client with a first language type, the first terminal device can display a client interface 90a in the application client. At this time, the first language control 91a is in a selected state, and the description information (i.e., Simplified Chinese) of the first language control 91a in the selected state has the first language type; the second language control 91b is in an unselected state, and the description information (i.e., Traditional Chinese) of the second language control 91b in the unselected state has the second language type; the language description information 91c has the first language type. Further, the first object can perform a language switching operation on the application client (for example, the first object can perform a trigger operation on the second language control 91b in the unselected state), so that the first terminal device can respond to the trigger operation performed by the first object on the second language control 91b in the unselected state, and switch the application client with the first language type to the application client with the second language type, that is, switch the client interface 90a to the client interface 90b.
[0168] like Fig. 9 As shown, when the first terminal device displays an application client with a second language type, the first terminal device can display a client interface 90b in the application client. At this time, the first language control 91a is in an unselected state, and the description information (i.e., Simplified Chinese) of the first language control 91a in an unselected state has the first language type; the second language control 91b is in a selected state, and the description information (i.e., Traditional Chinese) of the second language control 91b in a selected state has the second language type; the language description information 91c has the second language type. Further, the first object can perform a language switching operation on the application client (for example, the first object can perform a trigger operation on the first language control 91a in an unselected state), so that the first terminal device can respond to the trigger operation performed by the first object on the first language control 91a in an unselected state, and switch the application client with the second language type to the application client with the first language type, that is, switch the client interface 90b to the client interface 90a.
[0169] It should be understood that the first terminal device can send a dynamic data acquisition request to the business server when it needs to access the dynamic content in the application client. The business server is used to obtain the dynamic content corresponding to the dynamic data acquisition request. Further, if the language type of the dynamic content is the same as the language type displayed in the application client of the first terminal device, the first terminal device can receive the dynamic content returned by the business server. Optionally, if the language type of the dynamic content is different from the language type displayed in the application client of the first terminal device, the first terminal device can receive the dynamic content after content translation returned by the business server. The dynamic content after content translation is obtained by the business server translating the dynamic content through a translation service, and the language type of the dynamic content after content translation is the same as the language type displayed in the application client of the first terminal device.
[0170] It can be seen that, after the second terminal device publishes the first build file and the second build file to the business server, the first terminal device in the embodiment of the present application can send a client access request for the application client to the business server, and then receive the target build file returned by the business server, and display the application client based on the target build file. Therefore, the embodiment of the present application can access the directory of the corresponding language type in the business server (for example, the first server directory, the second server directory) according to the language type set by the application client, thereby improving the development efficiency of the application client and reducing the operation consumption of the application client.
[0171] For further information, see Fig.10 , Fig.10 1 is a structural diagram of a data processing device provided in an embodiment of the present application. The data processing device 1 may include: a file acquisition module 11, a file generation module 12, and a file publishing module 13; further, the data processing device 1 may also include: a hash operation module 14, and a name determination module 15;
[0172] The file acquisition module 11 is used to acquire a first construction file associated with the application client, extract character strings from the first construction file, and obtain character strings to be converted in the first construction file; the first construction file has a first language type;
[0173] The file acquisition module 11 includes: a file acquisition unit 111, a file construction unit 112, a string acquisition unit 113, an expression generation unit 114, and a string determination unit 115;
[0174] The file acquisition unit 111 is used to acquire a development file associated with the application client; the development file is obtained by writing a file of the application client in the first language type;
[0175] The file construction unit 112 is used to perform file construction on the development file to generate a first construction file associated with the application client.
[0176] The character string obtaining unit 113 is used to read the first construction file as a file character string, and obtain a non-comment character string from the file character string;
[0177] An expression generating unit 114, configured to generate a regular expression for the first build file, match the regular expression with a non-comment string, and obtain a string matching the regular expression from the non-comment string;
[0178] The character string determining unit 115 is used to determine the character string matching the regular expression as the character string to be converted in the first construction file.
[0179] The specific implementation of the file acquisition unit 111, the file construction unit 112, the string acquisition unit 113, the expression generation unit 114, and the string determination unit 115 can be found in the above Figure 3 The description of step S101 in the corresponding embodiment will not be repeated here.
[0180] The file generation module 12 is used to obtain a converted string corresponding to the string to be converted, replace the string to be converted with the converted string, and generate a second construction file associated with the application client; the second construction file has a second language type; the first language type and the second language type are different;
[0181] The file generation module 12 includes: a string deduplication unit 121, a first acquisition unit 122, and a second acquisition unit 123;
[0182] A string deduplication unit 121, used for deduplicating the string to be converted and generating a deduplicated string to be converted;
[0183] A string deduplication unit 121, used to compare the deduplicated string to be converted with the translation cache to generate a cache comparison result;
[0184] A first acquisition unit 122 is configured to acquire a converted string corresponding to the deduplicated string to be converted from the translation result corresponding to the deduplicated string to be converted if the cache comparison result indicates that the translation cache includes the translation result corresponding to the deduplicated string to be converted;
[0185] The second acquisition unit 123 is used to call the translation method provided by the language conversion library if the cache comparison result indicates that the translation cache does not include the translation result corresponding to the deduplicated string to be converted, and perform language conversion on the deduplicated string to be converted through the translation method to generate a converted string corresponding to the deduplicated string to be converted; the language conversion library is initialized through a configuration file; the configuration file includes string conversion rules between the first language type and the second language type.
[0186] The specific implementation of the string deduplication unit 121, the first acquisition unit 122, and the second acquisition unit 123 can be found in the above Figure 3 The description of step S102 in the corresponding embodiment will not be repeated here.
[0187] The file acquisition module 11 is specifically used to copy the first build file to generate the copied first build file;
[0188] The file acquisition module 11 is specifically used to extract the character string from the first built file after the file is copied, and obtain the character string to be converted in the first built file after the file is copied;
[0189] The file generation module 12 is specifically used to obtain a converted string corresponding to the to-be-converted string, replace the to-be-converted string in the copied first build file with the converted string, and generate a second build file associated with the application client.
[0190] The first build file is located in the first file directory for the application client;
[0191] The file acquisition module 11 is specifically used to acquire a second file directory for the application client; the second file directory and the first file directory have the same parent directory;
[0192] The file acquisition module 11 is specifically used to copy the first construction file in the first file directory to the second file directory to obtain the copied first construction file in the second file directory.
[0193] The file publishing module 13 is used to publish the first build file and the second build file to the business server; the business server is used to receive a client access request for the application client sent by the first terminal device; the business server is also used to determine the target language type from the first language type and the second language type based on the client access request, and return the target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display the application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display the application client with the second language type.
[0194] Optionally, a hash operation module 14 is used to perform a hash operation on the second build file to generate a file hash value corresponding to the second build file;
[0195] The name determination module 15 is used to determine the file name of the second build file according to the file hash value; the file name of the second build file is different from the file name of the first build file; the file name of the first build file and the file name of the second build file are used to distinguish the first build file from the second build file.
[0196] The specific implementation of the file acquisition module 11, the file generation module 12, the file publishing module 13, the hash operation module 14, and the name determination module 15 can be found in the above Figure 3 The description of step S101 to step S103 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.
[0197] For further information, see Fig.11 , Fig.11 2 is a structural diagram of a data processing device provided in an embodiment of the present application. The data processing device 2 may include: a file receiving module 21, a request receiving module 22; further, the data processing device 2 may also include: a content obtaining module 23, a content returning module 24;
[0198] The file receiving module 21 is used to receive a first build file and a second build file published by a second terminal device; the first build file has a first language type; the second build file has a second language type; the first language type and the second language type are different; the first build file and the second build file are both associated with the application client; the second build file is generated by replacing the string to be converted by the converted string corresponding to the string to be converted in the first build file; the string to be converted is obtained by extracting the string from the first build file;
[0199] The request receiving module 22 is used to receive a client access request for an application client sent by a first terminal device, determine a target language type from a first language type and a second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device; the target build file is a first build file or a second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0200] The client access request includes session language information; the first construction file is located in the first server directory, and the second construction file is located in the second server directory;
[0201] A request receiving module 22, specifically configured to determine the language type indicated in the first language type and the second language type of the conversation language information as the target language type;
[0202] The request receiving module 22 is specifically used to rewrite the client access request according to the target language type to obtain a rewritten client access request; the file path in the rewritten client access request points to the target server directory corresponding to the target language type; if the target language type is the first language type, the target server directory is the first server directory; if the target language type is the second language type, the target server directory is the second server directory;
[0203] The request receiving module 22 is specifically configured to return the target build file corresponding to the target language type in the target server directory to the first terminal device.
[0204] The client access request includes header information; the header information includes an object proxy; the first build file is located in a first server directory, and the second build file is located in a second server directory;
[0205] The request receiving module 22 is specifically configured to determine the first language type as the target language type if the object proxy includes a type string corresponding to the first language type, determine the first build file in the first server directory as the target build file corresponding to the target language type, and return the target build file to the first terminal device;
[0206] The request receiving module 22 is specifically used to determine the second language type as the target language type if the object proxy does not include the type string corresponding to the first language type, determine the second build file in the second server directory as the target build file corresponding to the target language type, and return the target build file to the first terminal device.
[0207] Optionally, the content acquisition module 23 is used to receive a dynamic data acquisition request sent by the first terminal device, and acquire dynamic content corresponding to the dynamic data acquisition request;
[0208] A content returning module 24, configured to return the dynamic content to the first terminal device if the language type of the dynamic content is the same as the language type displayed in the application client of the first terminal device;
[0209] The content return module 24 is used to translate the dynamic content through a translation service to obtain the translated dynamic content if the language type of the dynamic content is different from the language type displayed in the application client of the first terminal device, and return the translated dynamic content to the first terminal device; the language type of the translated dynamic content is the same as the language type displayed in the application client of the first terminal device.
[0210] The specific implementation of the file receiving module 21, the request receiving module 22, the content obtaining module 23, and the content returning module 24 can be found in the above Figure 6 The description of step S201-step S202 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.
[0211] For further information, see Fig.12 , Fig.12 1 is a schematic diagram of a computer device provided in an embodiment of the present application, and the computer device may be a terminal device or a service server. Fig.12 As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. Optionally, the network interface 1004 may include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. Optionally, the memory 1005 may also be at least one storage device located away from the aforementioned processor 1001. As Fig.12 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0212] In such Fig.12 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0213] Acquire a first build file associated with the application client, extract character strings from the first build file, and obtain character strings to be converted in the first build file; the first build file has a first language type;
[0214] Obtaining a converted string corresponding to the string to be converted, replacing the string to be converted with the converted string, and generating a second build file associated with the application client; the second build file has a second language type; the first language type and the second language type are different;
[0215] The first build file and the second build file are published to the business server; the business server is used to receive a client access request for an application client sent by the first terminal device; the business server is also used to determine a target language type from the first language type and the second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0216] receiving a first build file and a second build file published by a second terminal device; the first build file has a first language type; the second build file has a second language type; the first language type and the second language type are different; the first build file and the second build file are both associated with an application client; the second build file is generated by replacing a string to be converted by a converted string corresponding to the string to be converted in the first build file; the string to be converted is obtained by extracting a string from the first build file;
[0217] A client access request for an application client sent by a first terminal device is received, a target language type is determined from a first language type and a second language type based on the client access request, and a target build file corresponding to the target language type is returned to the first terminal device; the target build file is a first build file or a second build file; if the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client with the first language type; if the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client with the second language type.
[0218] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 , Figure 6 and Figure 8 The description of the data processing method in the corresponding embodiment can also be performed as described above. Fig.10 In the corresponding embodiment, the data processing device 1 and Fig.11 The description of the data processing device 2 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.
[0219] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores the computer program executed by the data processing device 1 and the data processing device 2 mentioned above. When the processor executes the computer program, it can execute the above-mentioned Figure 3 , Figure 6 and Figure 8 The description of the data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0220] In addition, it should be noted that: the embodiment of the present application also provides a computer program product, which may include a computer program, and the computer program may be stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor may execute the computer program, so that the computer device performs the above Figure 3 , Figure 6 and Figure 8 The description of the data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer program product embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0221] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0222] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, characterized in that: include: Acquire a first build file associated with the application client, extract strings from the first build file, and obtain strings to be converted in the first build file; The first build file has a first language type; Obtaining a converted string corresponding to the string to be converted, replacing the string to be converted with the converted string, and generating a second build file associated with the application client; The second build file has a second language type; the first language type and the second language type are different; Publishing the first construction file and the second construction file to a business server; the business server is used to receive a client access request for the application client sent by the first terminal device; The business server is further configured to determine a target language type from the first language type and the second language type based on the client access request, and return a target construction file corresponding to the target language type to the first terminal device; the target construction file is the first construction file or the second construction file; If the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client having the first language type; If the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client having the second language type.
2. The method according to claim 1, characterized in that The obtaining of a first construction file associated with the application client includes: Acquire a development file associated with the application client; the development file is obtained by writing a file of the application client in a first language type; The development file is constructed to generate a first construction file associated with the application client.
3. The method according to claim 1, characterized in that The extracting the character string from the first construction file to obtain the character string to be converted in the first construction file includes: Copying the first build file to generate a copied first build file; Extracting a character string from the first built file after the file is copied, to obtain a character string to be converted in the first built file after the file is copied; The step of obtaining a converted string corresponding to the string to be converted, replacing the string to be converted with the converted string, and generating a second build file associated with the application client includes: A converted string corresponding to the string to be converted is obtained, and the string to be converted in the copied first build file is replaced by the converted string to generate a second build file associated with the application client.
4. The method according to claim 3, characterized in that The first construction file is located in a first file directory for the application client; The step of copying the first construction file to generate the copied first construction file includes: Acquire a second file directory for the application client; the second file directory and the first file directory have the same parent directory; The first construction file in the first file directory is copied to the second file directory to obtain the first construction file after the file in the second file directory is copied.
5. The method according to claim 1, characterized in that The extracting the character string from the first construction file to obtain the character string to be converted in the first construction file includes: Reading the first construction file as a file string, and obtaining a non-comment string from the file string; Generate a regular expression for the first build file, match the regular expression with the non-comment character string, and obtain a character string matching the regular expression from the non-comment character string; A character string matching the regular expression is determined as a character string to be converted in the first construction file.
6. The method according to claim 1, characterized in that The step of obtaining a converted character string corresponding to the character string to be converted includes: De-duplicating the character string to be converted to generate a de-duplicated character string to be converted; Comparing the deduplicated character string to be converted with the translation cache to generate a cache comparison result; If the cache comparison result indicates that the translation cache includes the translation result corresponding to the deduplicated string to be converted, obtaining the converted string corresponding to the deduplicated string to be converted from the translation result corresponding to the deduplicated string to be converted; If the cache comparison result indicates that the translation cache does not include the translation result corresponding to the deduplicated string to be converted, the translation method provided by the language conversion library is called, and the language conversion is performed on the deduplicated string to be converted by the translation method to generate a converted string corresponding to the deduplicated string to be converted; the language conversion library is initialized by a configuration file; the configuration file includes string conversion rules between the first language type and the second language type.
7. The method according to claim 1, characterized in that The method further comprises: Performing a hash operation on the second build file to generate a file hash value corresponding to the second build file; The file name of the second build file is determined according to the file hash value; the file name of the second build file is different from the file name of the first build file; the file name of the first build file and the file name of the second build file are used to distinguish the first build file from the second build file.
8. A data processing method, characterized in that: include: Receiving a first build file and a second build file published by a second terminal device; The first construction file has a first language type; the second construction file has a second language type; the first language type and the second language type are different; the first construction file and the second construction file are both associated with an application client; the second construction file is generated by replacing the string to be converted in the first construction file with a converted string corresponding to the string to be converted; the string to be converted is obtained by extracting a string from the first construction file; receiving a client access request for the application client sent by a first terminal device, determining a target language type from the first language type and the second language type based on the client access request, and returning a target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file; If the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client having the first language type; If the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client having the second language type.
9. The method according to claim 8, characterized in that The client access request includes session language information; the first construction file is located in a first server directory, and the second construction file is located in a second server directory; The determining a target language type from the first language type and the second language type based on the client access request, and returning a target build file corresponding to the target language type to the first terminal device, includes: determining the language type indicated by the conversation language information in the first language type and the second language type as a target language type; The client access request is rewritten by the target language type to obtain a rewritten client access request; the file path in the rewritten client access request points to a target server directory corresponding to the target language type; if the target language type is the first language type, the target server directory is the first server directory; if the target language type is the second language type, the target server directory is the second server directory; The target build file corresponding to the target language type in the target server directory is returned to the first terminal device.
10. The method according to claim 8, characterized in that The client access request includes header information; the header information includes an object proxy; the first construction file is located in a first server directory, and the second construction file is located in a second server directory; The determining a target language type from the first language type and the second language type based on the client access request, and returning a target build file corresponding to the target language type to the first terminal device, includes: If the object proxy includes a type string corresponding to the first language type, determining the first language type as a target language type, determining the first build file in the first server directory as a target build file corresponding to the target language type, and returning the target build file to the first terminal device; If the object proxy does not include a type string corresponding to the first language type, the second language type is determined as a target language type, the second build file in the second server directory is determined as a target build file corresponding to the target language type, and the target build file is returned to the first terminal device.
11. The method according to claim 8, characterized in that The method further comprises: Receiving a dynamic data acquisition request sent by the first terminal device, and acquiring dynamic content corresponding to the dynamic data acquisition request; If the language type of the dynamic content is the same as the language type displayed in the application client of the first terminal device, returning the dynamic content to the first terminal device; If the language type of the dynamic content is different from the language type displayed in the application client of the first terminal device, the dynamic content is translated through a translation service to obtain the translated dynamic content, and the translated dynamic content is returned to the first terminal device; the language type of the translated dynamic content is the same as the language type displayed in the application client of the first terminal device.
12. A data processing device, characterized in that: include: A file acquisition module is used to acquire a first construction file associated with the application client, and extract character strings from the first construction file to obtain character strings to be converted in the first construction file; the first construction file has a first language type; A file generation module, configured to obtain a converted string corresponding to the string to be converted, replace the string to be converted with the converted string, and generate a second build file associated with the application client; The second build file has a second language type; the first language type and the second language type are different; A file publishing module, used for publishing the first construction file and the second construction file to a business server; the business server is used for receiving a client access request for the application client sent by the first terminal device; The business server is further configured to determine a target language type from the first language type and the second language type based on the client access request, and return a target construction file corresponding to the target language type to the first terminal device; the target construction file is the first construction file or the second construction file; If the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client having the first language type; If the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client having the second language type.
13. A data processing device, characterized in that: include: A file receiving module, used for receiving a first construction file and a second construction file published by a second terminal device; The first build file has a first language type; The second construction file has a second language type; the first language type and the second language type are different; the first construction file and the second construction file are both associated with an application client; the second construction file is generated by replacing the string to be converted in the first construction file with a converted string corresponding to the string to be converted; the string to be converted is obtained by extracting a string from the first construction file; a request receiving module, configured to receive a client access request for the application client sent by a first terminal device, determine a target language type from the first language type and the second language type based on the client access request, and return a target build file corresponding to the target language type to the first terminal device; the target build file is the first build file or the second build file; If the target build file is the first build file, the first build file is used to instruct the first terminal device to display an application client having the first language type; If the target build file is the second build file, the second build file is used to instruct the first terminal device to display an application client having the second language type.
14. A computer device, characterized in that: include: Processor and memory; The processor is connected to the memory, wherein the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 11.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.
16. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium and is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.