CN108089900B - Character string processing method and device - Google Patents

Character string processing method and device Download PDF

Info

Publication number
CN108089900B
CN108089900B CN201711295913.0A CN201711295913A CN108089900B CN 108089900 B CN108089900 B CN 108089900B CN 201711295913 A CN201711295913 A CN 201711295913A CN 108089900 B CN108089900 B CN 108089900B
Authority
CN
China
Prior art keywords
character string
language
character
string resource
resource
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
CN201711295913.0A
Other languages
Chinese (zh)
Other versions
CN108089900A (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.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications 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 Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Priority to CN201711295913.0A priority Critical patent/CN108089900B/en
Publication of CN108089900A publication Critical patent/CN108089900A/en
Application granted granted Critical
Publication of CN108089900B publication Critical patent/CN108089900B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)
  • Machine Translation (AREA)

Abstract

The application discloses a character string processing method and device. The method comprises the following steps: acquiring a character string resource identifier; searching character string resource content corresponding to the character string resource identifier in the character resource of the language with the highest priority in the N languages, and if the character string resource content is not searched, obtaining first character string resource content corresponding to the character string resource identifier according to the character resource of a system default language; judging whether the value of the unicode code of the character in the first character string resource content is in the unicode code value range of the language character with the highest priority or not, and if so, outputting the first character string resource content; otherwise, obtaining the language with the same attribute with the highest priority language in the N languages used for setting, obtaining the second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content. The method and the device can improve the rationality of character string processing.

Description

Character string processing method and device
Technical Field
The present application relates to the field of computer data processing technologies, and in particular, to a method and an apparatus for processing a character string.
Background
In order to meet the requirements of users using different languages, the application programs often need to support multiple languages, and multiple languages are preset in the computer equipment for the users to select and use, and one language is set as a default language of the system.
The computer equipment preset with multiple languages is provided with a system resource directory, corresponding subdirectories exist in the system resource directory for different languages, an independent subdirectory also exists in the resource directory for a default language of the system, and a character resource file of one language can be stored in the subdirectory corresponding to the language. The character resource file of a language is used for defining the content of the character string resource of the language. For example, a character string resource with an ID of "character string a" is defined in a chinese character resource file, where the content of the character string resource is "test character", and if the character string a needs to be displayed in the user interface and the user chooses to use chinese, the character string a is displayed as "test character" in the user interface; the english character resource file is defined with "character string a ═ test string", which indicates a character string resource with ID "character string a", and the content of the english character string resource is "test string", and if the character string a needs to be displayed in the user interface and the user chooses to use english, the character string a is displayed as "test string" in the user interface.
The user may select to present the user interface in multiple languages and may set priorities for the multiple languages. For example, the user may select to use Chinese and English, and set a priority for Chinese over English.
Taking the example that the user selects to use the first language and the second language, and the priority of the first language is higher than that of the second language, at present, the search order for resource content of a certain string (such as string a) is: firstly, searching resource content of a character string A in a character resource file of a first language, if the character string A has definition in the character resource file of the first language, outputting the corresponding character string resource content of the character string A in the character resource file, otherwise, searching the resource content of the character string A in a character resource file of a second language, if the character string A has definition in the character resource file of the second language, outputting the corresponding character string resource content of the character string A in the resource file, otherwise, searching the corresponding character string resource content of the character string A in the character resource file of a system default language, and outputting the searched character string resource content.
The above prior art has a problem that the character string processing is not reasonable. For example, an application program has a character resource identified as string A (hereinafter StringA), and the languages supported by the application program include simplified Chinese, traditional Chinese, and English. StringA is defined in a character resource file of a system default language as: stringA ═ test character, which is not defined in the character resource file for simplified chinese, and in the character resource file for traditional chinese: StringA is a test character. If the languages used are set to be in the order of priority from high to low: simplified Chinese, English, and traditional Chinese, according to the above process, stringA is finally output as test string. However, in the case that the application program supports simplified chinese, the selected language includes simplified chinese and has the highest priority, and the default language of the system is also simplified chinese, the final output is english, which is obviously unreasonable.
Disclosure of Invention
The embodiment of the application provides a character transmission processing method and device, which are used for improving the rationality of character string processing.
In a first aspect, a method for processing a character string is provided, including:
acquiring a character string resource identifier;
searching character string resource content corresponding to the character string resource identifier in character resources of a language with the highest priority in N languages which are set to be used, if the character string resource content is not searched, obtaining first character string resource content corresponding to the character string resource identifier according to character resources of a system default language, wherein N is an integer greater than 1;
judging whether the value of the unicode code of the character in the first character string resource content is in the unicode code value range of the language character with the highest priority or not, and if so, outputting the first character string resource content; otherwise, obtaining the language with the same attribute with the highest priority language in the N languages used for setting, obtaining the second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content.
Optionally, if there are multiple languages with the same attribute as the highest priority language in the N languages used for setting, obtaining, according to the character resource of the language with the same attribute, a second character string resource content corresponding to the character string resource identifier, includes: and obtaining second character string resource content corresponding to the character string resource identification according to the character resource of the language with the highest priority in the plurality of languages.
Optionally, if there is no language having the same attribute as the highest priority language in the languages used in the N settings, the method further includes:
and searching third character string resource content corresponding to the character string resource identifier in the character resources of the N-1 languages from high priority to low priority, and outputting the third character string resource content. Wherein, the language used by the N-1 settings is the language except the language with the highest priority in the languages used by the N settings.
Optionally, if the third string resource content corresponding to the string resource identifier is not found in the character resources of the N-1 languages set to be used according to the order of priority from high to low, the method further includes: and obtaining fourth character string resource content corresponding to the character string resource identification according to the character resource of the default language of the system, and outputting the fourth character string resource content.
Optionally, the language having the same attribute as the highest priority language is: a language belonging to the same country or region as the highest priority language.
In a second aspect, there is provided a character string processing apparatus including: the device comprises an acquisition module, a processing module and an output module;
the acquisition module is used for acquiring the character string resource identifier;
the processing module is used for searching the character string resource content corresponding to the character string resource identifier in the character resource of the language with the highest priority in the N languages, and if the character string resource content is not searched, obtaining the first character string resource content corresponding to the character string resource identifier according to the character resource of the default language of the system, wherein N is an integer greater than 1; and
judging whether the value of the unicode code of the character in the first character string resource content is in the unicode code value range of the language character with the highest priority, if so, outputting the first character string resource content through the output module; otherwise, acquiring a language with the same attribute as the highest priority language in the N languages used for setting, obtaining second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content through the output module;
and the output module is used for outputting the character string resource content obtained by the processing module.
Optionally, the processing module is further configured to:
if the language with the same attribute as the language with the highest priority does not exist in the N languages used for setting, searching the content of a third character string resource corresponding to the character string resource identifier in the character resources of the N-1 languages used for setting according to the sequence from high priority to low priority; wherein, the language used by the N-1 settings is the language except the language with the highest priority in the languages used by the N settings; and
and outputting the third character string resource content through the output module.
Optionally, the processing module is further configured to: if the third character string resource content corresponding to the character string resource identifier is not found in the character resources of the N-1 languages set to be used according to the priority from high to low, obtaining fourth character string resource content corresponding to the character string resource identifier according to the character resources of the default language of the system, and outputting the fourth character string resource content through the output module.
In a third aspect, a computer device is provided, comprising: one or more processors; and one or more memories having instructions stored thereon that, when executed by the one or more processors, cause the computer device to perform the method of any of the first aspects described above.
In a fourth aspect, one or more computer-readable media are provided, the readable media having instructions stored thereon, which when executed by one or more processors, cause a computer device to perform the method of any of the first aspects described above.
In a fifth aspect, there is provided a computer program product for storing a computer program for performing the method of any of the first aspects above.
In the embodiment of the application, when the character string resource content corresponding to the character string resource identifier is not found in the character resource of the highest priority language in the N languages set to be used, the first character string resource content corresponding to the character string resource identifier is obtained according to the character resource of the system default language, and whether the value of the unicode of the character in the first character string resource content is within the value range of the unicode of the highest priority language character is further judged, if yes, the first character string resource content is output; otherwise, obtaining the language with the same attribute with the highest priority language in the N languages used for setting, obtaining the second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content. Therefore, in the embodiment of the application, when the content of the character string resource corresponding to the character string resource identifier is not found in the character resource of the language with the highest priority, the character string processing can be preferentially performed according to the character resource of the default language of the system or the character resource of the language with the same attribute, so that the rationality of the character string processing is improved.
Drawings
Fig. 1 is a schematic diagram of a character string processing flow provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a string processing flow according to another embodiment of the present application;
fig. 3 is a schematic structural diagram of a character string processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following technical terms are used in the embodiments of the present application, and some technical terms referred to in the embodiments of the present application will be described below first.
String resource Identification (ID): for identifying a string resource.
Character resources: usually in the form of a file, such as an eXtensible Markup Language (XML) file. Taking an XML file as an example, one language corresponds to one XML file, and the content of a string resource corresponding to a string resource identifier is defined in the XML file. The same string resource identifier has different definitions in different XML files. For example, a string resource identified as a is defined as "test character" in an XML file corresponding to chinese and "test string" in an XML file corresponding to english.
The embodiment of the application can be applied to system applications or third-party applications, and the applications can be applications based on an Android system.
The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Referring to fig. 1, a schematic diagram of a processing flow of a character string provided in the embodiment of the present application is shown. The flow may be implemented by a character string processing apparatus. The character string processing means may be a computer device or means in a computer device. The computer device may be any device with data processing capability, such as a terminal, and specifically may include: smart phones, tablet computers, notebook computers, Personal Digital Assistants (PDAs), smart wearable devices, vehicle-mounted terminals, and the like.
As shown, the process may include:
s101: and acquiring a character string resource identifier.
In a possible scenario, a character string needs to be displayed in a user interface during the running process of an application program, and at this time, a character string resource identifier is obtained first. The application program may be a system application program or a third party application program.
S102: searching the character string resource content corresponding to the character string resource identifier in the character resource of the language with the highest priority in the N (N is an integer larger than 1) languages, if the character string resource content is not searched, turning to S103, and if the character string resource content is searched, turning to S106.
Wherein, the language used by the N settings can be the language selected by the user. The user can select one or more languages through a language setting interface provided by the system, and if multiple languages are selected, the priority of the languages can be set, and the priority can be called as: a first language, a second language, a third language, and so on. If the user selected language does not match the language supported by the application, the language used by the N settings may be the intersection of the user selected language and the language supported by the application.
S103: and obtaining the first character string resource content corresponding to the character string resource identification according to the character resource of the default language of the system.
S104: and judging whether the value of the unicode of the character in the first character string resource content is in the unicode value range of the language character with the highest priority, if so, turning to S106, and otherwise, turning to S105.
The value ranges of the unicode of all characters in one language usually form a continuous value range, and the unicode of characters in different languages has different value ranges. For example, the value range (represented by hexadecimal notation) of unicode of Chinese characters is 4E 00-9 FBB.
S105: and acquiring a language with the same attribute as the highest priority language in the N languages used for setting, and acquiring second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute.
Alternatively, the language having the same attribute as the highest priority language may be a language belonging to the same country or region as the highest priority language. For example, if the highest priority language is a simplified Chinese language, the language having the same attributes as the simplified Chinese language includes a traditional Chinese language.
Optionally, if there are multiple languages with the same attribute as the highest priority language in the N languages used for setting, the second character string resource content corresponding to the character string resource identifier may be obtained according to the character resource of the highest priority language in the multiple languages.
S106: and outputting the currently searched character string resource content.
Optionally, the outputting the resource content of the character string may specifically include: the content of the character string resource is displayed on the display device, or the content of the character string resource is output to the other device, or output in other manners, which is not limited in the embodiment of the present application.
Further, in S105 of the above flow, if there is no language having the same attribute as the highest priority language in the N languages used for setting, the third character string resource content corresponding to the character string resource identifier may be searched for in the character resources of the N-1 languages used for setting other than the highest priority language in the order from the highest priority to the lowest priority.
Optionally, if the third character string resource content corresponding to the character string resource identifier is not found in the character resources of the N-1 languages set to be used according to the priority from high to low, the fourth character string resource content corresponding to the character string resource identifier may be obtained according to the character resources of the system default language.
Therefore, according to the embodiment of the application, under the condition that the character string resource content corresponding to the character string resource identifier is not found in the character resource of the language with the highest priority, the character string processing can be preferentially carried out according to the character resource of the default language of the system or the character resource of the language with the same attribute, so that the rationality of the character string processing is improved, and the character string resource compatibility of the application program can be improved.
In order to more clearly understand the embodiments of the present application, a detailed description is provided below for a specific implementation process of the embodiments of the present application with reference to a specific application scenario.
In the application scenario, an application has a character resource of a character string a (hereinafter denoted as stringA), and the languages supported by the application include simplified chinese, traditional chinese, and english.
The languages selected by the user are as follows according to the priority from high to low: simplified Chinese, English, traditional Chinese.
The structure of the system resource directory comprises:
res/values/dufalt.xml
res/values-zh-rCN/chinese1.xml
res/values-en/englishi.xml
res/values-zh-rTW/chinese2.xml
wherein, store system default language character resource file dufalt.xml under the values directory, there is the resource definition of stringA in this file: stringA ═ test characters. A simplified Chinese character resource file, named 1.xml, is stored under the value-zh-rCN directory, and the file has no resource definition of stringA. Xml stores an english character resource file englishi under the values-en directory, and the file has a resource definition of stringA: strand a is test strand. The value-zh-rTW directory stores the traditional Chinese character resource file Chinese2.xml, which has the resource definition of stringA: StringA is a test character.
Based on the above scenario, the string processing flow may be as shown in fig. 2, and includes:
s201: and acquiring a language list set in the system and an identifier of the string StringA to be processed.
Wherein, the language list comprises the following components in the order of priority from high to low: simplified Chinese, English, traditional Chinese. For convenience of description, simplified chinese will be referred to as a first language, english will be referred to as a second language, and traditional chinese will be referred to as a third language.
S202: acquiring a character resource file (res/values-zh-rCN/chips 1.xml) in a resource directory of a first language, searching the resource definition of stringA in the file, if so, turning to S209, otherwise, turning to S203.
In S209, the first language string resource content corresponding to stringA is obtained from the character resource file, and the string resource content is output.
In this example, since the chinese1.xml file does not have the resource definition of stringA, the process proceeds to S203.
S203: get the character resource file (res/values/dufat. xml) of the default language of the system, and find the resource definition of stringA in the file, and go to S204.
S204: and according to the searched resource definition of stringA, obtaining a character string corresponding to stringA, judging whether the character string contains characters of a first language (namely whether the character string contains simplified Chinese characters), if so, turning to S210, and otherwise, turning to S205.
In S210, the obtained string resource content corresponding to stringA is output.
In this step, whether the content of the character string resource contains the simplified Chinese character can be judged according to whether the value of the unicode of the character falls into the value range of the unicode of the simplified Chinese character.
In this example, there is a resource definition of stringA in dufalt. string a ═ test characters, the content of the string resource "test characters" can be obtained according to S204, and it can be determined that the content of the string resource contains chinese simplified characters through detection, so the process proceeds to S210.
S205: and whether a language belonging to the same country or region as the first language exists in the second language and the third language, if so, turning to S211, otherwise, turning to S206.
In S211, the string resource content corresponding to stringA is obtained according to the resource definition of the language with the same attribute, and the string resource content is output.
Wherein, the traditional Chinese (the third language) and the simplified Chinese (the first language) are the same national or regional language.
S206: and acquiring a character resource file (res/values-en/englishi. xml) in the resource directory of the second language, searching the resource definition of stringA in the file, if so, turning to S212, otherwise, turning to S207.
In S212, the obtained string resource content in the second language corresponding to stringA is output.
S207: and acquiring a character resource file (res/values-zh-rTW/chips 2.xml) in the resource directory of the third language, searching the resource definition of stringA in the file, if so, switching to S213, otherwise, switching to S208.
In S213, the found third language string resource content corresponding to stringA is output, and the string resource content is output.
S208: acquiring a character resource file (res/values/dufat) of a system default language, searching resource definition of stringA in the file, acquiring default language character string resource content corresponding to stringA, and outputting the character string resource content.
As can be seen from the flow shown in fig. 2, in the above scenario, the finally output character string is a simplified chinese character string "test character". According to the method provided by the prior art, the finally output character string is the English character string. The comparison of the two shows that when the application program supports simplified Chinese, the selected language includes simplified Chinese and has the highest priority, and the default language of the system is simplified Chinese, the final output is simplified Chinese character strings rather than English character strings, and obviously, the result obtained by adopting the embodiment of the application is more reasonable.
It is understood that, in order to implement the above functions, the embodiments of the present application include corresponding hardware structures and/or software modules for performing the respective functions. The elements (devices, means) and algorithm steps of the various examples described in connection with the embodiments disclosed herein may be implemented in hardware or a combination of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present teachings.
In the embodiment of the present application, functional units (devices, apparatuses) of a device for executing the method may be divided according to the method example, for example, each functional unit (device, apparatus) may be divided according to each function, or two or more functions may be integrated into one processing unit (device, apparatus). The integrated units (devices, apparatuses) may be implemented in the form of hardware, or may be implemented in the form of software functional units (devices, apparatuses). It should be noted that, in the embodiment of the present application, the division of the unit (device, apparatus) is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
In the case of using integrated units (devices ), fig. 3 shows a schematic structural diagram of a character string processing apparatus provided in an embodiment of the present application. Referring to fig. 3, the character string processing apparatus 300 includes: an acquisition module 301, a processing module 302 and an output module 303.
The obtaining module 301 is configured to obtain a string resource identifier; the processing module 302 is configured to search, in a character resource of a language with a highest priority among N languages that are set to be used, a character string resource content corresponding to the character string resource identifier, and if the character string resource content is not found, obtain, according to a character resource of a system default language, a first character string resource content corresponding to the character string resource identifier, where N is an integer greater than 1; judging whether the value of the unicode code of the character in the first character string resource content is in the unicode code value range of the language character with the highest priority, if so, outputting the first character string resource content through an output module 303; otherwise, obtaining a language with the same attribute as the highest priority language from the languages used in the N settings, obtaining second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content through an output module 303. The output module 303 is used for outputting the content of the character string resource.
Optionally, the processing module 302 is further configured to: if the language with the same attribute as the language with the highest priority does not exist in the N languages used for setting, searching the character string resource content corresponding to the character string resource identifier in the character resources of the N-1 languages used for setting according to the sequence from high priority to low priority; wherein, the language used by the N-1 settings is the language except the language with the highest priority in the languages used by the N settings; and outputting the third string resource content through an output module 303.
Optionally, the processing module 302 is further configured to: if the character string resource corresponding to the character string resource identifier is not found in the character resources of the N-1 languages set to be used according to the priority from high to low, obtaining fourth character string resource content corresponding to the character string resource identifier according to the character resources of the system default language, and outputting the fourth character string resource content through the output module 303.
Fig. 4 shows a schematic structural diagram of a computer device 400 provided in an embodiment of the present application, that is, shows another schematic structural diagram of the character string processing apparatus 300. Referring to fig. 4, the computer device 400 includes a processor 401, a network interface 402. The processor 401 may also be a controller. The processor 401 is configured to support the string processing apparatus 300 to perform the functions referred to in fig. 1 or fig. 2. The network interface 402 is configured to support the functions of the string processing apparatus 300 for transmitting and receiving messages. The computer device 400 may also include a memory 403, the memory 403 being adapted to be coupled to the processor 401 and to store program instructions and data necessary for the device. The processor 401, the network interface 402 and the memory 403 are connected, the memory 403 is used for storing instructions, and the processor 401 is used for executing the instructions stored in the memory 403 to control the network interface 402 to send and receive messages, so as to complete the steps of the above method in which the character string processing apparatus 300 executes corresponding functions.
In the embodiment of the present application, for concepts, explanations, details, and other steps related to the character string processing apparatus 300 and the computer device 400 related to the technical solution provided in the embodiment of the present application, please refer to the description of the foregoing method or the description related to these contents in other embodiments, which is not described herein again.
It should be noted that the processor referred to in the embodiments of the present application may be a Central Processing Unit (CPU), a general purpose processor, a Digital Signal Processor (DSP), an application-specific integrated circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic devices, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., comprising one or more microprocessors, a DSP and a microprocessor, or the like. Wherein the memory may be integrated in the processor or may be provided separately from the processor.
The embodiment of the present application further provides a computer storage medium for storing instructions, which when executed, can perform any one of the methods related to the foregoing character string processing apparatus.
The embodiment of the present application further provides a computer program product for storing a computer program, where the computer program is used to execute the character string processing method in the foregoing method embodiment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

Claims (9)

1. A method for processing a character string, comprising:
acquiring a character string resource identifier;
searching character string resource content corresponding to the character string resource identifier in character resources of a language with the highest priority in N languages which are set to be used, if the character string resource content is not searched, obtaining first character string resource content corresponding to the character string resource identifier according to character resources of a system default language, wherein N is an integer greater than 1;
judging whether the value of the unicode code of the character in the first character string resource content is in the unicode code value range of the language character with the highest priority or not, and if so, outputting the first character string resource content; otherwise, acquiring a language with the same attribute as the highest priority language in the N languages used for setting, acquiring second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content;
wherein the language having the same attribute as the highest priority language is: a language belonging to the same country or region as the highest priority language.
2. The method according to claim 1, wherein if there are a plurality of languages having the same attribute as the highest priority language among the N languages used in the setting, the obtaining, according to the character resource of the language having the same attribute, the second character string resource content corresponding to the character string resource identifier comprises:
and obtaining second character string resource content corresponding to the character string resource identification according to the character resource of the language with the highest priority in the plurality of languages.
3. The method of claim 1, wherein if no language having the same attributes as the highest priority language is present in the languages used by the N settings, the method further comprises:
according to the sequence of the priority from high to low, searching the third character string resource content corresponding to the character string resource identifier in the character resources of N-1 languages set to be used; wherein, the language used by the N-1 settings is the language except the language with the highest priority in the languages used by the N settings;
and outputting the third character string resource content.
4. The method according to claim 3, wherein if the third string resource content corresponding to the string resource identifier is not found in the character resources of the N-1 languages set to be used in the order from high priority to low priority, the method further comprises:
obtaining fourth character string resource content corresponding to the character string resource identification according to the character resource of a system default language;
and outputting the fourth character string resource content.
5. A character string processing apparatus, comprising: the device comprises an acquisition module, a processing module and an output module;
the acquisition module is used for acquiring the character string resource identifier;
the processing module is used for searching the character string resource content corresponding to the character string resource identifier in the character resource of the language with the highest priority in the N languages, and if the character string resource content is not searched, obtaining the first character string resource content corresponding to the character string resource identifier according to the character resource of the default language of the system, wherein N is an integer greater than 1; and
judging whether the value of the unicode code of the character in the first character string resource content is in the unicode code value range of the language character with the highest priority, if so, outputting the first character string resource content through the output module; otherwise, acquiring a language with the same attribute as the highest priority language in the N languages used for setting, obtaining second character string resource content corresponding to the character string resource identifier according to the character resource of the language with the same attribute, and outputting the second character string resource content through the output module;
the output module is used for outputting the character string resource content obtained by the processing module;
wherein the language having the same attribute as the highest priority language is: a language belonging to the same country or region as the highest priority language.
6. The apparatus of claim 5, wherein the processing module is further to:
if the language with the same attribute as the language with the highest priority does not exist in the N languages used for setting, searching the content of a third character string resource corresponding to the character string resource identifier in the character resources of the N-1 languages used for setting according to the sequence from high priority to low priority; wherein, the language used by the N-1 settings is the language except the language with the highest priority in the languages used by the N settings; and
and outputting the third character string resource content through the output module.
7. The apparatus of claim 6, wherein the processing module is further to:
if the third character string resource content corresponding to the character string resource identifier is not found in the character resources of the N-1 languages set to be used according to the priority from high to low, obtaining fourth character string resource content corresponding to the character string resource identifier according to the character resources of the default language of the system, and outputting the fourth character string resource content through the output module.
8. A computer device, comprising: a processor and a memory having instructions stored thereon that, when executed by the processor, cause the computer device to perform the method of any of claims 1-4.
9. A computer-readable medium having instructions stored thereon, which when executed by one or more processors, cause a computer to perform the method of any one of claims 1-4.
CN201711295913.0A 2017-12-08 2017-12-08 Character string processing method and device Active CN108089900B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711295913.0A CN108089900B (en) 2017-12-08 2017-12-08 Character string processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711295913.0A CN108089900B (en) 2017-12-08 2017-12-08 Character string processing method and device

Publications (2)

Publication Number Publication Date
CN108089900A CN108089900A (en) 2018-05-29
CN108089900B true CN108089900B (en) 2020-12-04

Family

ID=62174877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711295913.0A Active CN108089900B (en) 2017-12-08 2017-12-08 Character string processing method and device

Country Status (1)

Country Link
CN (1) CN108089900B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831866A (en) * 2019-04-23 2020-10-27 北京猫眼文化传媒有限公司 Mode identification method and device for input information

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5351190A (en) * 1990-10-17 1994-09-27 Canon Kabushiki Kaisha Communication apparatus and method establishing a language dependent sort order search
CN101140570A (en) * 2006-09-04 2008-03-12 富士施乐株式会社 Translating device, translating method and computer readable medium
CN101441567A (en) * 2008-11-18 2009-05-27 宇龙计算机通信科技(深圳)有限公司 Method and system for supporting multiple-language user interface in mobile terminal
CN103425509A (en) * 2013-08-07 2013-12-04 深圳市欧珀通信软件有限公司 Method and device for installing language package
CN103631772A (en) * 2012-08-29 2014-03-12 阿里巴巴集团控股有限公司 Machine translation method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5351190A (en) * 1990-10-17 1994-09-27 Canon Kabushiki Kaisha Communication apparatus and method establishing a language dependent sort order search
CN101140570A (en) * 2006-09-04 2008-03-12 富士施乐株式会社 Translating device, translating method and computer readable medium
CN101441567A (en) * 2008-11-18 2009-05-27 宇龙计算机通信科技(深圳)有限公司 Method and system for supporting multiple-language user interface in mobile terminal
CN103631772A (en) * 2012-08-29 2014-03-12 阿里巴巴集团控股有限公司 Machine translation method and device
CN103425509A (en) * 2013-08-07 2013-12-04 深圳市欧珀通信软件有限公司 Method and device for installing language package

Also Published As

Publication number Publication date
CN108089900A (en) 2018-05-29

Similar Documents

Publication Publication Date Title
CN107844324B (en) Client page jump processing method and device
CN108647032B (en) Application loading method and device, computer device and computer readable storage medium
CN111581555B (en) Document loading method, device, equipment and storage medium
CN110688096B (en) Method and device for constructing application program containing plug-in, medium and electronic equipment
CN113536174A (en) Interface loading method, device and equipment
CN113641936B (en) Method, device, electronic equipment and storage medium for page skip
CN108089900B (en) Character string processing method and device
CN106156050B (en) Data processing method and device
CN112817660A (en) Method, device, equipment and storage medium for expanding small program capacity
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN104063277A (en) Information processing method and electronic equipment
AU2013206622B2 (en) Download management method and device based on Android browser
CN112905072B (en) Application processing method and device and electronic equipment
CN112752163B (en) Method and device for configuring default language and television
CN115437551A (en) Data cloning method, device, storage medium and computer program product
CN113342553A (en) Data acquisition method and device, electronic equipment and storage medium
CN108595335B (en) Test environment deployment method, deployment device and storage medium
CN113760274A (en) Front-end component logic injection method and device
CN105357265A (en) Method for identifying state of being hijacked of browser
CN112612531A (en) Application program starting method and device, electronic equipment and storage medium
CN114546522B (en) Picture configuration method and device for application, electronic equipment and storage medium
CN113626665B (en) Data display method and device
CN117193880A (en) Code loading method, device and equipment of application program and storage medium
CN109542456B (en) Application similarity obtaining method and device and terminal
CN112015394A (en) Android functional module development method and device, computer system and storage medium

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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 266071 Shandong city of Qingdao province Jiangxi City Road No. 11

Patentee after: Qingdao Hisense Mobile Communication Technology Co.,Ltd.

Address before: 266071 Shandong city of Qingdao province Jiangxi City Road No. 11

Patentee before: HISENSE MOBILE COMMUNICATIONS TECHNOLOGY Co.,Ltd.