CN109918166B - Applet processing method and device and electronic equipment - Google Patents

Applet processing method and device and electronic equipment Download PDF

Info

Publication number
CN109918166B
CN109918166B CN201910183388.6A CN201910183388A CN109918166B CN 109918166 B CN109918166 B CN 109918166B CN 201910183388 A CN201910183388 A CN 201910183388A CN 109918166 B CN109918166 B CN 109918166B
Authority
CN
China
Prior art keywords
applet
language type
text
language
initial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910183388.6A
Other languages
Chinese (zh)
Other versions
CN109918166A (en
Inventor
俞亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin ByteDance Technology Co Ltd
Original Assignee
Tianjin ByteDance Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin ByteDance Technology Co Ltd filed Critical Tianjin ByteDance Technology Co Ltd
Priority to CN201910183388.6A priority Critical patent/CN109918166B/en
Publication of CN109918166A publication Critical patent/CN109918166A/en
Application granted granted Critical
Publication of CN109918166B publication Critical patent/CN109918166B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure provides an applet processing method, an applet processing device and electronic equipment, wherein the method comprises the steps of determining a first language type of an application of a currently started applet; translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text; the target text is substituted for the initial text. By the method and the device, automatic replacement of the type of the small program text language can be performed in time when the small program is started by application, and international adaptation of the small program text language is effectively realized.

Description

Applet processing method and device and electronic equipment
Technical Field
The present disclosure relates to the technical field of electronic devices, and in particular, to an applet processing method and apparatus, and an electronic device.
Background
The small Program, the English name Mini Program, is an application which can be used without downloading and installing, realizes the dream of 'being reachable by a touch hand' of the application, and is an application which can be opened by scanning or searching by a user. Is also a very high-threshold innovation, and through the development of nearly two years, a new small program development environment and a developer ecology have been constructed. The small program is an innovative result which can really affect common programmers in the domestic Internet industry for many years, and the small program can be gradually pushed to international users along with the gradual development of the small program, so that the small program faces the requirement of internationalization.
In the related art, the language in the launched applet is generally the language used to develop the applet, for example, chinese.
In this way, in the course of internationalization of an applet, the language used in the applet cannot flexibly adapt to the language of the application that starts the applet, and internationalized adaptation cannot be achieved.
Disclosure of Invention
The present disclosure is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, the present disclosure aims to provide an applet processing method, an applet processing apparatus and an electronic device, which can automatically replace an applet text language type in time when an application starts an applet, so as to effectively implement international adaptation of an applet text language.
In order to achieve the above object, an embodiment of the first aspect of the present disclosure provides an applet processing method, including: determining a first language type of an application of a currently launched applet; translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text; and replacing the initial text with the target text.
According to the applet processing method provided by the embodiment of the first aspect of the disclosure, by determining the first language type of the application of the currently started applet, translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain the target text, and replacing the initial text with the target text, the applet text language type can be automatically replaced in time when the applet is started by the application, so that the international adaptation of the applet text language is effectively realized.
In order to achieve the above object, an embodiment of a second aspect of the present disclosure provides an applet processing apparatus, including: the first determining module is used for determining a first language type of an application of a currently started small program; the translation module is used for translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text; and the replacing module is used for replacing the initial text with the target text.
According to the applet processing device provided by the embodiment of the second aspect of the disclosure, by determining the first language type of the application of the currently started applet, translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain the target text, and replacing the initial text with the target text, when the applet is started by the application, the automatic replacement of the applet text language type can be performed in time, so that the international adaptation of the applet text language is effectively realized.
To achieve the above object, a computer-readable storage medium according to a third aspect of the present disclosure is provided, where instructions of the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to execute an applet processing method, the method including: the embodiment of the first aspect of the disclosure provides an applet processing method.
The computer-readable storage medium provided in the embodiment of the third aspect of the disclosure translates the initial text in the development language source file corresponding to the applet to obtain the target text based on the first language type by determining the first language type of the application currently starting the applet, and replaces the initial text with the target text, so that the automatic replacement of the applet text language type can be performed in time when the applet is started by the application, and the international adaptation of the applet text language is effectively realized.
To achieve the above object, a computer program product according to a fourth aspect of the present disclosure is provided, wherein when instructions in the computer program product are executed by a processor, a small program processing method is performed, and the method includes: determining a first language type of an application of a currently launched applet; translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text; and replacing the initial text with the target text.
According to the computer program product provided by the embodiment of the fourth aspect of the disclosure, by determining the first language type of the application of the currently started applet, translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain the target text, and replacing the initial text with the target text, the automatic replacement of the applet text language type can be performed in time when the applet is started by the application, so that the international adaptation of the applet text language is effectively realized.
An embodiment of a fifth aspect of the present disclosure also provides an electronic device, which includes at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the applet processing method set forth in the embodiments of the first aspect of the disclosure.
According to the electronic device provided by the embodiment of the fifth aspect of the disclosure, by determining the first language type of the application of the currently started applet, translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain the target text, and replacing the initial text with the target text, when the applet is started by the application, the automatic replacement of the applet text language type can be performed in time, so that the international adaptation of the applet text language is effectively realized.
Additional aspects and advantages of the disclosure will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the disclosure.
Drawings
The foregoing and/or additional aspects and advantages of the present disclosure will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flowchart of an applet processing method according to an embodiment of the disclosure;
fig. 2 is a schematic flow chart of an applet processing method according to another embodiment of the disclosure;
fig. 3 is a schematic structural diagram of an applet processing apparatus according to an embodiment of the disclosure;
fig. 4 is a schematic structural diagram of an applet processing apparatus according to another embodiment of the disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of illustrating the present disclosure and should not be construed as limiting the same. On the contrary, the embodiments of the disclosure include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
Fig. 1 is a flowchart illustrating an applet processing method according to an embodiment of the disclosure.
The present embodiment is exemplified in a case where the applet processing method is configured as an applet processing apparatus.
The applet processing method in this embodiment may be configured in an applet processing apparatus, and the applet processing apparatus may be disposed in a server, or may also be disposed in an electronic device, which is not limited in this disclosure.
The present embodiment takes as an example that the applet processing method is configured in the electronic apparatus.
It should be noted that the execution subject of the embodiment of the present disclosure may be, for example, a Central Processing Unit (CPU) in a server or an electronic device in terms of hardware, and may be, for example, a related background service in the server or the electronic device in terms of software, which is not limited to this.
The small Program, the English name Mini Program, is an application which can be used without downloading and installing, realizes the dream of 'being reachable by a touch hand' of the application, and is an application which can be opened by scanning or searching by a user.
Is also a very high-threshold innovation, and through the development of nearly two years, a new small program development environment and a developer ecology have been constructed. The small program is an innovative result which can really affect common programmers in the domestic Internet industry for many years, and the small program can be gradually pushed to international users along with the gradual development of the small program, so that the small program faces the requirement of internationalization.
In the related art, the language in the launched applet is generally the language used to develop the applet, for example, chinese.
In this way, in the course of internationalization of an applet, the language used in the applet cannot flexibly adapt to the language of the application that starts the applet, and internationalized adaptation cannot be achieved.
In order to solve the above technical problem, an embodiment of the present disclosure provides an applet processing method, which includes determining a first language type of an application currently starting an applet, translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text, and replacing the initial text with the target text, so that when the applet is started by the application, an automatic replacement of the applet text language type can be performed in time, and international adaptation of the applet text language is effectively achieved.
Referring to fig. 1, the method includes:
s101: a first language type of an application currently launching an applet is determined.
The application may refer to a software program running on an electronic device, such as a Personal Computer (PC), a cloud device or a mobile device, a mobile device such as a smart phone or a tablet Computer. The application program may be simply referred to as an application.
The application currently starting the applet may be, for example, a WeChat application, but is not limited thereto.
The language type corresponding to the preset language for the application of the currently started applet may be referred to as a first language type, and the first language type may be, for example, english.
The embodiment of the disclosure provides a method for determining a first language type of an application of a currently started applet technically, and before determining the first language type of the application of the currently started applet, a preset callback function can be registered in a script for loading the applet; and then, when the applet is started in the application, executing the preset callback function to determine the first language type.
The script of the applet can be written in the process of developing the applet by an applet developer, the corresponding logic processing function of the applet can be realized by executing the script, one or more applets can be pre-loaded in the application based on the operation principle of embedding the applet in the application, and then the applet can be directly started in the corresponding interface of the application program subsequently because the script of the applet is pre-loaded when the applet needs to be used subsequently.
The method and the device also aim to realize that when the applet is started in the application, the preset callback function is executed, and the attribute of the object of the applet is assigned, wherein the attribute is the attribute corresponding to the preset callback function.
The preset callback function may be, for example, an onLaunch callback function.
S102: and translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain a target text.
In the disclosed embodiments, the text in the development language source file of the applet may be referred to as initial text having an initial language type, which may be referred to as an initial language type, for example, chinese type.
In the embodiment of the disclosure, the initial language type of the initial text is translated into the first language type, that is, the applet in the application is kept consistent with the language type of the application in which the applet is embedded in time.
It can be understood that, in the related art, the international adaptation to the text language of the application can be realized, and with the method shown in the present disclosure, the international adaptation to the text language of the applet can be realized in time when the applet loaded by the application is started after the international adaptation to the text language of the application is completed.
In the specific execution process of the embodiment of the disclosure, after the first language type of the application of the currently started applet is determined, the initial language type corresponding to the initial text can be further determined, whether the first language type is the same as the initial language type is judged, then, when the first language type is different from the initial language type, the initial text in the development language source file corresponding to the applet is translated based on the first language type, so that when the first language type is the same as the initial language type, the translation of the initial text is not triggered, the applet is started in time, and hardware resources consumed by application operation can be effectively saved.
In the specific execution process, the target translation table is obtained according to the initial language type and the first language type; and translating the initial text in the development language source file corresponding to the small program based on the target translation table.
Wherein, the translation table is a JSON object and is stored in a key-value form, the key is an initial language type, and the value is a first language type, for example, 'test': 'Test' is required to obtain the first language type 'Test' only by transitietable [ 'Test' ].
The translation tables may be generated and recorded in advance, and are not limited to this, and the translation table corresponding to the initial language type and the first language type may be referred to as a target translation table.
Acquiring a target translation table according to the initial language type and the first language type; based on the target translation table, the initial text in the development language source file corresponding to the small program is translated, and the translation efficiency can be effectively improved while the translation accuracy is guaranteed.
In the specific execution process, whether a target translation table is stored in the local cache can be determined according to the initial language type and the first language type; and if the target translation table is not stored in the local cache, requesting the server to acquire the target translation table, and storing the target translation table acquired by the request into the local cache, so that the target translation table is directly acquired when the target translation table is stored in the local cache, and the execution efficiency of the method is improved from another angle.
In the specific execution process, the requested target translation table can be stored in the local cache when the version number of the requested target translation table is determined to meet the preset condition; and if the version number does not meet the preset condition, re-requesting the target translation table from the server until the version number of the target translation table obtained by re-requesting meets the preset condition.
The preset condition may be that the version number is latest.
Through the steps, the version number of the target translation table can be kept to be the latest all the time, and the translation accuracy is effectively guaranteed. By applying the method in the embodiment of the disclosure, the small program can issue multi-language versions in multiple countries, can automatically translate according to the language set by the user, and can update the target translation table in the background if the translation is wrong, so that the small program can update the place with the wrong translation when being loaded each time.
S103: the target text is substituted for the initial text.
In the specific execution process, the initial texts corresponding to the small program pages can be stored in the data attributes of the development language source files corresponding to the pages, the data uses a getter function, when the getter function is executed, the translated language of the first language type is obtained from the target translation table of the global variable by using the language of the initial language type and then returned, and if the translated language returned is empty, the language of the initial language type is returned.
Optionally, in some embodiments, referring to fig. 2, after replacing the initial text with the target text, the method further includes:
s201: and generating a target development language source file according to the replaced text.
S202: the target development language source file is run to generate the target applet.
S203: the control application starts the target applet.
The development language source file which replaces the initial text with the target text can be called a target development language source file, the small program generated by running the target development language source file can be called a target small program, the processing logic of the target small program is consistent with that of the initial small program, and the language type of the target small program is consistent with that of the application loaded with the target small program.
And generating a target development language source file according to the replaced text, operating the target development language source file to generate a target applet, and controlling the application to start the target applet so as to realize the service processing function of the subsequent applet.
In the embodiment, by determining the first language type of the application of the currently started applet, translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain the target text, and replacing the initial text with the target text, the automatic replacement of the applet text language type can be performed in time when the applet is started by the application, so that the international adaptation of the applet text language is effectively realized.
Fig. 3 is a schematic structural diagram of an applet processing apparatus according to an embodiment of the disclosure.
Referring to fig. 3, the apparatus 300 includes:
a first determining module 301, configured to determine a first language type of an application that currently launches an applet;
the translation module 302 is configured to translate an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text;
a replacing module 303, configured to replace the initial text with the target text.
Optionally, in some embodiments, referring to fig. 4, further comprising:
a generating module 304, configured to generate a target development language source file according to the replaced text;
a run module 305 for running a target development language source file to generate a target applet;
and a control module 306 for controlling the application to start the target applet.
Optionally, in some embodiments, referring to fig. 4, further comprising:
a registering module 307, configured to register a preset callback function in the script in which the applet is loaded;
an assignment processing module 308, configured to perform assignment processing on an attribute of an object of the applet, where the attribute is an attribute corresponding to a preset callback function;
the first determining module 301 is specifically configured to:
when the applet is started in the application, a preset callback function is executed to determine the first language type.
Optionally, in some embodiments, referring to fig. 4, further comprising:
a second determining module 309, configured to determine an initial language type corresponding to the initial text;
a determining module 310, configured to determine whether the first language type is the same as the initial language type;
translation module 302, which is specifically configured to:
and when the first language type is different from the initial language type, translating the initial text in the development language source file corresponding to the applet based on the first language type.
Optionally, in some embodiments, the translation module 302 is specifically configured to:
acquiring a target translation table according to the initial language type and the first language type;
and translating the initial text in the development language source file corresponding to the small program based on the target translation table.
Optionally, in some embodiments, the translation module 302 is specifically configured to:
determining whether a target translation table is stored in a local cache or not according to the initial language type and the first language type;
and if the target translation table is not stored in the local cache, requesting the server to acquire the target translation table, and storing the requested target translation table into the local cache.
Optionally, in some embodiments, the translation module 302 is specifically configured to:
when the version number of the requested target translation table meets the preset condition, storing the requested target translation table into a local cache;
and if the version number does not meet the preset condition, re-requesting the target translation table from the server until the version number of the target translation table obtained by re-requesting meets the preset condition.
It should be noted that the explanation of the embodiment of the applet processing method in the foregoing embodiments in fig. 1 to fig. 2 also applies to the applet processing apparatus 300 in this embodiment, and the implementation principle is similar, and is not repeated here.
In the embodiment, by determining the first language type of the application of the currently started applet, translating the initial text in the development language source file corresponding to the applet based on the first language type to obtain the target text, and replacing the initial text with the target text, the automatic replacement of the applet text language type can be performed in time when the applet is started by the application, so that the international adaptation of the applet text language is effectively realized.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. There is shown a schematic block diagram of an electronic device 500 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like.
The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, electronic device 500 may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program containing program code for performing the applet processing method illustrated in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program performs the above-described functions defined in the applet processing method of the disclosed embodiment when executed by the processing device 501.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: determining a first language type of an application of a currently launched applet; translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text; the target text is substituted for the initial text.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a module does not in some cases constitute a limitation of the module itself, for example, the first determining module may also be described as a "module for determining the first language type of the application currently launching the applet".
It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present disclosure, "a plurality" means two or more unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present disclosure includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present disclosure.
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present disclosure have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure, and that changes, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present disclosure.

Claims (8)

1. An applet processing method comprising the steps of:
determining a first language type of an application of a currently launched applet;
translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text;
replacing the initial text with the target text;
prior to the determining the first language type of the application that currently launches the applet, further comprising:
registering a preset callback function in the script for loading the applet;
assigning an attribute of the object of the applet, wherein the attribute is an attribute corresponding to the preset callback function;
the determining the first language type of the application currently launching the applet comprises:
when the applet is started in the application, executing the preset callback function to determine the first language type;
after the determining the first language type of the application currently launching the applet, further comprising:
determining an initial language type corresponding to the initial text;
judging whether the first language type is the same as the initial language type;
the translating the initial text in the development language source file corresponding to the applet based on the first language type includes:
and when the first language type is different from the initial language type, translating the initial text in the development language source file corresponding to the applet based on the first language type.
2. The applet processing method according to claim 1, further comprising, after the replacing the initial text with the target text:
generating a target development language source file according to the replaced text;
running the target development language source file to generate a target applet;
and controlling the application to start the target applet.
3. The applet processing method according to claim 1, wherein translating the initial text in the development language source file corresponding to the applet based on the first language type comprises:
acquiring a target translation table according to the initial language type and the first language type;
and translating the initial text in the development language source file corresponding to the small program based on the target translation table.
4. The applet processing method according to claim 3, wherein the obtaining a target translation table from the initial language type and the first language type comprises:
determining whether the target translation table is stored in a local cache or not according to the initial language type and the first language type;
and if the target translation table is not stored in the local cache, requesting a server to acquire the target translation table, and storing the requested target translation table into the local cache.
5. The applet processing method according to claim 4, wherein the saving of the requested target translation table in the local cache comprises:
when the version number of the requested target translation table meets the preset condition, storing the requested target translation table into the local cache;
and if the version number is determined not to meet the preset condition, re-requesting the target translation table from the server until the version number of the target translation table obtained by re-requesting meets the preset condition.
6. An applet processing apparatus comprising:
the first determining module is used for determining a first language type of an application of a currently started small program;
the translation module is used for translating an initial text in a development language source file corresponding to the applet based on the first language type to obtain a target text;
a replacing module for replacing the initial text with the target text;
further comprising:
the registration module is used for registering a preset callback function in the script loaded with the applet;
the assignment processing module is used for assigning the attribute of the object of the applet, wherein the attribute is the attribute corresponding to the preset callback function;
the first determining module is specifically configured to execute the preset callback function to determine the first language type when the applet is started in the application;
the second determining module is used for determining an initial language type corresponding to the initial text;
the judging module is used for judging whether the first language type is the same as the initial language type;
the translation module is specifically configured to translate, based on the first language type, an initial text in a development language source file corresponding to the applet when the first language type is different from the initial language type.
7. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the applet processing method as claimed in any one of claims 1-5.
8. An electronic device, comprising:
at least one processor; and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor, the instructions being arranged to perform the applet processing method according to any one of claims 1-5.
CN201910183388.6A 2019-03-12 2019-03-12 Applet processing method and device and electronic equipment Active CN109918166B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910183388.6A CN109918166B (en) 2019-03-12 2019-03-12 Applet processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910183388.6A CN109918166B (en) 2019-03-12 2019-03-12 Applet processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109918166A CN109918166A (en) 2019-06-21
CN109918166B true CN109918166B (en) 2022-04-01

Family

ID=66964272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910183388.6A Active CN109918166B (en) 2019-03-12 2019-03-12 Applet processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109918166B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688124B (en) * 2019-08-23 2023-03-17 北京奇艺世纪科技有限公司 Applet processing method, apparatus, electronic device and computer readable storage medium
CN110704154B (en) * 2019-10-12 2023-05-12 杭州行至云起科技有限公司 Multi-language template release method and system
CN110960855B (en) * 2019-12-19 2023-07-11 米哈游科技(上海)有限公司 Communication protocol code updating method and device, electronic equipment and storage medium
CN111240788A (en) * 2020-01-16 2020-06-05 支付宝(杭州)信息技术有限公司 Method, device and equipment for generating small program page
CN111240790B (en) * 2020-01-21 2023-06-27 广州市百果园信息技术有限公司 Multi-language adaptation method, device, client and storage medium for application
CN111274554B (en) * 2020-02-10 2023-03-21 广州虎牙科技有限公司 API calling method, device, equipment and medium of applet
CN111427647A (en) * 2020-03-20 2020-07-17 北京字节跳动网络技术有限公司 Page display method and device of application program, storage medium and electronic equipment
CN113760821A (en) * 2020-06-22 2021-12-07 北京京东乾石科技有限公司 File conversion method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104391730A (en) * 2014-08-03 2015-03-04 浙江网新恒天软件有限公司 Software source code language translation system and method
CN107239318A (en) * 2017-06-13 2017-10-10 腾讯科技(深圳)有限公司 Using conversion method, device and equipment
CN107402746A (en) * 2016-05-20 2017-11-28 阿里巴巴集团控股有限公司 A kind of method and device of automatic code generating file

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7987087B2 (en) * 2005-06-15 2011-07-26 Xerox Corporation Method and system for improved software localization
US10169020B2 (en) * 2017-02-01 2019-01-01 International Business Machines Corporation Software globalization of distributed packages

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104391730A (en) * 2014-08-03 2015-03-04 浙江网新恒天软件有限公司 Software source code language translation system and method
CN107402746A (en) * 2016-05-20 2017-11-28 阿里巴巴集团控股有限公司 A kind of method and device of automatic code generating file
CN107239318A (en) * 2017-06-13 2017-10-10 腾讯科技(深圳)有限公司 Using conversion method, device and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
平台+插件模式下的中文软件国际化;刘伟等;《计算机技术与发展》;20090310(第03期);第151-154页 *

Also Published As

Publication number Publication date
CN109918166A (en) 2019-06-21

Similar Documents

Publication Publication Date Title
CN109918166B (en) Applet processing method and device and electronic equipment
JP6294886B2 (en) Generate native code from intermediate language code for applications
KR101793306B1 (en) Virtual application extension points
CN110851204B (en) Application starting method and device and application packaging method and device
US20220334815A1 (en) Accelerating application and sub-package installations
CN112965761B (en) Data processing method, system, electronic equipment and storage medium
WO2019177775A1 (en) Leveraging previously installed application elements to install an application
CN110960855A (en) Communication protocol code updating method and device, electronic equipment and storage medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN114595065A (en) Data acquisition method and device, storage medium and electronic equipment
CN113900721A (en) Operating system starting method and device and electronic equipment
US20240095022A1 (en) Hotfix method, apparatus, device and storage medium
CN109657249B (en) Automatic text replacement method and device for application program and electronic equipment
CN111694585A (en) Method, system, terminal and storage medium for replacing system partition file
CN111240766A (en) Application starting method and device, electronic equipment and computer readable storage medium
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN112650521A (en) Software development kit SDK (software development kit) hot repair method and device and electronic equipment
CN107092472B (en) Dynamic publishing method and device
CN109240696A (en) A kind of Oftware updating method and device
CN113220374A (en) Software processing method and device
CN111309406A (en) Event processing method and device of application program and electronic equipment
CN111625326B (en) Task pipeline execution method and device and electronic equipment
CN113986385A (en) Item font library loading method and device, electronic equipment and storage medium
CN114090090A (en) Terminal firmware starting method and device, electronic equipment and storage medium
CN110442419B (en) Interface layout method and device for Android application

Legal Events

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