Disclosure of Invention
In view of the above, embodiments of the present application provide a text display method, a text display device, and a readable storage medium, so as to solve the problem in the prior art that correction needs to be performed on wrong content displayed in a user interface.
In order to solve the above problem, in a first aspect, an embodiment of the present application provides a text display method, including: responding to a page content display instruction, and acquiring a page content file and a correction file corresponding to the current language version information of the user; correcting the page content file according to the correction file; and displaying the page content according to the corrected page content file.
Optionally, the text display method further comprises: acquiring historical language version information of a user; and determining the historical language version information as the current language version information of the user.
Optionally, the text display method further includes: acquiring the region information of a client identification module, the current language version information of a browser and the position information in a uniform resource locator; and determining the current language version information of the user according to the region information of the client identification module, the current language version information of the browser and the position information in the uniform resource locator.
Optionally, the obtaining of the page content file and the modification file corresponding to the current language version information of the user includes: acquiring a page content file corresponding to the current language version information of the user from the server according to the first address information; and acquiring a correction file corresponding to the current language version information of the user from the server according to the second address information.
Optionally, the page content file comprises a first text recorded in a key-value pair form, and the correction file comprises a second text recorded in a key-value pair form; modifying the page content file according to the modification file, comprising: and merging or replacing key value pairs in the first text and the second text to correct the first text.
Optionally, merging or replacing key-value pairs in the first text and the second text to modify the first text, including: determining a keyword and a first key value in a second text; and under the condition that the keywords are determined to be included in the first text, replacing second key values corresponding to the keywords in the first text by the first key values.
Optionally, the text display method further comprises: and under the condition that the first text does not comprise the keywords, supplementing the keywords and the first key value in the second text into the first text.
In a second aspect, an embodiment of the present application further provides a text display apparatus, including: the acquisition unit is used for responding to the page content display instruction and acquiring a page content file and a correction file corresponding to the current language version information of the user; the correction unit is used for correcting the page content file according to the correction file; and the display unit is used for displaying the page content according to the corrected page content file.
In a third aspect, an embodiment of the present application further provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executable by the at least one processor to cause the at least one processor to perform a method of displaying text as in the first aspect or any of the embodiments of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where computer instructions are stored, and the computer instructions are configured to cause a computer to execute the text display method according to the first aspect or any implementation manner of the first aspect.
According to the text display method, the text display device and the readable storage medium, the page content file and the correction file corresponding to the current language version information of the user are obtained by responding to the page content display instruction; correcting the page content file according to the correction file; the page content is displayed according to the corrected page content file, so that when the page content has errors, operation and maintenance personnel only need to write the correct page content into the correction file and upload the correction file to the server, and when a user opens a browser or an application program to display the page content, the browser or the application program can automatically acquire the correction file, correct the page content file by using the correction file to correct the errors in the page content file, and then display the page content by using the corrected page content file.
The above description is only an overview of the technical solutions of the present application, and the present application may be implemented in accordance with the content of the description so as to make the technical means of the present application more clearly understood, and the detailed description of the present application will be given below in order to make the above and other objects, features, and advantages of the present application more clearly understood.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
An embodiment of the present application provides a text display method, as shown in fig. 1, including:
and S101, responding to a page content display instruction, and acquiring a page content file and a correction file corresponding to the current language version information of the user.
In the embodiment of the present application, the language version includes chinese, english, german, and the like. The format of the page content file and the correction file is a lightweight data interchange format, such as json format. Therefore, the front-end client can directly obtain the second text in the json-format correction file, and then the second text is merged into the json-format page content file in an object form, so that the front-end client is prevented from analyzing the file.
During the application development phase, different language versions of the page content file may be created. For example, a plurality of documents, such as static _ cn.json, static _ en.json, and static _ de.json, are created corresponding to a plurality of language versions, cn represents a page content document in chinese, en represents a page content document in english, and de represents a page content document in german. The page content may be recorded in the page content file in the form of key-value pairs. For example, when recording the page content, the keyword corresponding to the page content may be recorded first, and then the page content may be stored as the key value. The page content files of the various language versions can then be uploaded to a first address specified by the server, forming a static file. After the application is online, the content in the page content file remains unchanged.
After the application program is online, an operation and maintenance person can open a user interface of the application program through a browser or the application program, check page contents of various language versions, if a translation content is found to be lacking or a certain content is wrongly filled, mark that the page contents of the language version need to be modified, record correct contents corresponding to the contents to be modified in a key value pair mode, for example, find keywords corresponding to the contents with problems, create files such as web _ cn.json, web _ en.json, web _ de.json and the like according to the language version, fill the keywords and the correct contents into the files to form the key value pair, use the files as a modified file, upload the modified file to a second address specified by a server to form a dynamic file, and the dynamic file can be modified after the application program is online.
When a user opens a user interface of an application program through a browser or the application program, the browser or the application program requests a page content file and a correction file in a server, for example, a static _ xx.
And S102, correcting the page content file according to the correction file.
In the embodiment of the application, if only the page content file is acquired, it is indicated that no error exists in the page content file or no error is found temporarily, and the page content is displayed according to the page content file. If the page content file and the correction file are both acquired, which indicates that the page content file has errors to be corrected, and the operation and maintenance personnel have filled the correct content into the correction file, the correct content corresponding to the contents of the errors in the page content file is recorded in the correction file, so that the contents of the errors in the page content file are replaced by the correct contents in the correction file, and the page content file can be corrected. The priority of the correction file can be set to be higher than that of the page content file, so that the correction file and the page content file are combined and covered, and the requirement of modifying wrong content can be met.
And S103, displaying the page content according to the corrected page content file.
In the embodiment of the application, the content of the error is corrected in the corrected page content file, so that the key value in the corrected page content file can be taken to display the page content.
According to the text display method provided by the embodiment of the application, the page content file and the correction file corresponding to the current language version information of the user are obtained by responding to the page content display instruction; correcting the page content file according to the correction file; the page content is displayed according to the corrected page content file, so that when the page content has errors, operation and maintenance personnel only need to write the correct page content into the correction file and upload the correction file to the server, and when a user opens a browser or an application program to display the page content, the browser or the application program can automatically acquire the correction file, correct the page content file by using the correction file to correct the errors in the page content file, and then display the page content by using the corrected page content file.
In an optional embodiment, the text display method further comprises: acquiring the region information of a client identification module, the current language version information of a browser and the position information in a uniform resource locator; and determining the current language version information of the user according to the region information of the client identification module, the current language version information of the browser and the position information in the uniform resource locator.
Specifically, if the user logs in the application program for the first time, when determining the current language version information of the user, the comprehensive judgment can be performed through the region information to which the client identification module belongs, the current language version information of the browser and the position information in the uniform resource locator. The information of the area to which the client identification module belongs comprises an operator of the client identification module (SIM card), and the information of the current language version of the browser comprises the current language used by the browser.
In this embodiment, the current language version information of the user is determined according to the region information to which the client identification module belongs, the current language version information of the browser and the position information in the uniform resource locator, and the current language version information of the user can be pre-judged, so that the page content corresponding to the appropriate language version is displayed for the user, and the user experience is improved.
In another optional embodiment, the text display method further comprises: acquiring historical language version information of a user; and determining the historical language version information as the current language version information of the user.
Specifically, if the user logs in the application program for the first time, when determining the current language version information of the user, the language version selected by the user by logging in the application program for the last time may be obtained, and the language version used by the user for the last time is continuously used, so as to determine that the language version information used by the user for the last time is the current language version information of the user.
In the embodiment, the historical language version information is determined to be the current language version information of the user, so that the general habit of the user is met, the page content can be rapidly displayed to the user, and the user experience is improved.
In an optional embodiment, in step S101, acquiring the page content file and the modification file corresponding to the current language version information of the user includes: acquiring a page content file corresponding to the current language version information of the user from the server according to the first address information; and acquiring a correction file corresponding to the current language version information of the user from the server according to the second address information.
Specifically, in the application program development stage, it may be agreed to store the page content file in the first address of the server and store the modification file in the second address of the server. The first address of the server forms first address information, and the second address of the server forms second address information, so that when a user interface of the application program is opened every time, files are acquiescent from the two addresses of the server, page content files corresponding to the current language version information of the user can be acquired according to the first address information, and correction files corresponding to the current language version information of the user can be acquired according to the second address information.
If the corrected file cannot be obtained from the server according to the second address information, it is indicated that the content in the page content file corresponding to the current language version information of the user has no error or an error is not found temporarily. If the corrected file can be obtained from the server according to the second address information, which indicates that the content in the page content file corresponding to the current language version information of the user has errors, correct content corresponding to the error content is stored in the corrected file and is used for replacing the error content in the page content file.
In the embodiment of the application, the page content file is stored in the first address of the server, the correction file is stored in the second address information of the server, and the page content file and the correction file are obtained from the first address and the second address information every time the user interface of the application program is opened, so that the server does not need to analyze and combine the page content file and the correction file, and when an operation and maintenance worker finds that the page content file has an error, the front-end client can automatically realize the combination and coverage of the error page content only by putting correct content into the correction file and uploading the correction file to the second address of the server, so that the requirement of modifying the error content is met, and the operation is simple.
In an alternative implementation, the page content file includes a first text recorded in the form of key-value pairs, and the correction file includes a second text recorded in the form of key-value pairs; step S102, correcting the page content file according to the correction file, comprising: and merging or replacing key value pairs in the first text and the second text to correct the first text.
Specifically, the key value pairs include key words and key values, the key values are contents to be displayed in the user interface, the key words correspond to the key values one to one, and the key words can be used for searching the key values when the page content files are corrected by using the correction files.
If the missing page content exists, the second text in the correction file is a supplement to the first text, and key value pairs in the first text and the second text need to be merged. If the wrong page content exists, the second text in the corrected file is the replacement of the wrong key value pair in the first text, and the key value in the second text needs to replace the wrong key value pair in the first text. If the missing page content and the wrong page content exist, the second text in the correction file is supplemented and replaced by the first text, key value pairs in the first text and the second text need to be combined, and the wrong key value in the first text is replaced by the correct key value in the second text.
In the embodiment of the application, the page content is recorded in the form of the key value pair, and the correct content corresponding to the wrong content in the page content is also recorded in the form of the key value pair, so that the page content with the error can be quickly corrected, and the missing page content can be supplemented.
In an optional embodiment, merging or replacing key-value pairs in the first text and the second text to modify the first text includes: determining a keyword and a first key value in a second text; under the condition that the first text comprises the keywords, replacing second key values corresponding to the keywords in the first text by the first key values; and under the condition that the first text does not comprise the keywords, supplementing the keywords and the first key value in the second text into the first text.
Specifically, because the first text and the second text are both in the form of key value pairs, and the keywords in the key value pairs are used for identifying the key values, the keywords in the second text and the corresponding first key values may be determined first, then the keywords may be searched for in the first text, and if the keywords exist in the first text, the second key values corresponding to the keywords in the first text are replaced by the first key values, so as to achieve the purpose of correcting the wrong content in the first text. If the keyword does not exist in the first text, both the keyword and the first key value can be added into the first text, so that the content lacking in the first text is added.
For example, an error of { HOME _ INDEX: 'HOME' } exists in the page content file static _ en.json, the correction file web _ en.json is filled with { HOME _ INDEX: 'HOME' }, and for the keyword of HOME _ INDEX, 'HOME' in the correction file can cover 'HOME' in the page content file, so that { HOME _ INDEX: 'HOME' } exists in the corrected page content file static _ en.json and no error exists.
In the embodiment of the application, the keyword and the first key value in the second text are determined, and then the keyword is searched in the first text, so that the error content in the first text can be corrected quickly, or the missing content in the first text can be supplemented, and the correct and complete page content can be displayed on a user interface.
An embodiment of the present application further provides a text display device, as shown in fig. 2, including:
an obtaining unit 21, configured to obtain, in response to a page content display instruction, a page content file and a modification file corresponding to the user's current language version information; the detailed description of the specific implementation manner is given in step S101 of the above method embodiment, and is not repeated herein.
A correction unit 22 for correcting the page content file according to the correction file; the detailed description of the specific implementation manner is given in step S102 of the above method embodiment, and is not repeated herein.
And a display unit 23, configured to display the page content according to the corrected page content file. For details of the specific implementation, reference is made to the description of step S103 in the above method embodiment, and details are not described herein again.
The text display device provided by the embodiment of the application acquires the page content file and the correction file corresponding to the current language version information of the user by responding to the page content display instruction; correcting the page content file according to the correction file; the page content is displayed according to the corrected page content file, so that when the page content has errors, operation and maintenance personnel only need to write the correct page content into the correction file and upload the correction file to the server, and when a user opens a browser or an application program to display the page content, the browser or the application program can automatically acquire the correction file, correct the page content file by using the correction file to correct the errors in the page content file, and then display the page content by using the corrected page content file.
Based on the same inventive concept as the text display method in the foregoing embodiment, an embodiment of the present application further provides an electronic device, as shown in fig. 3, including: a processor 31 and a memory 32, wherein the processor 31 and the memory 32 may be connected by a bus or other means, and the connection by the bus is illustrated in fig. 3 as an example.
The processor 31 may be a Central Processing Unit (CPU). The Processor 31 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or any combination thereof.
The memory 32, which is a non-transitory computer readable storage medium, may be used for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the text display method in the embodiments of the present application. The processor 31 executes various functional applications and data processing of the processor by running non-transitory software programs, instructions and modules stored in the memory 32, that is, implements the text display method in the above-described method embodiment.
The memory 32 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by the processor 31, and the like. Further, the memory 32 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 32 may optionally include memory located remotely from the processor 31, and these remote memories may be connected to the processor 31 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more of the modules described above are stored in the memory 32 and, when executed by the processor 31, perform the text display method in the embodiment shown in fig. 1.
The details of the electronic device may be understood with reference to the corresponding related description and effects in the embodiment shown in fig. 1, and are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like; the storage medium may also comprise a combination of memories of the kind described above.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable information processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable information processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable information processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable information processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.