Character loading method, character file generation method and related equipment
By building a new text file generation method, the key-value feature codes and multilingual texts are separated and rearranged to generate binary text files, solving the problem of excessive size and inability to encrypt the multilingual resource files, realizing the compression and encryption of resource files, ensuring the confidentiality and storage efficiency of the file.
Patent Information
- Application Number
- CN202311607672.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-28
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art uses JSON or XML format when storing and calling multilingual resource copy, resulting in the resource file being too large and unable to be encrypted, affecting the confidentiality of the file.
By constructing a new text file generation method, the key-value feature codes and multilingual text are separated and rearranged by separators to generate binary text files, thereby realizing the compression and encryption of resource files.
It effectively reduces the storage space of multilingual resource files, and ensures the confidentiality of files through encryption, reducing resource consumption for data processing.
Smart Images

Figure CN120066631A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of computer copywriting configuration, and in particular to a method for loading text, a method for generating a text file, and related devices. Background Art
[0002] Multilingual resources refer to the support for multiple languages of a single project. With the deepening of economic globalization, projects or programs need to be able to be used in language environments around the world. Therefore, the project needs to configure corresponding language resources for the language system of the distribution area, such as Simplified Chinese, Traditional Chinese, English, French, Japanese, etc. In addition, after configuring multiple language resources, it is also necessary to be able to flexibly switch between different languages, so as to reduce the development cost of adapting to different regions.
[0003] Currently, it is usually possible to provide calls by storing different language texts in a cloud server or locally. When it is necessary to switch the language text, it can be directly retrieved correspondingly. However, since the current storage of multilingual resource copywriting is directly in formats such as JavaScript Object Notation (JSON) or Extensible Markup Language (XML) for storage and call, due to the lack of compactness of the above formats, it will cause the resource file to occupy too much space during storage and call. In addition, because the above formats are in plain text, the resource file cannot be encrypted. Summary of the Invention
[0004] In view of this, embodiments of the present disclosure provide a method for loading text, a method for generating a text file, and related devices, which can effectively reduce the volume of resource file storage and can encrypt the resource file.
[0005] According to some embodiments of the present disclosure, the above method for loading text may include: in response to an event of loading a target text, obtaining a binary text file to be decoded; the binary text file includes a feature code of a key value and multilingual texts corresponding to the key value; wherein, the key value is used to express the semantics of the multilingual texts; there is a first delimiter between the feature code of any adjacent key value and any adjacent multilingual text; determining, according to the target text and the binary file, the feature code of the key value corresponding to the target text and the corresponding multilingual text; and loading the target text according to the feature code of the key value corresponding to the target text and the corresponding multilingual text.
[0006] Based on the above method for loading text, embodiments of the present disclosure provide a text loading device, including:
[0007] An acquisition module, configured to acquire a binary text file to be decoded in response to an event of loading a target text; the binary text file includes feature codes of key values and multilingual texts corresponding to the key values; wherein, the key values are used to express the semantics of the multilingual texts; there is a first delimiter between the feature codes of any adjacent key values and any adjacent multilingual texts;
[0008] A first determination module, configured to determine the feature code of the key value corresponding to the target text and the corresponding multilingual text according to the target text and the binary file;
[0009] A loading module, configured to load the target text according to the feature code of the key value corresponding to the target text and the corresponding multilingual text.
[0010] In addition, according to some embodiments of the present disclosure, the method for generating the above text file may include: determining key values and multilingual texts corresponding to different languages from the acquired multilingual copywriting; the key values are used to express the semantics of the multilingual texts; extracting the feature codes of the key values, and separating each of the feature codes by the first delimiter; separating each of the multilingual texts by the first delimiter; generating a binary text file according to the feature codes, the multilingual texts and the first delimiter.
[0011] Based on the above method for generating a text file, an embodiment of the present disclosure provides a device for generating a text file, including:
[0012] A second determination module, configured to determine key values and multilingual texts corresponding to different languages from the acquired multilingual copywriting; the key values are used to express the semantics of the multilingual texts;
[0013] An extraction module, configured to extract the feature codes of the key values, and separate each of the feature codes by the first delimiter;
[0014] A separation module, configured to separate each of the multilingual texts by the first delimiter;
[0015] A generation module, configured to generate a binary text file according to the feature codes, the multilingual texts and the first delimiter.
[0016] In addition, an embodiment of the present disclosure further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the above method is implemented.
[0017] An embodiment of the present disclosure further provides a non-transitory computer-readable storage medium, and the non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the above method.
[0018] Embodiments of the present disclosure also provide a computer program product, including computer program instructions, which when running on a computer, cause the computer to execute the above method.
[0019] The above text loading method, text file generation method and related devices, when loading text, because when generating a binary text file, instead of using the traditional JSON or XML format to call or store multilingual resource files, a new text file generation method is constructed, and the feature code and multilingual text are separated by a first delimiter and rearranged. Therefore, during the loading process, the size of the multilingual resource files called can be effectively reduced, and the resources consumed by data processing can be reduced. It can be seen that by reconstructing the format of the multilingual resource files as described above, the multilingual resource texts after processing can be effectively arranged compactly, the storage space occupied by the multilingual resource texts can be greatly reduced, the problem that the multilingual resource texts occupy too much storage space can be effectively solved, and further, the size of the resource files called during the text loading process can be effectively reduced, and the consumption of resources during data processing can be effectively reduced. In addition, due to the reconstruction of the text file format, corresponding encryption processing can be performed on the key values, which are embodied in the form of feature codes, and the confidentiality of the multilingual resource text files can be effectively guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] To more clearly illustrate the technical solutions in the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0021] Figure 1 Shows the implementation process of the text loading method described in some embodiments of the present disclosure;
[0022] Figure 2 Shows a partial structural schematic diagram of the binary text file described in some embodiments of the present disclosure;
[0023] Figure 3 Shows the implementation process of the text file generation method described in the embodiments of the present disclosure;
[0024] Figure 4 Shows the internal structure of the text loading device described in the embodiments of the present disclosure;
[0025] Figure 5 Shows the internal structure of the text file generation device described in the embodiments of the present disclosure;
[0026] Figure 6 Shows the schematic diagram of the hardware structure of the electronic device described in the embodiments of the present disclosure. Detailed implementation manners
[0027] To make the purpose, technical solutions and advantages of the present disclosure more clear and understandable, the following further details the present disclosure in conjunction with specific embodiments and with reference to the accompanying drawings.
[0028] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be of the ordinary meaning understood by those of ordinary skill in the field to which the present application belongs. The "first", "second" and similar terms used in the embodiments of the present application do not denote any order, quantity or importance, but are only used to distinguish different components. The terms such as "including" or "comprising" mean that the elements or objects appearing before this word cover the elements or objects listed after this word and their equivalents, without excluding other elements or objects. The terms such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The terms such as "upper", "lower", "left" and "right" are only used to represent relative positional relationships, and when the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0029] As mentioned above, when storing and invoking multilingual resource texts, they are directly stored and invoked in formats such as JSON or XML. Due to the lack of compactness of the above formats, it will cause the resource files to occupy too much space when stored and invoked. And because the above formats are plain texts and cannot be encrypted, the confidentiality of the above files cannot be effectively guaranteed.
[0030] For this reason, some embodiments of the present disclosure provide a method for loading texts, which can effectively reduce the size of the multilingual resource files invoked during the loading process and reduce the resources consumed by data processing. And the binary text files loaded therein can implement encryption processing of key values, effectively ensuring the confidentiality of the multilingual resource text files. In the embodiments of the present disclosure, the above method for loading texts can be implemented by an electronic device with computing capabilities.
[0031] Figure 1 Shows the implementation process of the method for loading texts described in some embodiments of the present disclosure. As Figure 1 shown, the method may include the following steps:
[0032] In step 102, in response to an event of loading a target text, obtain a binary text file to be decoded.
[0033] In the embodiments of the present disclosure, the above-mentioned event of loading the target text may be the first loading of language and text resources for a certain program or project, or may be the replacement of language and text resources. For example, if the program or project is opened for the first time, it loads the main language by default, and the event of loading the target text at this time is the event of loading the main language and text. It should be noted that for different regions, those skilled in the art may also set different main languages in a targeted manner. If the user opens the program and the language of the program at this time is not the language required by the user, or the user has a need to change the language and text, then the event of loading the target text at this time is to replace the language corresponding to the language of the target text specified by the user. The present disclosure does not make corresponding limitations on the language types in the above-mentioned event of loading the target text.
[0034] refer to Figure 2 , showing a partial structural diagram of a binary text file described in some embodiments of the present disclosure.
[0035] The following combination Figure 2 The binary text files disclosed in the present invention are explained accordingly.
[0036] In an embodiment of the present disclosure, the above-mentioned binary text file includes a feature code of a key value and multilingual text corresponding to the key value; wherein the key value is used to express the semantics of the multilingual text; and a first separator exists between any adjacent feature codes of the key value and any adjacent multilingual text.
[0037] In an embodiment of the present disclosure, the characteristic code of the key value is obtained by encrypting the key value. The key value is extracted from a singular main language resource in a multilingual text resource file and is used to express the semantics of the multilingual text. For example, when the key value is "name", the multilingual text can be "John" or "John". After the key value is extracted, in some embodiments of the present disclosure, the key value is processed in hexadecimal, and then the key value is encrypted using the fifth version of the message digest algorithm (Message-Digest Algorithm 5, MD5) algorithm, and then the encrypted key value is separated by a first separator and arranged in sequence to obtain the key value. Similarly, the corresponding key value in the code also needs to undergo the above processing, so that in the subsequent loading process, there is no need to decode the key value again, and the encrypted characters can be directly compared, which can effectively shorten the loading process time and improve loading efficiency.
[0038] The above MD5 algorithm is a message digest algorithm and belongs to a type of hash algorithm. Under normal circumstances, its result is a 32-bit hexadecimal string. The main feature of the MD5 algorithm is its irreversibility. For the same data, the MD5 value is necessarily the same, while for different data, the MD5 values are different. Encrypting the above key values using the MD5 algorithm can, firstly, effectively compress the key values because for data of any length, the length of the calculated MD5 value is fixed. Secondly, it can effectively ensure the identifiability and anti-modification property of the key values because any change made to the original data will result in a significant difference in the final obtained MD5 value. Therefore, when comparing key values, the situation where the MD5 codes corresponding to different key values are the same, leading to incorrect key value identification, will not occur. And if someone maliciously tampers with the key values, the corresponding MD5 codes cannot be recognized correspondingly, so the situation of malicious tampering can be effectively avoided. In addition, the operation process of the MD5 algorithm is relatively simple, so encrypting the key values using this algorithm will not consume a lot of resources. It should be noted that the algorithm for encrypting the key values in this disclosure is not limited to the MD5 algorithm. In theory, it is also feasible to use other encryption algorithms, as long as it is ensured that for different key values, the results obtained after encryption are different, and the encrypted results are not overly long. Because encrypting the key values is not only to ensure the confidentiality of multilingual files but also to reduce the storage space they occupy. Therefore, if an encryption algorithm with an overly long encrypted result is selected, the technical effect of reducing the occupied space cannot be achieved. However, if the issue of occupied space is not considered, it is only necessary to ensure the uniqueness of the key value encryption. This disclosure does not make corresponding limitations on the encryption algorithm used for the key values.
[0039] In the embodiments of this disclosure, the feature codes of each key value are separated by a first delimiter.
[0040] In some embodiments of this disclosure, the above first delimiter can be "\0". The advantage of this first delimiter is its shortness. Using this delimiter to separate the feature codes of the key values and then simply arranging the feature codes of the key values to form a format like "key1\0key2\0...". Compared with the formats in the prior art, the format of the embodiments of this disclosure is relatively concise. By this relatively simple arrangement method, the space occupied by the key values can be effectively shortened. Combining with the aforementioned corresponding encryption algorithm, the embodiments of this disclosure only use a concise delimiter to separate the key values after compressing them once, constructing the format of the key values, reducing the storage space occupied by the key values in two dimensions and saving a great deal of storage resources.
[0041] In an embodiment of the present disclosure, for each language text in the multilingual text, there is a corresponding language text for each key value, and there is a first separator between each language text.
[0042] Regarding the multilingual text, since this part records the text that is finally presented, it is not possible to encrypt this part of the text during the processing. If it is encrypted, and if this part of the text is not decrypted during the final loading process, the target text cannot be normally displayed to the user. And if this part of the text is decrypted, it adds a lot of extra workload, which is unnecessary. Therefore, in the embodiment of the present disclosure, the multilingual text is not encrypted, but only the adjacent multilingual texts are separated by the first separator, and all the multilingual texts are arranged in sequence. The format constructed by the foregoing arrangement method reduces the interval between the texts compared with the format in the prior art, so the space occupied by the multilingual text is effectively reduced.
[0043] In an embodiment of the present disclosure, the binary text file further includes: a meta-information field for recording the position and length of the feature code, and recording the positions and lengths of different language texts in the multilingual text; a second separator for separating the feature code and the multilingual text. For this meta-information field, it records the information of the key value and the multilingual text, specifically including its corresponding position and length. Since the multilingual text can include texts corresponding to multiple languages, it is necessary to quickly find the multilingual text corresponding to the target text during the loading process of the multilingual text resource. Therefore, after writing the positions and lengths corresponding to different language texts into the meta-information field in the foregoing step, the key value and the multilingual text corresponding to the language of the target text can be quickly found during the subsequent loading process, effectively reducing the language loading time, and thus effectively improving the user experience when switching languages. The feature code of the key value and the multilingual text are separated by the second separator. During the process of storing the multilingual text, in order to effectively distinguish the feature code of the key value and the multilingual text, a corresponding separator is set between the two.
[0044] In an embodiment of the present disclosure, the second delimiter may be the character "DATA". Using this character as the second delimiter can not only separate the feature codes of key values and multilingual texts, but also play a certain identification role. For example, using this character to identify that the subsequent fields are all multilingual texts. The second delimiter field is not limited to the examples given above, and those skilled in the art can set the corresponding second delimiter by themselves. In addition, a second delimiter may also be included between the meta-information field and the feature code of the key value. For example, the character "keys" is used to separate the meta-information field and the feature code of the key value correspondingly. Similarly, the above character can not only play the role of separating the meta-information field and the feature code, but also play a certain identification role for the feature code. For example, using this character to identify that the subsequent field is the feature code. Similarly, the second delimiter is not limited to the character "keys", and those skilled in the art can set this character by themselves.
[0045] In an embodiment of the present disclosure, the binary text file further includes a file header. The file header can show the actual usage of the file. In a computing set, the file header is a piece of data used to describe the content and format of the file. Different file formats have different file header formats. The file header content usually includes information such as the type, version, encoding method, and file size of the file to facilitate the computer to identify and process the file. Since the embodiment of the present disclosure constructs a new format for the multilingual text resource file, a new file header is made for this format to describe the detailed information of the corresponding file.
[0046] In step 104, according to the target text and the binary file, determine the feature code of the key value corresponding to the target text and the corresponding multilingual text.
[0047] In an embodiment of the present disclosure, the determining the feature code of the key value corresponding to the target text and the corresponding multilingual text according to the target text and the binary file includes: reading the position and length of the feature code recorded in the meta-information field, and reading the position and length of the multilingual text corresponding to the language of the target text, so as to obtain the feature code corresponding to the target text and the multilingual text corresponding to the target text.
[0048] As can be seen from the foregoing, the binary text file includes a meta-information field, which is used to record the position and length of the signature, as well as the position and length of the multilingual text. Therefore, in the determination process, the signature and the multilingual text corresponding to the language of the target text can be obtained through the meta-information field. And because the positions and lengths of the above-mentioned signature and multilingual text are all correspondingly recorded, only the corresponding positions and lengths need to be obtained during the loading process to quickly find the corresponding signature or multilingual text, effectively shortening the time to find the signature or multilingual text, and thus effectively shortening the time to load the multilingual text resources.
[0049] In the embodiments of the present disclosure, the process of reading the corresponding signature and reading the corresponding multilingual text can be parallel reading, that is, reading the signature and the corresponding multilingual text simultaneously, which can effectively shorten the time spent on determining the signature of the key value corresponding to the target text and the corresponding multilingual text, and thus effectively reduce the time to load the corresponding multilingual resources.
[0050] In step 106, load the target text according to the signature of the key value corresponding to the target text and the corresponding multilingual text.
[0051] After determining the signature of the key value corresponding to the target text and the corresponding multilingual text in the above steps, the target text can be loaded according to the determined signature and the corresponding multilingual text. The loading process is the matching process of the key value and the multilingual text, which should be known to those skilled in the art, so it will not be elaborated here.
[0052] In the above method for loading text, when loading text, since the generated binary text file does not use the traditional JSON or XML format to call or store the multilingual resource file, but constructs a new method for generating a text file, and separates the signature and the multilingual text with a first delimiter and rearranges them, it can effectively reduce the size of the multilingual resource file called during the loading process and reduce the resources consumed by data processing.
[0053] In addition, the embodiments of the present disclosure also disclose a method for generating a text file. This generation method can make the processed multilingual resource text arranged compactly, which can greatly reduce the storage space occupied by the multilingual resource text. In addition, due to the reconstruction of the storage format of the multilingual resource text, corresponding encryption processing can be performed on the key value, which is reflected in the form of a signature, and thus can effectively ensure the confidentiality of the multilingual resource text file.
[0054] Figure 3 Shows the implementation process of the method for generating a text file described in the embodiments of the present disclosure. As Figure 3As shown, the method may include the following steps:
[0055] In step 302, determine key values and multilingual texts corresponding to different languages from the obtained multilingual copywriting; the key values are used to express the semantics of the multilingual texts.
[0056] In an embodiment of the present disclosure, determining the key values from the obtained multilingual copywriting includes: determining the target language text corresponding to the target language from the multilingual copywriting; and determining the key values based on the target language text.
[0057] In an embodiment of the present disclosure, the multilingual text file to be processed includes text files corresponding to different types of languages, and it is necessary to determine one language as the target language because only the key values of the target language need to be extracted in the subsequent process.
[0058] In an embodiment of the present disclosure, the multilingual copywriting includes a first language copywriting; wherein, the first language copywriting is used to represent a singular form of a word; determining the key values and multilingual texts corresponding to different languages from the obtained multilingual copywriting includes: determining the key values and multilingual texts corresponding to different languages from the first language copywriting.
[0059] In an embodiment of the present disclosure, since the number of plural form words is small, and for plural form words, the process of extracting key values is relatively complex. If key values are extracted from all types of text files, it will add a lot of unnecessary workload in the subsequent processing. Therefore, in the embodiments of the present disclosure, only the singular form words are used to extract key values and language texts. For plural form words, since their number is small, not processing them will not occupy too much storage space. Therefore, they can be packaged separately and can be directly retrieved and loaded during the subsequent loading process.
[0060] Therefore, in an embodiment of the present disclosure, key values can be extracted only from the singular form words of the target language, while when extracting multilingual texts, it is necessary to extract the singular form words of all languages.
[0061] In an embodiment of the present disclosure, the language texts corresponding to each language are in one-to-one correspondence with the key values.
[0062] In step 304, extract the feature codes of the key values and separate each of the feature codes by a first delimiter.
[0063] In an embodiment of the present disclosure, extracting the feature code of the key value includes: encrypting the key value using a preset encryption algorithm to obtain the feature code of the key value. The encryption algorithm mentioned here may be the same as the encryption algorithm in the foregoing text loading method, and the arrangement relationship between the feature code of the key value and the first delimiter has also been described in detail in the foregoing text loading method, so it will not be elaborated here. The foregoing feature code may be the encryption result obtained after encryption.
[0064] In step 306, each of the multilingual texts is separated by the first delimiter.
[0065] In an embodiment of the present disclosure, the corresponding description of the first delimiter and the corresponding description of separating the language texts corresponding to different languages by the first delimiter refer to the corresponding descriptions in the foregoing text loading method, and will not be elaborated here. For the above arrangement in sequence according to the language types, when arranging the language texts corresponding to different languages, they are arranged according to the language types, and the language texts of the same language type are adjacent or close to each other, which is convenient for quick searching during text loading.
[0066] In step 308, a binary text file is generated according to the feature code, the multilingual text, and the first delimiter.
[0067] In an embodiment of the present disclosure, the binary text file includes a meta-information field; the method further includes: writing the positions corresponding to the arranged feature code and the multilingual text into the meta-information field according to a preset manner; writing the lengths of the feature code and the multilingual text into the meta-information field. Similarly, the description of the meta-information field may refer to the corresponding description in the foregoing text loading method part, and will not be elaborated here. Corresponding to the foregoing text loading method, during the loading process, the corresponding key value and multilingual text are obtained by reading the positions and lengths corresponding to the arranged feature code and the multilingual text in the meta-information field to achieve the loading of multilingual text resources. Correspondingly, during the process of generating the text file, the foregoing corresponding positions and lengths need to be written into the meta-information field in advance for reading during the subsequent loading process.
[0068] In an embodiment of the present disclosure, the binary text file further includes a second delimiter; the signature and the multilingual text are separated by the second delimiter. Generating a binary text file according to the signature, the multilingual text, and the first delimiter includes: arranging the meta-information field, the signature, the first delimiter, the second delimiter, and the multilingual text in a preset manner and performing binary operations to obtain the binary text file. The foregoing binary text may include a file header. The description of the file header may also refer to the corresponding description of the foregoing text loading method and will not be elaborated here. The above-mentioned preset arrangement may be in the order of file header, meta-information field, second delimiter, signature, second delimiter, and multilingual text. Of course, the foregoing arrangement is only exemplary and does not mean that the present disclosure is limited to the above-mentioned one arrangement. After arranging all the fields in a preset manner, binary operations are performed on all the arranged fields to finally obtain a binary text file.
[0069] The method for generating the above text file can effectively make the arranged multilingual resource texts compact by reconstructing the overall format and greatly shortening the interval between the signature of the key value and the multilingual text to form a new format, which can greatly reduce the storage space occupied by the multilingual resource texts and effectively solve the problem of excessive storage space occupied by the multilingual resource texts. In addition, since the format of the text file is reconstructed, corresponding encryption processing can be performed on the key value, which is reflected in the form of a signature, and can effectively ensure the confidentiality of the multilingual resource text file.
[0070] It should be noted that the method of the embodiment of the present application can be executed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In this case of a distributed scenario, one of the multiple devices can only execute one or more steps of the method of the embodiment of the present application, and these multiple devices will interact with each other to complete the described method.
[0071] It should be noted that some embodiments of the present application have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the above embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0072] Corresponding to the above text loading method, an embodiment of the present disclosure also discloses a text loading device.Figure 4 shows the internal structure of the text loading device according to an embodiment of the present disclosure. As Figure 4 shown, the device may include:
[0073] An acquisition module 402, configured to acquire a binary text file to be decoded in response to an event of loading a target text; the binary text file includes a feature code of a key value and a multi-language text corresponding to the key value; wherein, the key value is used to express the semantics of the multi-language text; there is a first delimiter between the feature code of any adjacent key value and any adjacent multi-language text;
[0074] A first determination module 404, configured to determine a feature code of a key value corresponding to the target text and a corresponding multi-language text according to the target text and the binary file;
[0075] A loading module 406, configured to load the target text according to the feature code of the key value corresponding to the target text and the corresponding multi-language text.
[0076] In some embodiments of the present disclosure, the binary text file further includes:
[0077] A meta-information field, configured to record the position and length of the feature code, and record the position and length of different language texts in the multi-language text;
[0078] A second delimiter, configured to separate the feature code and the multi-language text.
[0079] In some embodiments of the present disclosure, the first determination module 404 may include:
[0080] A reading unit, configured to read the position and length of the feature code recorded in the meta-information field, and read the position and length of the multi-language text corresponding to the language of the target text, so as to obtain the feature code corresponding to the target text and the multi-language text corresponding to the target text.
[0081] In some embodiments of the present disclosure, the reading unit may include:
[0082] Parallelly read the position and length of the feature code recorded in the meta-information field, and read the position and length of the multi-language text corresponding to the language of the target text, so as to obtain the feature code corresponding to the target text and the multi-language text corresponding to the target text.
[0083] In some embodiments of the present disclosure, the fixed string includes a second delimiter; the key value and the multi-language text are separated by the second delimiter.
[0084] In some embodiments of the present disclosure, the feature code of the key value is obtained by encrypting the key value.
[0085] For the specific implementation of each of the above modules, reference may be made to the foregoing method and the accompanying drawings, which will not be repeated herein. For the sake of convenience of description, when describing the above device, various modules are described separately according to their functions. Of course, when implementing the present disclosure, the functions of each module may be implemented in one or more pieces of software and / or hardware.
[0086] The device of the above embodiment is used to implement the corresponding text loading method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated herein.
[0087] Corresponding to the above method for generating a text file, an embodiment of the present disclosure also discloses a device for generating a text file. Figure 5 shows the internal structure of the device for generating a text file according to an embodiment of the present disclosure. As Figure 5 shown, the device may include:
[0088] A second determination module 502, configured to determine a key value and multi-language texts corresponding to different languages from the obtained multi-language copywriting; the key value is used to express the semantics of the multi-language texts;
[0089] An extraction module 504, configured to extract the feature code of the key value, and separate each of the feature codes by a first delimiter;
[0090] A separation module 506, configured to separate each of the multi-language texts by the first delimiter;
[0091] A generation module 508, configured to generate a binary text file according to the feature code, the multi-language texts, and the first delimiter.
[0092] In some embodiments of the present disclosure, the extraction module 504 includes:
[0093] A first determination unit, configured to determine the target language text corresponding to the target language from the multi-language copywriting;
[0094] A second determination unit, configured to determine the key value based on the target language text.
[0095] In some embodiments of the present disclosure, the multi-language copywriting includes a first language copywriting; wherein, the first language copywriting is used to represent a word in the singular form;
[0096] The second determination module 502 may include:
[0097] A third determination unit, configured to determine a key value and multi-language texts corresponding to different languages from the first language copywriting.
[0098] In some embodiments of the present disclosure, the binary text file includes a meta-information field;
[0099] The apparatus further includes:
[0100] A position writing module, configured to write the position corresponding to the arranged feature code and the multilingual text in a preset manner into the meta-information field;
[0101] A length writing module, configured to write the lengths of the feature code and the multilingual text into the meta-information field.
[0102] In some embodiments of the present disclosure, the binary text file further includes a second delimiter; the feature code and the multilingual text are separated by the second delimiter.
[0103] In some embodiments of the present disclosure, the generating module 508 includes:
[0104] A binary unit, configured to arrange the meta-information field, the feature code, the first delimiter, the second delimiter, and the multilingual text in a preset manner, and perform binary operations to obtain the binary text file.
[0105] For the specific implementation of each of the above modules, reference may be made to the foregoing method and the accompanying drawings, which will not be repeated herein. For the convenience of description, when describing the above apparatus, various modules are described separately according to their functions. Of course, when implementing the present disclosure, the functions of each module may be implemented in one or more software and / or hardware.
[0106] The apparatus of the above embodiment is used to implement the corresponding text file generation method in any one of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated herein.
[0107] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the program, it implements the method for loading text and the method for generating a text file described in any one of the above embodiments.
[0108] Figure 6 FIG. shows a schematic hardware structure diagram of the electronic device described in the embodiments of the present disclosure. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. Among them, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other inside the device through the bus 1050.
[0109] The processor 1010 can be implemented in the form of a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0110] The memory 1020 can be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0111] The input / output interface 1030 is used to connect to the input / output module to achieve information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Among them, the input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.
[0112] The communication interface 1040 is used to connect to a communication module (not shown in the figure) to achieve communication interaction between this device and other devices. Among them, the communication module can achieve communication through a wired method (such as USB, network cable, etc.) or through a wireless method (such as a mobile network, WIFI, Bluetooth, etc.).
[0113] The bus 1050 includes a path for transmitting information between various components of the device (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0114] It should be noted that although only the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050 are shown in the above device, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary to implement the solutions of the embodiments of this specification, and do not necessarily include all the components shown in the figure.
[0115] The electronic device of the above embodiment is used to implement the corresponding text loading method and text file generation method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.
[0116] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application further provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the text loading method and text file generation method described in any of the above embodiments.
[0117] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.
[0118] The computer instructions stored in the storage medium of the above embodiment are used to cause the computer to execute the text loading method and text file generation method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be elaborated here.
[0119] Based on the same inventive concept, corresponding to the text loading method and text file generation method described in any of the above embodiments, the present disclosure further provides a computer program product including computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of the computer to cause the computer and / or the processor to execute the text loading method and text file generation method. Corresponding to the execution subject of each step in each embodiment of the text loading method and text file generation method, the processor executing the corresponding step can belong to the corresponding execution subject.
[0120] The computer program product of the above embodiment is used to cause the computer and / or the processor to execute the text loading method and text file generation method described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.
[0121] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the present application (including the claims) is limited to these examples; under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the embodiments of the present application as described above, and for the sake of brevity, they are not provided in detail.
[0122] In addition, for the sake of simplicity of description and discussion, and in order not to make the embodiments of the present application difficult to understand, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. In addition, the devices may be shown in block diagram form in order to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application are to be implemented (i.e., these details should be fully within the understanding of those skilled in the art). In the case where specific details (such as circuits) are set forth to describe the exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with variations of these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0123] Although the present application has been described in connection with specific embodiments of the present application, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. For example, other memory architectures (such as dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0124] The embodiments of the present application are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the embodiments of the present application shall be included within the protection scope of the present application.
Claims
1. A method for loading text, comprising: in response to an event of loading target text, obtaining a binary text file to be decoded; the binary text file includes a feature code of a key value and multilingual text corresponding to the key value; wherein, the key value is used to express the semantics of the multilingual text; there is a first delimiter between the feature code of any adjacent key value and any adjacent multilingual text; determining, according to the target text and the binary file, a feature code of a key value corresponding to the target text and the corresponding multilingual text; loading the target text according to the feature code of the key value corresponding to the target text and the corresponding multilingual text.
2. The method according to claim 1, wherein, the binary text file further includes: a meta-information field for recording the position and length of the feature code, and recording the position and length of different language texts in the multilingual text; a second delimiter for separating the feature code and the multilingual text.
3. The method according to claim 2, wherein, the determining, according to the target text and the binary file, a feature code of a key value corresponding to the target text and the corresponding multilingual text includes: reading the position and length of the feature code recorded in the meta-information field, and reading the position and length of the multilingual text corresponding to the language of the target text, to obtain the feature code corresponding to the target text and the multilingual text corresponding to the target text.
4. The method according to claim 3, wherein, the reading the position and length of the feature code recorded in the meta-information field, and reading the position and length of the multilingual text corresponding to the language of the target text, to obtain the feature code corresponding to the target text and the multilingual text corresponding to the target text includes: parallel reading the position and length of the feature code recorded in the meta-information field, and reading the position and length of the multilingual text corresponding to the language of the target text, to obtain the feature code corresponding to the target text and the multilingual text corresponding to the target text.
5. The method according to claim 1, wherein, the feature code of the key value is obtained by encrypting the key value.
6. A method for generating a text file, comprising: determining a key value and multilingual text corresponding to different languages from the obtained multilingual copywriting; the key value is used to express the semantics of the multilingual text; extracting the feature code of the key value, and separating each feature code by a first delimiter; separating each multilingual text by the first delimiter; generating a binary text file according to the feature code, the multilingual text and the first delimiter.
7. The method according to claim 6, wherein, the determining a key value from the obtained multilingual copywriting includes: determining the target language text corresponding to the target language from the multilingual copywriting; determining the key value based on the target language text.
8. The method according to claim 6 or 7, wherein, The multilingual copywriting includes the first - language copywriting; wherein, the first - language copywriting is used to represent a word in the singular form; Determining the key value and the multilingual texts corresponding to different languages from the obtained multilingual copywriting includes: Determining the key value and the multilingual texts corresponding to different languages from the first - language copywriting.
9. The method according to claim 6, wherein, The binary text file includes a meta - information field; The method further includes: Writing the positions corresponding to the arranged feature code and the multilingual text in a preset manner into the meta - information field; Writing the lengths of the feature code and the multilingual text into the meta - information field.
10. The method according to claim 9, wherein, The binary text file further includes a second delimiter; the feature code and the multilingual text are separated by the second delimiter.
11. The method according to claim 10, wherein, Generating the binary text file according to the feature code, the multilingual text, and the first delimiter includes: Arranging the meta - information field, the feature code, the first delimiter, the second delimiter, and the multilingual text in a preset manner and performing binary operations to obtain the binary text file.
12. The method according to claim 6, wherein, Extracting the feature code of the key value includes: encrypting the key value using a preset encryption algorithm to obtain the feature code of the key value.
13. A text loading device, including: An acquisition module, configured to acquire a binary text file to be decoded in response to an event of loading a target text; The binary text file includes the feature code of the key value and the multilingual text corresponding to the key value; wherein, the key value is used to express the semantics of the multilingual text; there is a first delimiter between any adjacent feature code of the key value and any adjacent multilingual text; A first determination module, configured to determine the feature code of the key value corresponding to the target text and the corresponding multilingual text according to the target text and the binary file; A loading module, configured to load the target text according to the feature code of the key value corresponding to the target text and the corresponding multilingual text.
14. The device according to claim 13, wherein, The binary text file further includes: A meta - information field, configured to record the position and length of the feature code, and record the position and length of different - language texts in the multilingual text; A second delimiter, configured to separate the feature code and the multilingual text.
15. The device according to claim 14, wherein, The first determination module includes: A reading unit, configured to read the position and length of the feature code recorded in the meta - information field, and read the position and length of the multilingual text corresponding to the language of the target text to obtain the feature code corresponding to the target text and the multilingual text corresponding to the target text.
16. A text file generating device, including: A second determination module, configured to determine a key value and multilingual texts corresponding to different languages from the acquired multilingual copywriting; the key value is used to express the semantics of the multilingual texts; An extraction module, configured to extract a feature code of the key value and separate each of the feature codes by a first delimiter; A separation module, configured to separate each of the multilingual texts by the first delimiter; A generation module, configured to generate a binary text file according to the feature code, the multilingual texts, and the first delimiter.
17. The apparatus according to claim 16, wherein, the extraction module includes: A first determination unit, configured to determine a target language text corresponding to a target language from the multilingual copywriting; A second determination unit, configured to determine the key value based on the target language text.
18. The apparatus according to claim 16, wherein, the multilingual copywriting includes a first language copywriting; wherein, the first language copywriting is used to represent a word in the singular form; the second determination module includes: A third determination unit, configured to determine a key value and multilingual texts corresponding to different languages from the first language copywriting.
19. The apparatus according to claim 16, wherein, the binary text file includes a meta information field; the apparatus further includes: A position writing module, configured to write the positions corresponding to the arranged feature codes and multilingual texts into the meta information field according to a preset manner; A length writing module, configured to write the lengths of the feature codes and multilingual texts into the meta information field.
20. The apparatus according to claim 16, wherein, the binary text file further includes a second delimiter; the feature codes and multilingual texts are separated by the second delimiter.
21. The apparatus according to claim 20, wherein, the generation module includes: A binary unit, configured to arrange the meta information field, the feature codes, the first delimiter, the second delimiter, and the multilingual texts according to a preset manner, and perform binary operations to obtain the binary text file.
22. An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, when the processor executes the program, the method according to any one of claims 1 to 12 is implemented.
23. A non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium stores computer instructions, wherein, the computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 12.
24. A computer program product, including computer program instructions, when the computer program instructions run on a computer, the computer is caused to execute the method according to any one of claims 1 - 12.
Citation Information
Cited By
Character loading method, character file generation method, and related device
WO2025113377A1