CN110647371A - A method and system for parsing multilingual resource files based on business configuration - Google Patents
A method and system for parsing multilingual resource files based on business configuration Download PDFInfo
- Publication number
- CN110647371A CN110647371A CN201910782647.7A CN201910782647A CN110647371A CN 110647371 A CN110647371 A CN 110647371A CN 201910782647 A CN201910782647 A CN 201910782647A CN 110647371 A CN110647371 A CN 110647371A
- Authority
- CN
- China
- Prior art keywords
- resource file
- multilingual
- file
- resource
- function
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
- G06F9/454—Multi-language systems; Localisation; Internationalisation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本发明涉及多语言配置技术领域,特别是涉及一种基于业务配置的多语言资源文件解析方法、系统、设备及计算机可读存储介质。The present invention relates to the technical field of multilingual configuration, in particular to a method, system, device and computer-readable storage medium for parsing multilingual resource files based on business configuration.
背景技术Background technique
随着国际化贸易飞速发展和合资企业如雨后春笋似的涌现,各大企业利用多语言技术为全球用户提供更完善的服务。With the rapid development of international trade and the emergence of joint ventures, major enterprises use multilingual technology to provide better services to global users.
目前现有多语言解决方案包括两大模块:多语言资源文件(存放多语言翻译数据的一种文件)和多语言资源文件解析引擎(使用多语言资源文件,使之生效)。其中多语言资源文件解析引擎根据当前系统上下文的语言设置,负责把多语言资源文件的配置数据分发呈现到用户操作界面,以达到不同语种的用户看见不同语言操作界面的目的。At present, the existing multilingual solution includes two modules: multilingual resource file (a file for storing multilingual translation data) and multilingual resource file parsing engine (using multilingual resource file to make it effective). The multilingual resource file parsing engine is responsible for distributing and presenting the configuration data of the multilingual resource file to the user interface according to the language setting of the current system context, so that users of different languages can see the operation interface in different languages.
目前的现有多语言解决方案具有局限性:比如某项翻译,在中文环境下占6个字符,而在英文环境下占12个字符,甚至在日文环境下占18个字符。如果处理不当,就会导致用户操作界面在某些语言环境下发生布局错乱,影响最终呈现效果。Current existing multilingual solutions have limitations: for example, a translation takes 6 characters in a Chinese environment, 12 characters in an English environment, and even 18 characters in a Japanese environment. If it is not handled properly, the layout of the user interface will be disordered in some language environments, which will affect the final rendering effect.
不同的语言环境,同一个键值(Key),翻译的数据(Value)长度不一样,那么,呈现到界面控件上的效果就可能不一样,不好做个性化定制。需要个性化调整的地方包括(但不限于):控件的长度,控件的位置,控件所在父级控件的属性等。Different language environments, the same key value (Key), the length of the translated data (Value) is different, then the effect displayed on the interface control may be different, and it is not easy to customize. The places that need to be adjusted individually include (but are not limited to): the length of the control, the position of the control, the properties of the parent control where the control is located, and so on.
一个多语言键值对可能不只完成界面控件的一种属性(如控件显示的文本属性)的赋值翻译,还可能还需要对控件TITLE标题(一种鼠标移到该控件后显示文字的控制属性)之类的数据做翻译,而现有方案无法感知“一个控件需要多个属性的赋值”需求,虽然能通过增加键值得方式实现,但比较繁琐。A multilingual key-value pair may not only complete the assignment and translation of a property of the interface control (such as the text property displayed by the control), but may also require the title of the control TITLE (a control property that displays text after the mouse is moved to the control) Such data are translated, and the existing solution cannot perceive the requirement of "a control requires the assignment of multiple attributes". Although it can be achieved by adding key values, it is rather cumbersome.
发明内容SUMMARY OF THE INVENTION
鉴于以上所述现有技术的缺点,本发明的目的在于提供一种基于业务配置的多语言资源文件解析方法、系统、设备及计算机可读存储介质,用于解决现有技术中就会导致用户操作界面在某些语言环境下发生布局错乱,影响最终呈现效果的问题。In view of the above-mentioned shortcomings of the prior art, the purpose of the present invention is to provide a method, system, device and computer-readable storage medium for parsing multilingual resource files based on business configuration, which are used to solve the problem that the prior art will cause users The layout of the operation interface is disordered in some language environments, which affects the final rendering effect.
本发明提供一种基于业务配置的多语言资源文件解析方法,包括步骤:S1、对资源文件进行配置;S2、将配置中带有业务的键值对数据生成多语言资源文件;S3、采用多语言资源文件解析法对所述多语言资源文件进行解析,完成操作界面的多语言的场景适配。The invention provides a multilingual resource file parsing method based on business configuration, comprising the steps of: S1, configuring the resource file; S2, generating a multilingual resource file from the key-value pair data with business in the configuration; S3, adopting multiple The language resource file parsing method parses the multilingual resource file to complete the multilingual scene adaptation of the operation interface.
于本发明的一实施例中,所述步骤S2包括步骤:分别对配置后包含简单键值对和业务扩展键值的资源文件进行定义生成所述多语言资源文件。In an embodiment of the present invention, the step S2 includes the step of: respectively defining the resource files containing the simple key-value pair and the business extension key-value after configuration to generate the multilingual resource file.
于本发明的一实施例中,所述业务扩展键值对包括一般函数、匿名函数和类文件函数;其中,对应所述一般函数,所述步骤S2中包括步骤:遍历所述一般函数的函数表达式;对应所述匿名函数,所述步骤S2中包括步骤:遍历所述匿名函数的函数表达式;对应所述类文件函数,所述步骤S2中包括步骤:通过反射技术加载并遍历键值对数据的类、类文件和代码文件路径。In an embodiment of the present invention, the service extension key-value pair includes a general function, an anonymous function and a class file function; wherein, corresponding to the general function, the step S2 includes the step of traversing the function of the general function expression; corresponding to the anonymous function, the step S2 includes the steps of: traversing the function expression of the anonymous function; corresponding to the class file function, the step S2 includes the step: loading and traversing the key value through reflection technology Class, class file, and code file paths to the data.
于本发明的一实施例中,所述步骤S3包括步骤:S31、获取当前语言设置;S32、获取所述多语言资源文件中当前语言资源文件;S33、获取当前语言资源对象遍历器;S34、采用所述对象遍历器遍历所述当前语言资源文件中的键值对;S35、根据键值获取值值、目标控件和业务数据;S36、根据所述值值类型解析所述多语言资源文件,完成操作界面的多语言的场景适配。In an embodiment of the present invention, the step S3 includes the steps of: S31, obtaining the current language setting; S32, obtaining the current language resource file in the multilingual resource file; S33, obtaining the current language resource object traverser; S34, Use the object traverser to traverse the key-value pairs in the current language resource file; S35, obtain value, target control and business data according to the key value; S36, parse the multilingual resource file according to the value type, Complete the multilingual scene adaptation of the operation interface.
本发明还提供了一种基于业务配置的多语言资源文件解析系统,包括:配置模块,用于对资源文件进行配置;资源生成模块,用于将配置中带有业务的键值对数据生成多语言资源文件;解析模块,用于采用多语言资源文件解析法对所述多语言资源文件进行解析,完成操作界面的多语言的场景适配。The present invention also provides a multilingual resource file parsing system based on business configuration, comprising: a configuration module for configuring resource files; a resource generation module for generating multilingual key-value pair data with business in the configuration A language resource file; a parsing module, used for parsing the multilingual resource file by using the multilingual resource file parsing method, so as to complete the multilingual scene adaptation of the operation interface.
于本发明的一实施例中,所述资源生成模块还用于分别对配置后包含简单键值对和业务扩展键值的资源文件进行定义生成所述多语言资源文件。In an embodiment of the present invention, the resource generation module is further configured to define and generate the multilingual resource file by respectively defining resource files that include simple key-value pairs and business extension key-values after configuration.
于本发明的一实施例中,所述业务扩展键值对包括一般函数、匿名函数和类文件函数;In an embodiment of the present invention, the service extension key-value pair includes a general function, an anonymous function and a class file function;
其中,对应所述一般函数,所述资源生成模块还用于遍历所述一般函数的函数表达式;Wherein, corresponding to the general function, the resource generation module is further configured to traverse the function expression of the general function;
对应所述匿名函数,所述资源生成模块还用于遍历所述匿名函数的函数表达式;Corresponding to the anonymous function, the resource generation module is further configured to traverse the function expression of the anonymous function;
对应所述类文件函数,所述资源生成模块还用于通过反射技术加载并遍历键值对数据的类、类文件和代码文件路径。Corresponding to the class file function, the resource generation module is further configured to load and traverse the class, class file and code file path of the key-value pair data through reflection technology.
于本发明的一实施例中,所述解析模块包括:语言设置获取单元,用于获取当前语言设置;语言资源文件获取单元,用于获取所述多语言资源文件中当前语言资源文件;遍历器获取单元,用于获取当前语言资源对象遍历器;所述对象遍历器,用于遍历所述当前语言资源文件中的键值对;数据获取单元,用于根据键值获取值值、目标控件和业务数据;解析单元,用于根据所述值值类型解析所述多语言资源文件,完成操作界面的多语言的场景适配。In an embodiment of the present invention, the parsing module includes: a language setting acquisition unit for acquiring the current language setting; a language resource file acquisition unit for acquiring the current language resource file in the multilingual resource file; a traverser The acquisition unit is used to acquire the current language resource object traverser; the object traverser is used to traverse the key-value pairs in the current language resource file; the data acquisition unit is used to acquire the value, target control and business data; a parsing unit, configured to parse the multilingual resource file according to the value type, so as to complete the multilingual scene adaptation of the operation interface.
本发明还提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述任一项所述方法的步骤。The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and running on the processor, where the processor implements any of the above when executing the computer program the steps of the method.
本发明还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上述任一项所述方法的步骤。The present invention also provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any one of the methods described above are implemented.
如上所述,本发明的一种基于业务配置的多语言资源文件解析方法、系统、设备及计算机可读存储介质,具有以下有益效果:As described above, a method, system, device and computer-readable storage medium for parsing multilingual resource files based on business configuration of the present invention have the following beneficial effects:
能够实现多语言资源文件个性化业务配置方式;为用户操作界面提供不同语言环境下的个性化定制和业务定制的能力。It can realize the personalized business configuration mode of multi-language resource files; provide the user interface with the ability of personalized customization and business customization in different language environments.
附图说明Description of drawings
图1显示为本发明中基于业务配置的多语言资源文件解析方法的流程方框示意图。FIG. 1 is a schematic block diagram showing the flow of a method for parsing a multilingual resource file based on a service configuration in the present invention.
图2显示为本发明中基于业务配置的多语言资源文件解析系统的方框结构示意图。FIG. 2 is a schematic block diagram of a multilingual resource file parsing system based on service configuration in the present invention.
图3显示为本发明中提供的终端设备的结构示意图。FIG. 3 is a schematic structural diagram of a terminal device provided in the present invention.
图4显示为本发明一实施例中一实施例中配置时Javascript版本的代码示意图。FIG. 4 is a schematic diagram of a code of a Javascript version during configuration in an embodiment of the present invention.
图5显示为本发明一实施例中另一实施例中配置时Javascript版本的代码示意图。FIG. 5 is a schematic diagram of code of a Javascript version during configuration in another embodiment of an embodiment of the present invention.
图6显示为本发明一实施例中一实施例中配置后Javascript版本的代码示意图。FIG. 6 is a schematic diagram of a code of a Javascript version after configuration in an embodiment of the present invention.
图7显示为本发明一实施例中另一实施例中配置后Javascript版本的代码示意图。FIG. 7 is a schematic diagram of a code of a Javascript version after configuration in another embodiment of an embodiment of the present invention.
图8显示为本发明一实施例中解析时Javascript版本的代码示意图。FIG. 8 is a schematic diagram of a code of a Javascript version during parsing according to an embodiment of the present invention.
图9显示为本发明另一实施例中解析时Javascript版本的代码示意图。FIG. 9 is a schematic diagram of code of a Javascript version during parsing according to another embodiment of the present invention.
具体实施方式Detailed ways
以下通过特定的具体实例说明本发明的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本发明的精神下进行各种修饰或改变。需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。The embodiments of the present invention are described below through specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments may be combined with each other under the condition of no conflict.
为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solutions of the present invention, the following specific embodiments are used for description.
本发明实施例中,通过获取软件开发需求,并根据软件开发需求在预设的页面框架模板上,基于模板组件确定待生成的目标页面的目标组件。目标组件包括基于模板组件修改得到的调整组件、基于模板组件创建的新组件、基于模板组件确定的待替换组件中的至少一种,并基于目标组件的组件名称以及位置信息,在页面基础框架模板中将保留的模板组件以及生成的目标组件组装形成目标页面。由于基于预设的页面基础框架模板进行软件的开发,不需要投入大量的人力从头开始开发页面,只需要替换、修改或新增组件即可完成预期的结果,开发效率大大提高,开发成本大大降低。同时,基于预设的页面基础框架模板不不需要考虑浏览器兼容的问题,降低了开发难度。另外,页面组件化、配置化,组件通过积木式搭建形成目标页面,通过修改模板组件的配置文件实现页面的修改,极度灵活。In the embodiment of the present invention, the target component of the target page to be generated is determined based on the template component on the preset page frame template according to the software development requirement by acquiring the software development requirement. The target component includes at least one of an adjustment component modified based on the template component, a new component created based on the template component, and a component to be replaced determined based on the template component, and based on the component name and location information of the target component, in the page basic framework template Assemble the reserved template components and the generated target components to form the target page. Due to the software development based on the preset page basic framework template, there is no need to invest a lot of manpower to develop pages from scratch, and only need to replace, modify or add components to complete the expected results, the development efficiency is greatly improved, and the development cost is greatly reduced. . At the same time, the preset page basic framework template does not need to consider the issue of browser compatibility, which reduces the difficulty of development. In addition, the page is componentized and configured. The components are built in building blocks to form the target page, and the page is modified by modifying the configuration file of the template component, which is extremely flexible.
在本发明实施例中,流程的执行主体为终端设备,该终端设备包括但不限于笔记本电脑、计算机、服务器、平板电脑以及智能手机等具有软件开发功能的终端设备。特别地,该终端设备执行本发明实施中的流程时能够用于为原生应用提供桌面应用的承载功能或前端界面的展示,为桌面应用提供界面组装框架。In the embodiment of the present invention, the execution subject of the process is a terminal device, and the terminal device includes but is not limited to a notebook computer, a computer, a server, a tablet computer, a smart phone, and other terminal devices with software development functions. In particular, when the terminal device executes the process in the implementation of the present invention, it can be used to provide the native application with the bearing function of the desktop application or the display of the front-end interface, and provide the interface assembly framework for the desktop application.
参见图1至图3,须知,本说明书所附图式所绘示的结构、比例、大小等,均仅用以配合说明书所揭示的内容,以供熟悉此技术的人士了解与阅读,并非用以限定本发明可实施的限定条件,故不具技术上的实质意义,任何结构的修饰、比例关系的改变或大小的调整,在不影响本发明所能产生的功效及所能达成的目的下,均应仍落在本发明所揭示的技术内容得能涵盖的范围内。同时,本说明书中所引用的如“上”、“下”、“左”、“右”、“中间”及“一”等的用语,亦仅为便于叙述的明了,而非用以限定本发明可实施的范围,其相对关系的改变或调整,在无实质变更技术内容下,当亦视为本发明可实施的范畴。Referring to FIGS. 1 to 3, it should be noted that the structures, proportions, sizes, etc. shown in the drawings in this specification are only used to cooperate with the contents disclosed in the specification, so as to be understood and read by those who are familiar with this technology, and are not used for In order to limit the conditions that the present invention can be implemented, it has no technical substantive significance. Any modification of the structure, the change of the proportional relationship or the adjustment of the size, without affecting the effect that the present invention can produce and the purpose that can be achieved, All should still fall within the scope that the technical content disclosed in the present invention can cover. At the same time, the terms such as "up", "down", "left", "right", "middle" and "one" quoted in this specification are only for the convenience of description and clarity, and are not used to limit this specification. The implementable scope of the invention, and the change or adjustment of the relative relationship thereof, shall also be regarded as the implementable scope of the present invention without substantially changing the technical content.
如图1所示,图1显示为本发明中基于业务配置的多语言资源文件解析方法的流程方框示意图。As shown in FIG. 1 , FIG. 1 is a schematic block diagram showing the flow of a method for parsing a multilingual resource file based on a service configuration in the present invention.
本发明提供了一种基于业务配置的多语言资源文件解析方法,包括步骤:The present invention provides a multilingual resource file parsing method based on business configuration, comprising the steps of:
S1、对资源文件进行配置;S1. Configure the resource file;
S2、将配置中带有业务的键值对数据生成多语言资源文件;S2. Generate a multilingual resource file from the key-value pair data with business in the configuration;
S3、采用多语言资源文件解析法对所述多语言资源文件进行解析,完成操作界面的多语言的场景适配。S3. Use a multilingual resource file parsing method to parse the multilingual resource file, so as to complete the multilingual scene adaptation of the operation interface.
通常,键值对包括键值Key和值值Value;所谓值值即键值翻译后的数据。在本发明的一实施例中,所述步骤S2包括步骤:分别对配置后包含简单键值对和业务扩展键值的资源文件进行定义生成所述多语言资源文件。通常,所述业务扩展键值对包括一般函数、匿名函数和类文件函数;其中,对应所述一般函数,所述步骤S2中包括步骤:遍历所述一般函数的函数表达式;对应所述匿名函数,所述步骤S2中包括步骤:遍历所述匿名函数的函数表达式;对应所述类文件函数,所述步骤S2中包括步骤:通过反射技术加载并遍历键值对数据的类、类文件和代码文件路径。Usually, the key-value pair includes the key-value Key and the value-value Value; the so-called value-value is the data after the key-value translation. In an embodiment of the present invention, the step S2 includes the step of: respectively defining the resource files containing the simple key-value pair and the business extension key-value after configuration to generate the multilingual resource file. Usually, the business extension key-value pair includes a general function, an anonymous function and a file-like function; wherein, corresponding to the general function, the step S2 includes the steps of: traversing the function expression of the general function; corresponding to the anonymous function function, the step S2 includes the steps of: traversing the function expression of the anonymous function; corresponding to the class file function, the step S2 includes the step: loading and traversing the class and class file of the key-value pair data through reflection technology and code file path.
进一步地,所述步骤S3包括步骤:S31、获取当前语言设置;S32、获取所述多语言资源文件中当前语言资源文件;S33、获取当前语言资源对象遍历器;S34、采用所述对象遍历器遍历所述当前语言资源文件中的键值对;S35、根据键值获取值值、目标控件和业务数据;S36、根据所述值值类型解析所述多语言资源文件,完成操作界面的多语言的场景适配。Further, the step S3 includes the steps of: S31, obtaining the current language setting; S32, obtaining the current language resource file in the multilingual resource file; S33, obtaining the current language resource object traverser; S34, using the object traverser Traverse the key-value pairs in the current language resource file; S35, obtain value, target control and business data according to the key value; S36, parse the multilingual resource file according to the value type to complete the multilingual operation interface scene adaptation.
为不失一般性,下面以Javascript(客户端开发语言)和Java语言(服务器开发语言)来举例,试着解决现有多语言解决方案的问题,其他开发语言类推。Without loss of generality, the following uses Javascript (client development language) and Java language (server development language) as examples to try to solve the problem of existing multi-language solutions, and analogy for other development languages.
在配置时,Javascript版本的代码如图4和图5;配置后Javascript版本的代码如图6和图7所示。图4显示为本发明一实施例中一实施例中配置时Javascript版本的代码示意图。图5显示为本发明一实施例中另一实施例中配置时Javascript版本的代码示意图。图6显示为本发明一实施例中一实施例中配置后Javascript版本的代码示意图。图7显示为本发明一实施例中另一实施例中配置后Javascript版本的代码示意图。During configuration, the code of the Javascript version is shown in Figure 4 and Figure 5; the code of the Javascript version after configuration is shown in Figure 6 and Figure 7. FIG. 4 is a schematic diagram of a code of a Javascript version during configuration in an embodiment of the present invention. FIG. 5 is a schematic diagram of code of a Javascript version during configuration in another embodiment of an embodiment of the present invention. FIG. 6 is a schematic diagram of a code of a Javascript version after configuration in an embodiment of the present invention. FIG. 7 is a schematic diagram of a code of a Javascript version after configuration in another embodiment of an embodiment of the present invention.
而在解析时,Javascript版本的代码如图7和图8所示。图7显示为本发明一实施例中解析时Javascript版本的代码示意图。图8显示为本发明另一实施例中解析时Javascript版本的代码示意图。While parsing, the Javascript version of the code is shown in Figure 7 and Figure 8. FIG. 7 is a schematic diagram of a code of a Javascript version during parsing according to an embodiment of the present invention. FIG. 8 is a schematic diagram of code of a Javascript version during parsing according to another embodiment of the present invention.
如图2所示,图2显示为本发明中基于业务配置的多语言资源文件解析系统的方框结构示意图。本发明还提供了一种基于业务配置的多语言资源文件解析系统,包括:配置模块,用于对资源文件进行配置;资源生成模块,用于将配置中带有业务的键值对数据生成多语言资源文件;解析模块,用于采用多语言资源文件解析法对所述多语言资源文件进行解析,完成操作界面的多语言的场景适配。As shown in FIG. 2 , FIG. 2 is a schematic block diagram of a multilingual resource file parsing system based on service configuration in the present invention. The present invention also provides a multilingual resource file parsing system based on business configuration, comprising: a configuration module for configuring resource files; a resource generation module for generating multilingual key-value pair data with business in the configuration A language resource file; a parsing module, used for parsing the multilingual resource file by using the multilingual resource file parsing method, so as to complete the multilingual scene adaptation of the operation interface.
通常,键值对包括键值Key和值值Value;所谓值值即键值翻译后的数据。在本发明的一实施例中,所述资源生成模块还用于分别对配置后包含简单键值对和业务扩展键值的资源文件进行定义生成所述多语言资源文件。通常,所述业务扩展键值对包括一般函数、匿名函数和类文件函数;其中,对应所述一般函数,所述资源生成模块还用于遍历所述一般函数的函数表达式;对应所述匿名函数,所述资源生成模块还用于遍历所述匿名函数的函数表达式;对应所述类文件函数,所述资源生成模块还用于通过反射技术加载并遍历键值对数据的类、类文件和代码文件路径。Usually, the key-value pair includes the key-value Key and the value-value Value; the so-called value-value is the data after the key-value translation. In an embodiment of the present invention, the resource generation module is further configured to define and generate the multilingual resource file by respectively defining resource files that contain simple key-value pairs and business extension key-values after configuration. Generally, the service extension key-value pair includes a general function, an anonymous function and a file-like function; wherein, corresponding to the general function, the resource generation module is further configured to traverse the function expression of the general function; corresponding to the anonymous function function, the resource generation module is also used to traverse the function expression of the anonymous function; corresponding to the class file function, the resource generation module is also used to load and traverse the class and class file of the key-value pair data through reflection technology and code file path.
进一步地,所述解析模块包括:语言设置获取单元,用于获取当前语言设置;语言资源文件获取单元,用于获取所述多语言资源文件中当前语言资源文件;遍历器获取单元,用于获取当前语言资源对象遍历器;所述对象遍历器,用于遍历所述当前语言资源文件中的键值对;数据获取单元,用于根据键值获取值值、目标控件和业务数据;解析单元,用于根据所述值值类型解析所述多语言资源文件,完成操作界面的多语言的场景适配。Further, the parsing module includes: a language setting acquisition unit for acquiring current language settings; a language resource file acquiring unit for acquiring the current language resource file in the multilingual resource file; a traverser acquiring unit for acquiring A current language resource object traverser; the object traverser is used to traverse key-value pairs in the current language resource file; a data acquisition unit is used to acquire values, target controls and business data according to the key values; a parsing unit, It is used for parsing the multilingual resource file according to the value type, so as to complete the multilingual scene adaptation of the operation interface.
为不失一般性,下面以Javascript(客户端开发语言)和Java语言(服务器开发语言)来举例,试着解决现有多语言解决方案的问题,其他开发语言类推。Without loss of generality, the following uses Javascript (client development language) and Java language (server development language) as examples to try to solve the problem of existing multi-language solutions, and analogy for other development languages.
在配置时,Javascript版本的代码如图4和图5;配置后Javascript版本的代码如图6和图7所示。图4显示为本发明一实施例中一实施例中配置时Javascript版本的代码示意图。图5显示为本发明一实施例中另一实施例中配置时Javascript版本的代码示意图。图6显示为本发明一实施例中一实施例中配置后Javascript版本的代码示意图。图7显示为本发明一实施例中另一实施例中配置后Javascript版本的代码示意图。During configuration, the code of the Javascript version is shown in Figure 4 and Figure 5; the code of the Javascript version after configuration is shown in Figure 6 and Figure 7. FIG. 4 is a schematic diagram of a code of a Javascript version during configuration in an embodiment of the present invention. FIG. 5 is a schematic diagram of code of a Javascript version during configuration in another embodiment of an embodiment of the present invention. FIG. 6 is a schematic diagram of a code of a Javascript version after configuration in an embodiment of the present invention. FIG. 7 is a schematic diagram of a code of a Javascript version after configuration in another embodiment of an embodiment of the present invention.
而在解析时,Javascript版本的代码如图8和图9所示。图8显示为本发明一实施例中解析时Javascript版本的代码示意图。图9显示为本发明另一实施例中解析时Javascript版本的代码示意图。While parsing, the Javascript version of the code is shown in Figure 8 and Figure 9. FIG. 8 is a schematic diagram of a code of a Javascript version during parsing according to an embodiment of the present invention. FIG. 9 is a schematic diagram of code of a Javascript version during parsing according to another embodiment of the present invention.
图3显示为本发明中提供的终端设备的结构示意图。如图3所示,该实施例中终端设备包括:处理器、存储器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,例如软件开发程序。所述处理器执行所述计算机程序时实现上述各个利用WIFI广播或多点广播报文实现数采设备同步触发的方法实施例中的步骤,例如图1所示的步骤S1至S3。或者,所述处理器执行所述计算机程序时实现上述各装置实施例中各模块/单元的功能,例如图2所示模块的功能。FIG. 3 is a schematic structural diagram of a terminal device provided in the present invention. As shown in FIG. 3 , in this embodiment, the terminal device includes: a processor, a memory, and a computer program, such as a software development program, stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in each of the above method embodiments for realizing synchronous triggering of data acquisition equipment by using WIFI broadcast or multicast messages, such as steps S1 to S3 shown in FIG. 1 . Alternatively, when the processor executes the computer program, the functions of the modules/units in the foregoing device embodiments, for example, the functions of the modules shown in FIG. 2 , are implemented.
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器中,并由所述处理器执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在终端设备中的执行过程。例如,所述计算机程序可以被分割成获取模块、执行模块、生成模块(虚拟装置中的模块),各模块具体功能如下:Exemplarily, the computer program may be divided into one or more modules/units, and the one or more modules/units are stored in the memory and executed by the processor to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device. For example, the computer program can be divided into an acquisition module, an execution module, and a generation module (modules in a virtual device), and the specific functions of each module are as follows:
所述终端设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器、存储器。本领域技术人员可以理解,本实施例仅仅是终端设备的示例,并不构成对终端设备的限定,可以包括更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。The terminal device may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that this embodiment is only an example of a terminal device, and does not constitute a limitation on the terminal device, and may include more or less components, or combine some components, or different components, such as the described Terminal devices may also include input and output devices, network access devices, buses, and the like.
所称处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf processors Programmable Gate Array (Field-Programmable Gate Array, 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 or the like.
所述存储器可以是所述终端设备的内部存储单元,例如终端设备的硬盘或内存。所述存储器也可以是所述终端设备的外部存储设备,例如所述终端设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器还可以既包括所述终端设备的内部存储单元也包括外部存储设备。所述存储器用于存储所述计算机程序以及所述终端设备所需的其他程序和数据。所述存储器还可以用于暂时地存储已经输出或者将要输出的数据。The memory may be an internal storage unit of the terminal device, such as a hard disk or a memory of the terminal device. The memory may also be an external storage device of the terminal device, for example, a plug-in hard disk equipped on the terminal device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, and a flash memory. Card (Flash Card) and so on. Further, the memory may also include both an internal storage unit of the terminal device and an external storage device. The memory is used for storing the computer program and other programs and data required by the terminal device. The memory may also be used to temporarily store data that has been output or is to be output.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. Module completion, that is, dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated in one processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit, and the above-mentioned integrated units may adopt hardware. It can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the present application. For the specific working processes of the units and modules in the above-mentioned system, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the description of each embodiment has its own emphasis. For parts that are not described or described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.
在本发明所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided by the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units. Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The integrated modules/units, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed by the processor, the steps of the foregoing method embodiments can be implemented. . Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable media may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable media Electric carrier signals and telecommunication signals are not included.
以上所述实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围,均应包含在本发明的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it is still possible to implement the foregoing implementations. The technical solutions described in the examples are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910782647.7A CN110647371A (en) | 2019-08-22 | 2019-08-22 | A method and system for parsing multilingual resource files based on business configuration |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910782647.7A CN110647371A (en) | 2019-08-22 | 2019-08-22 | A method and system for parsing multilingual resource files based on business configuration |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN110647371A true CN110647371A (en) | 2020-01-03 |
Family
ID=69009650
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910782647.7A Pending CN110647371A (en) | 2019-08-22 | 2019-08-22 | A method and system for parsing multilingual resource files based on business configuration |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN110647371A (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111522531A (en) * | 2020-04-16 | 2020-08-11 | 北京奇艺世纪科技有限公司 | File checking method and device, electronic equipment and computer readable storage medium |
| CN113986211A (en) * | 2021-10-29 | 2022-01-28 | 苏州万店掌网络科技有限公司 | Code editor-based method and system for rapid code internationalization |
| CN118394429A (en) * | 2024-06-28 | 2024-07-26 | 浪潮电子信息产业股份有限公司 | Project configuration management method, equipment, product and medium |
| TWI919439B (en) | 2024-08-26 | 2026-03-21 | 韓商韓領有限公司 | Electronic apparatus for processing message and method therefor |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080010594A1 (en) * | 2004-12-02 | 2008-01-10 | Jobst Hoerentrup | Method for Generating Multi-Language Menus |
| CN104714968A (en) * | 2013-12-16 | 2015-06-17 | 中国银联股份有限公司 | Method and device for internationalizing web page |
| CN105094941A (en) * | 2015-09-24 | 2015-11-25 | 深圳市捷顺科技实业股份有限公司 | Method and device for achieving multiple languages |
| CN107193545A (en) * | 2017-04-07 | 2017-09-22 | 广东省科技基础条件平台中心 | Multilingual co-development device, the method and system of a kind of component-oriented |
| CN109582414A (en) * | 2018-11-06 | 2019-04-05 | 福建天泉教育科技有限公司 | Using international method, storage medium |
| CN109634684A (en) * | 2018-12-07 | 2019-04-16 | 万兴科技股份有限公司 | Method, apparatus, computer equipment and the storage medium of application program load language |
-
2019
- 2019-08-22 CN CN201910782647.7A patent/CN110647371A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080010594A1 (en) * | 2004-12-02 | 2008-01-10 | Jobst Hoerentrup | Method for Generating Multi-Language Menus |
| CN104714968A (en) * | 2013-12-16 | 2015-06-17 | 中国银联股份有限公司 | Method and device for internationalizing web page |
| CN105094941A (en) * | 2015-09-24 | 2015-11-25 | 深圳市捷顺科技实业股份有限公司 | Method and device for achieving multiple languages |
| CN107193545A (en) * | 2017-04-07 | 2017-09-22 | 广东省科技基础条件平台中心 | Multilingual co-development device, the method and system of a kind of component-oriented |
| CN109582414A (en) * | 2018-11-06 | 2019-04-05 | 福建天泉教育科技有限公司 | Using international method, storage medium |
| CN109634684A (en) * | 2018-12-07 | 2019-04-16 | 万兴科技股份有限公司 | Method, apparatus, computer equipment and the storage medium of application program load language |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111522531A (en) * | 2020-04-16 | 2020-08-11 | 北京奇艺世纪科技有限公司 | File checking method and device, electronic equipment and computer readable storage medium |
| CN111522531B (en) * | 2020-04-16 | 2023-09-05 | 北京奇艺世纪科技有限公司 | File checking method, device, electronic equipment and computer readable storage medium |
| CN113986211A (en) * | 2021-10-29 | 2022-01-28 | 苏州万店掌网络科技有限公司 | Code editor-based method and system for rapid code internationalization |
| CN118394429A (en) * | 2024-06-28 | 2024-07-26 | 浪潮电子信息产业股份有限公司 | Project configuration management method, equipment, product and medium |
| CN118394429B (en) * | 2024-06-28 | 2024-09-20 | 浪潮电子信息产业股份有限公司 | Project configuration management method, equipment, product and medium |
| TWI919439B (en) | 2024-08-26 | 2026-03-21 | 韓商韓領有限公司 | Electronic apparatus for processing message and method therefor |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111026490B (en) | Page rendering method and device, electronic equipment and storage medium | |
| CN107656914B (en) | Configurable table generation method and device, terminal equipment and storage medium | |
| CN110020278B (en) | Display and provision method of page data, client and server | |
| CN115712413B (en) | Low code development method, device, equipment and storage medium | |
| CN113656124B (en) | Login page generation method and device | |
| WO2018077085A1 (en) | Application processing method, device and storage medium | |
| US20170185609A1 (en) | Universal adaptor for rapid development of web-based data visualizations | |
| CN109254818B (en) | Pixel-level positioning method and device for different resolutions of browser | |
| WO2017088509A1 (en) | Page customization method and device | |
| CN110309451A (en) | Method and device for generating web preloading page | |
| WO2014078341A2 (en) | Automatically rendering web or hybrid applications natively | |
| CN106062693B (en) | Desktop sharing method and mobile terminal | |
| CN103955367A (en) | Method and device for generating pages | |
| CN113761871B (en) | Rich text rendering method, device, electronic device and storage medium | |
| CN108509207A (en) | The cross-system of WEB application program is installed | |
| CN110990345A (en) | Method and device for online preview of Excel file | |
| CN113031946A (en) | Method and device for rendering page component | |
| WO2022099913A1 (en) | Interface configuration method and apparatus, and device and medium | |
| CN109725887B (en) | Data interaction method and device based on message research and development framework and terminal equipment | |
| CN110647371A (en) | A method and system for parsing multilingual resource files based on business configuration | |
| CN113220339A (en) | Page generation method and device | |
| CN114968210A (en) | Plug-in management method, system, device and computer-readable storage medium | |
| CN110647327A (en) | Method and device for dynamic control of user interface based on card | |
| CN117908671A (en) | File browsing method, device, terminal and storage medium | |
| CN119493564A (en) | A method, device, equipment and medium for generating a page |
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 | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200103 |
|
| RJ01 | Rejection of invention patent application after publication |