Software language switching method, device, electronic device and computer readable medium
By identifying and mapping the language of user interface text, real-time language switching of domestic software is realized, which solves the problem of restarting existing domestic software and improves the efficiency and experience of user interface switching.
Patent Information
- Application Number
- CN202210761118.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Existing domestic software does not support real-time language switching, resulting in users needing to restart the software to change the language environment, affecting users' work efficiency and user experience.
Provide a software language switching method, by identifying the text to be switched in the user interface, determining the first and second languages it uses, obtaining the mapping relationship between the two, real-time language switching of the user interface, without restarting the software .
Real-time switching of domestic software locale environments has been realized, the efficiency of switching user interface text has been improved, the user's waiting time has been reduced, and the user experience has been improved.
Smart Images

Figure CN115061768B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision, and in particular to a method, device, electronic device and computer-readable medium for switching the language of software. Background Art
[0002] With the development of software technology, in order to make software better enter the international market, people have proposed the theory of software internationalization and localization. The key to software internationalization is to solve the problem of information processing in different languages in different countries and regions, so as to make software localization easier and more efficient. Among them, separating software code from localizable resource files (menus, dialog boxes, screen prompts, etc.) is a common method of software internationalization design, which can improve the efficiency and quality of localization and reduce the complexity of localization.
[0003] For large-scale finite element analysis software, foreign software has been in a monopoly position in the past 40 years, and users have been using the English environment. Because users are accustomed to the professional terminology and operating environment in the English environment, when using domestically produced local software, they often need to switch Chinese terms to English terms. However, existing domestic software does not support real-time language switching. When switching related functions of the software, the software needs to be restarted so that the software can obtain the new language environment. Restarting the software often reduces user work efficiency and affects the user experience. Summary of the invention
[0004] In order to solve or partially solve the problems existing in the related art, the present application provides a software language switching method, device, electronic device and computer-readable medium, which can switch the language application environment of domestic software in real time.
[0005] The first aspect of the present application provides a method for switching the language of a software, comprising:
[0006] Identify the text to be switched in the user interface, determine the first language used by the text to be switched, and read the first language resource file corresponding to the first language;
[0007] Determine the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction;
[0008] A mapping relationship between a first language resource file and a second language resource file is obtained, and according to the mapping relationship, the text of the current user interface is switched from the first language to the second language.
[0009] Optionally, the first language is a system default language, and before determining the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction, the method includes:
[0010] The first language resource file is read, and the string information of the text to be switched is called from the first language resource file.
[0011] Optionally, obtaining a mapping relationship between the first language resource file and the second language resource file includes:
[0012] Traversing the second language resource file, translating the first language of the text to be switched to obtain the second language of the text to be switched;
[0013] Establishing a calling relationship between the second language of the text to be switched and the second language resource file;
[0014] A mapping relationship between the first language resource file and the second language resource file is generated according to the calling relationship.
[0015] Optionally, establishing a calling relationship between the second language of the text to be switched and the second language resource file includes:
[0016] Get the storage path of the second language of the text to be switched in the second language resource file;
[0017] A query directory between the second language of the text to be switched and the second language resource file is established according to the storage path, and a calling relationship is generated according to the query directory.
[0018] Optionally, establishing a query directory between the second language of the text to be switched and the second language resource file according to the storage path includes:
[0019] According to a preset order, the storage paths are sequentially stored in the query directory. The query directory is a directory tree containing multiple nodes. The directory tree includes space nodes and class nodes. Each space node corresponds to multiple class nodes.
[0020] Optionally, according to the mapping relationship, the text of the current user interface is switched from the first language to the second language, including:
[0021] Delete the string in the first language of the current user interface text;
[0022] The second language string is loaded from the second language resource file according to the mapping relationship.
[0023] Optionally, the method further comprises:
[0024] The file name of the image of the user interface is obtained, and the second language string is loaded according to the file name of the image in a preset image loading order, so as to switch the user interface from the first language to the second language.
[0025] A second aspect of the present application provides a software language switching device, comprising:
[0026] A first recognition module, used to recognize the text to be switched in the user interface, determine the first language used by the text to be switched, and read the first language resource file corresponding to the first language;
[0027] A second identification module, used to determine a second language to be switched and a language resource file corresponding to the second language according to the language switching instruction;
[0028] The replacement module is used to obtain a mapping relationship between a first language resource file and a second language resource file, and according to the mapping relationship, the text of the current user interface is switched from the first language to the second language.
[0029] Optionally, the replacement module includes: a translation submodule, configured to traverse the second language resource file and translate the first language of the text to be switched to obtain the second language of the text to be switched;
[0030] A calling submodule, used to establish a calling relationship between the second language of the text to be switched and the second language resource file;
[0031] The mapping submodule is used to generate a mapping relationship between the first language resource file and the second language resource file according to the calling relationship.
[0032] Optionally, the calling submodule is further used to obtain the storage path of the second language of the text to be switched in the second language resource file; establish a query directory between the second language of the text to be switched and the second language resource file according to the storage path, and generate a calling relationship according to the query directory.
[0033] Optionally, the calling submodule is also used to store the storage paths into the query directory in sequence according to a preset order. The query directory is a directory tree containing multiple nodes. The directory tree includes space nodes and class nodes. Each space node corresponds to multiple class nodes.
[0034] A third aspect of the present application provides a vehicle, comprising:
[0035] Processor; and
[0036] The memory stores executable codes thereon, and when the executable codes are executed by the processor, the processor is caused to execute the method as described above.
[0037] A fourth aspect of the present application provides a computer-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor is caused to execute the method as described above.
[0038] The technical solution provided by the present application may include the following beneficial effects: on the one hand, the first language is the system default language. When the user interface text is switched from the first language to the second language, the user interface text is directly switched from the first language to the second language through the mapping relationship between the first language resource library and the second language resource library established in advance, without restarting the software; on the other hand, when the user interface text is switched from the second language to the first language, the second language string is directly deleted and the first language string is directly loaded from the system, thereby speeding up the operation speed of switching from the second language to the first language without restarting the software.
[0039] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and other objects, features and advantages of the present application will become more apparent by describing in more detail exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.
[0041] Figure 1 It is a flowchart of a method for switching the language of software shown in an embodiment of the present application;
[0042] Figure 2 is a structural diagram of a software language switching device shown in an embodiment of the present application;
[0043] Figure 3 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0045] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0046] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0047] With the development of software technology, in order to make software better enter the international market, people have proposed the theory of software internationalization and localization. The key to software internationalization is to solve the problem of information processing in different languages in different countries and regions, so as to make software localization easier and more efficient. Among them, separating software code from localizable resource files (menus, dialog boxes, screen prompts, etc.) is a common method of software internationalization design, which can improve the efficiency and quality of localization and reduce the complexity of localization.
[0048] Since users are accustomed to the professional terminology and operating environment in English, they often need to switch Chinese terminology to English terminology when using domestic software. However, existing domestic software does not support real-time language switching. When switching related functions of the software, the software needs to be restarted so that the software can obtain the new language environment. Restarting the software often affects the user's efficiency and experience.
[0049] In response to the above problems, an embodiment of the present application provides a method for switching the language of software, which can realize real-time switching of the language environment of domestic software.
[0050] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.
[0051] See also Figure 1 , is a flowchart of a method for switching the language of software according to an embodiment of the present application, which mainly includes steps S101 to S103, as described below:
[0052] Step S101: identifying the text to be switched in the user interface, determining the first language used by the text to be switched, and reading a first language resource file corresponding to the first language.
[0053] In the embodiment of the present application, the text to be switched of the user interface is the text of each functional interface of the user. In the present application, the functional interface is the Ribbon (function area) interface, and all functions and commands are organized in this area. The name displayed at the top of the function area, such as "Start", "Data", "View", etc., is the name of the corresponding tab. By clicking the name of the tab, you can enter the corresponding tab page. The functional interface includes various groups, and the name displayed at the bottom of the group is the name of the group. The name of the group also reflects the functions bound to the controls contained in the group. For example, the functions contained in the "data source" group are functions related to operations related to data sources. Some groups will bind dialog boxes. When a group is bound to a dialog box, a special small button will appear in the lower right corner of the group, called a pop-up group dialog box button. For example, when the software is calculating, clicking the "Run" point button will pop up a dialog box. The dialog box is used to determine whether to calculate according to the current data to assist in the setting of related functions.
[0054] In one embodiment, the first language is the system default language. Before determining the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction, it includes: reading the first language resource file and calling the string information of the text to be switched from the first language resource file.
[0055] In this embodiment, the first language is obtained as the system default language, and the string information is directly called from the system to complete the first language display of the user interface. In one embodiment, the default language is often English. When the software is first started on the mobile terminal, the system language of the mobile terminal can be obtained and the obtained system language can be used as the current language.
[0056] Step S102: determining the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction.
[0057] When using the process software of this embodiment, a language variable (such as curlanguage) can be predefined in the software, and the language variable can record the identification information of the current language of the software. The identification information of the current language can specifically be the English abbreviation of the current language. When the software is started, the current language can be determined according to the identification information carried by the language switching instruction.
[0058] The language resource file can be a library containing all professional vocabulary of the second language, or a library of professional vocabulary of the second language corresponding to each functional module. The second language resource file can be named as module name_language identifier.qm, where qm is the file suffix. For example, CaeData_zh_CN.qm means the simplified Chinese language resource file of the CaeData module.
[0059] In one embodiment, the second language is Chinese, and the system adopts Chinese as the text language of the user interface in daily use.
[0060] In the present application, there is no order relationship between step S101 and step S102, and step S102 may be performed first and then step S101.
[0061] Step S103: obtaining a mapping relationship between the first language resource file and the second language resource file, and switching the text of the current user interface from the first language to the second language according to the mapping relationship.
[0062] In one embodiment, obtaining a mapping relationship between a first language resource file and a second language resource file includes: traversing the second language resource file, translating the first language of a text to be switched to obtain a second language of the text to be switched; establishing a calling relationship between the second language of the text to be switched and the second language resource file; and generating a mapping relationship between the first language resource file and the second language resource file according to the calling relationship.
[0063] In this embodiment, translating the first language of the switching text to obtain the second language of the text to be switched includes searching a first language and second language translation comparison table to obtain a correspondence between the first language of the text to be switched and the second language of the text to be switched.
[0064] In this step, if there is no English vocabulary comparison table in the original system, in order to meet the needs of further translation, it is necessary to read the translation word library from the outside. The read word library can contain multiple language comparison forms, such as character form comparison method or grammatical form string comparison method. According to the translation language library, the string information of the original resource file is translated to obtain the translated resource file; after reading the translation word library, the local first language resource file can be translated. There are also multiple translation methods, such as a multi-step translation method: first translate by grammatical keywords, then translate by characters, or translate the keywords first by setting the keyword library, so as to improve the accuracy of the translation.
[0065] In this embodiment, establishing a calling relationship between the second language of the text to be switched and the second language resource file includes: obtaining a storage path of the second language of the text to be switched in the second language resource file; establishing a query directory between the second language of the text to be switched and the second language resource file according to the storage path, and generating a calling relationship according to the query directory.
[0066] Since the second language resource file needs to be indexed when searching for the language to be switched later, the index is mainly indexed by the class name of the object-oriented design language. All text resources in a class are managed under the class. At the same time, the class is under different namespaces, and the namespaces can be nested, thus forming a tree-like hierarchical relationship. The index can establish a call relationship through the query directory and index according to the call relationship. Specifically, a query directory between the second language of the text to be switched and the second language resource file is established according to the storage path, including: according to a preset order, the storage path is sequentially stored in the query directory, and the query directory is a directory tree containing multiple nodes, and the directory tree includes space nodes and class nodes, and each space node corresponds to multiple class nodes.
[0067] In this embodiment, the space node corresponds to the namespace, the class node corresponds to the class, and the storage path can be stored in the target class node under the target space node according to the preset rules. The query directory is used to classify the storage path, so that the terminal can quickly find relevant data.
[0068] Optionally, in this embodiment, storing the storage paths in sequence into the query directory includes: storing the storage paths in sequence into the query directory in the order in which the second language of the text to be switched is acquired.
[0069] In this embodiment, the query directory is established to quickly find the location of the second language of the text to be switched in the second language resource library, thereby avoiding traversing the second language resource files and improving the efficiency of indexing the second language resource files of the text to be switched.
[0070] In one embodiment, the query directory can also be generated according to the function of the user interface, and the spatial nodes of the query directory correspond to the functional modules of the user interface. The class nodes of the spatial nodes correspond to the options under the functional modules. The second language of the text to be switched is directly stored according to the arrangement of the user interface.
[0071] In step S103, the text of the current user interface is switched from the first language to the second language according to the mapping relationship, including: deleting the first language string of the text of the current user interface; and loading the second language string from the second language resource file according to the mapping relationship.
[0072] In one embodiment, in order to obtain the switched text, it is also necessary to load the graphic information of the user interface corresponding to the text on the user interface to enable the second language to be displayed on the graphic of the user interface. The loading method includes: obtaining a resource configuration file of the user interface image, the resource configuration file at least including the menu logo, dialog logo, and icon logo of the user interface; loading the second language string according to the resource configuration file of the image in a preset image loading order to enable the user interface to switch from the first language to the second language.
[0073] Specifically, the picture resource configuration file of the picture pre-records the picture body name of the text box involved in each functional component, such as ui_image1, ui_iamge2. In this step, the software reads the picture resource body name recorded in the picture resource configuration file according to the determined current language, combines it with the post / prefix information of the current language, obtains the name of the picture resource storage directory of the current language, and then determines the picture resource storage path of the current language. Afterwards, for each picture body name read, the software combines the picture body name with the prefix / suffix information of the current language, obtains the picture name of the picture to be loaded, and sends a picture loading notification carrying the picture resource storage path of the current language and the picture name of the picture to be loaded to the engine of this software; the software engine loads the picture with the picture name under the picture resource storage path of the current language in this software according to the picture loading notification. Among them, the picture resource storage path of the current language can be determined according to the suffix information of the current language. For example, if the image resource main body name recorded in the image resource configuration file is ui_image, the current language is Chinese, and the suffix information of Chinese is _ch, then ui_image and _ch can be combined to obtain the name of the English image resource storage directory: ui_image_ch, and then the English image resource storage path can be determined. In addition, the image resource storage path of the current language can also be determined based on the prefix information of the current language, or the image resource storage path of the current language can also be determined based on the suffix information and prefix information of the current language.
[0074] The image name of the image to be loaded can be obtained by combining the image main body name with the prefix information of the current language. For example, if the current language is English, the prefix information of English is en_, and the read image main body names are ui_image1 and ui_image2, then ui_image1 can be combined with en_, and ui_image2 can be combined with en_, and the image names of the images to be loaded can be en_ui_image1 and en_ui_image2 respectively. In addition, the image name of the image to be loaded can also be obtained by combining the image main body name with the suffix information of the current language, or by combining the image main body name with the prefix information and suffix information of the current language.
[0075] In one embodiment, the user language switching instruction is to switch the second language to the first language. In this case, the software switching method includes: unloading the second language string and directly loading the first language from the first language file resource.
[0076] In this embodiment, for the character resources to be displayed on the software graphical interface, there is a mark in the source code (called by the tr method), and all character resources are expressed in English in the source code. In this way, when the user is in an English language environment, there is no need for translation and the corresponding character resources can be used directly.
[0077] In one embodiment, the function identifier and text information of the user interface jointly generate a string stored in the second language resource file. In this case, there is no need to index the directory, and the common function identifier is directly queried to achieve the switching of the user interface from the first language to the second language.
[0078] From the above Figure 1 It can be seen from the language switching method of the example software that, on the one hand, the first language is the system default language. When the user interface text is switched from the first language to the second language, the user interface text is directly switched from the first language to the second language through the mapping relationship between the first language resource library and the second language resource library established in advance, without restarting the software; on the other hand, when the user interface text is switched from the second language to the first language, the second language string is directly deleted, and the first language string is directly loaded from the system, thereby speeding up the running speed of switching from the second language to the first language without restarting the software.
[0079] Corresponding to the aforementioned application function implementation method embodiment, the present application also provides a software language switching device, a vehicle and corresponding embodiments.
[0080] Figure 2 1 is a schematic diagram of the structure of the software language switching device shown in the embodiment of the present application. For the convenience of explanation, only the parts related to the embodiment of the present application are shown. Figure 2 The exemplary device mainly includes a first identification module 201, a second identification module 202, and a replacement module 203, wherein:
[0081] The first recognition module 201 is used to recognize the text to be switched in the user interface, determine the first language used by the text to be switched, and read the first language resource file corresponding to the first language;
[0082] The second identification module 202 is used to determine the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction;
[0083] The replacement module 203 is used to obtain a mapping relationship between the first language resource file and the second language resource file, and according to the mapping relationship, the text of the current user interface is switched from the first language to the second language.
[0084] Optionally, the first language is the system default language. Before determining the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction, the method includes: reading the first language resource file, and calling the string information of the text to be switched from the first language resource file.
[0085] Optionally, the replacement module 203 includes: a translation submodule, which is used to traverse the second language resource file and translate the first language of the text to be switched to obtain the second language of the text to be switched; a calling submodule, which is used to establish a calling relationship between the second language of the text to be switched and the second language resource file; and a mapping submodule, which is used to generate a mapping relationship between the first language resource file and the second language resource file according to the calling relationship.
[0086] Optionally, the calling submodule establishes a calling relationship between the second language of the text to be switched and the second language resource file, including: obtaining the storage path of the second language of the text to be switched in the second language resource file; establishing a query directory between the second language of the text to be switched and the second language resource file according to the storage path, and generating a calling relationship according to the query directory.
[0087] Optionally, the calling submodule establishes a query directory between the second language of the text to be switched and the second language resource file according to the storage path, including: storing the storage path into the query directory in sequence according to a preset order, the query directory is a directory tree containing multiple nodes, the directory tree includes space nodes and class nodes, and each space node corresponds to multiple class nodes.
[0088] Optionally, the mapping submodule switches the text of the current user interface from the first language to the second language according to the mapping relationship, including: deleting the first language string of the text of the current user interface; and loading the second language string from the second language resource file according to the mapping relationship.
[0089] Optionally, the device further includes a text loading module, which is used to obtain a file name of a picture of the user interface, and load a second language string according to the file name of the picture in a preset picture loading order to switch the user interface from the first language to the second language.
[0090] From the above Figure 2It can be seen from the language switching device of the example software that, on the one hand, the first language is the system default language. When the user interface text is switched from the first language to the second language, the user interface text is directly switched from the first language to the second language through the mapping relationship between the first language resource library and the second language resource library established in advance, without restarting the software; on the other hand, when the user interface text is switched from the second language to the first language, the second language string is directly deleted and the first language string is directly loaded from the system, thereby speeding up the operation speed of switching from the second language to the first language without restarting the software.
[0091] See also Figure 3 , is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. The electronic device 300 includes a memory 310 and a processor 320 .
[0092] The processor 320 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0093] The memory 310 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. Among them, ROM can store static data or instructions required by the processor 320 or other modules of the computer. The permanent storage device may be a readable and writable storage device. The permanent storage device may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In some other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at run time. In addition, the memory 310 may include any combination of computer-readable storage media, including various types of semiconductor storage chips (such as DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 310 may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (such as a DVD-ROM, a double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (such as an SD card, a mini SD card, a Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not include carrier waves and transient electronic signals transmitted wirelessly or wired.
[0094] The memory 310 stores executable codes, and when the executable codes are processed by the processor 320 , the processor 320 can execute part or all of the methods described above.
[0095] In addition, the method according to the present application may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing some or all of the steps in the above method of the present application.
[0096] Alternatively, the present application can also be implemented as a computer-readable storage medium (or non-temporary machine-readable storage medium or machine-readable storage medium) on which executable code (or computer program or computer instruction code) is stored. When the executable code (or computer program or computer instruction code) is executed by a processor of a vehicle (or server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present application.
[0097] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for switching the language of software, It is characterized in that Applied to large-scale finite element analysis software, including: Identify the text to be switched in the user interface, determine the first language used by the text to be switched, and read the first language resource file corresponding to the first language; the text to be switched in the user interface is the text of each user function interface, and the function interface includes tabs corresponding to functions and commands; Determine the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction; Traversing the second language resource file, translating the first language of the text to be switched to obtain the second language of the text to be switched; establishing a calling relationship between the second language of the text to be switched and the second language resource file; generating a mapping relationship between the first language resource file and the second language resource file according to the calling relationship; The establishing of the calling relationship between the second language of the text to be switched and the second language resource file comprises: obtaining the storage path of the second language of the text to be switched in the second language resource file; establishing a query directory between the second language of the text to be switched and the second language resource file according to the storage path, and generating the calling relationship according to the query directory; the query directory is a directory tree including a plurality of nodes, the directory tree including a space node and a class node, each space node corresponding to a plurality of class nodes, wherein the space node corresponds to a namespace, corresponding to a function module of the user interface, the class node corresponds to a class, corresponding to an option under the function module, the storage path is stored in a target class node under a target space node according to a preset rule, and the query directory is used to classify the storage path; The step of establishing a query directory between the second language of the text to be switched and the second language resource file according to the storage path comprises: storing the storage paths in sequence into the query directory in the order in which the second language of the text to be switched is acquired; wherein the second language of the text to be switched is stored according to the arrangement of the user interface; According to the mapping relationship, the text of the current user interface is switched from the first language to the second language, and the first language character string of the text of the current user interface is deleted; and the second language character string is loaded from the second language resource file according to the mapping relationship.
2. The method according to claim 1, It is characterized in that The first language is a system default language, and before determining the second language to be switched and the language resource file corresponding to the second language according to the language switching instruction, the method includes: The first language resource file is read, and the character string information of the text to be switched is called from the first language resource file.
3. The method according to claim 1, It is characterized in that The method further comprises: Acquire a resource configuration file of a picture of a user interface, wherein the resource configuration file includes at least a menu identifier, a dialog box identifier, and an icon identifier of the user interface; The second language string is loaded according to the resource configuration file of the image in accordance with a preset image loading sequence, so as to implement switching of the user interface from the first language to the second language.
4. A software language switching device, It is characterized in that Applied to large-scale finite element analysis software, the device comprises: A first recognition module is used to recognize the text to be switched in the user interface, determine the first language used by the text to be switched, and read the first language resource file corresponding to the first language; the text to be switched in the user interface is the text of each user function interface, and the function interface includes tabs corresponding to functions and commands; A second identification module, used to determine a second language to be switched and a language resource file corresponding to the second language according to the language switching instruction; A replacement module, configured to obtain a mapping relationship between a first language resource file and a second language resource file, and according to the mapping relationship, switch the text of the current user interface from the first language to the second language; The replacement module includes: a translation submodule, which is used to traverse the second language resource file and translate the first language of the text to be switched to obtain the second language of the text to be switched; a calling submodule, which is used to establish a calling relationship between the second language of the text to be switched and the second language resource file; and a mapping submodule, which is used to generate a mapping relationship between the first language resource file and the second language resource file according to the calling relationship; The calling submodule is further used to obtain the storage path of the second language of the text to be switched in the second language resource file; establish a query directory between the second language of the text to be switched and the second language resource file according to the storage path, and generate the calling relationship according to the query directory; the query directory is a directory tree containing multiple nodes, the directory tree includes space nodes and class nodes, each space node corresponds to multiple class nodes, wherein the space node corresponds to a namespace, corresponding to the function module of the user interface, the class node corresponds to a class, corresponding to the option under the function module, the storage path is stored in the target class node under the target space node according to a preset rule, and the query directory is used to classify the storage path; The calling submodule is further used to store the storage paths in the query directory in sequence according to the order of obtaining the second language of the text to be switched; wherein the second language of the text to be switched is stored according to the arrangement of the user interface; The replacement module is further configured to delete the first language character string of the text of the current user interface; and load the second language character string from the second language resource file according to the mapping relationship.
5. An electronic device, It is characterized in that include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, It is characterized in that An executable code is stored thereon, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the method as claimed in any one of claims 1 to 3.
