CN107256234B - A kind of web page text method of adjustment and its equipment - Google Patents
A kind of web page text method of adjustment and its equipment Download PDFInfo
- Publication number
- CN107256234B CN107256234B CN201710352610.1A CN201710352610A CN107256234B CN 107256234 B CN107256234 B CN 107256234B CN 201710352610 A CN201710352610 A CN 201710352610A CN 107256234 B CN107256234 B CN 107256234B
- Authority
- CN
- China
- Prior art keywords
- text
- language
- content
- preset
- characters
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/40—Processing or translation of natural language
- G06F40/58—Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Data Mining & Analysis (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the present invention discloses a kind of web page text method of adjustment and its equipment, and wherein method includes the following steps: to obtain the language switching instruction for the first content of text in target webpage, and the language switching instruction carries object language;The language form of first content of text is switched into the object language by original language according to the language switching instruction, to generate the second content of text;When the number of characters of second content of text is greater than preset characters number threshold value, the display format of second content of text is adjusted using preset text adjustment rule.Using the present invention, the mode of web page text Format adjusting can be enriched, improves the accuracy of the content of text display format of different language type.
Description
Technical field
The present invention relates to Internet technical field more particularly to a kind of web page text methods of adjustment and its equipment.
Background technique
The content of website will be shown by the form of webpage and can be just seen by the user, and the content of website is to be shown to
What different users used, it can be the people of any country usually using the user of the website, this requires in the text of webpage
Appearance can be realized multilingual and show, for example, with the content of text in the webpage of Chinese display, when user needs to show using English
When showing, the display for carrying out content of text in webpage for display language with English may be implemented.
In the prior art, when identical content of text is shown using different language, due to the text between different language
This length disunity, after language switching, when content of text may be shown as longer second language by shorter first language,
It will lead to display dislocation or show the appearance of the problems such as imperfect, so that the content of text for reducing different language type is shown
The accuracy of format.
Summary of the invention
The embodiment of the present invention provides a kind of web page text method of adjustment and its equipment, by the webpage after switching to language
The display format of content of text be adjusted, content of text is accurately completely shown, web page text can be enriched
The mode of Format adjusting improves the accuracy of the content of text display format of different language type.
First aspect of the embodiment of the present invention provides a kind of web page text method of adjustment, it may include:
The language switching instruction for the first content of text in target webpage is obtained, the language switching instruction carries mesh
Poster speech;
The language form of first content of text is switched into the mesh by original language according to the language switching instruction
Poster speech, to generate the second content of text;
When the number of characters of second content of text is greater than preset characters number threshold value, rule is adjusted using preset text
The display format of second content of text is adjusted.
Second aspect of the embodiment of the present invention provides a kind of web page text adjustment equipment, it may include:
Instruction acquisition module, for obtaining the language switching instruction for being directed to the first content of text in target webpage, institute's predicate
Speech switching command carries object language;
Language switching module, for according to the language switching instruction by the language form of first content of text by source
Language switches to the object language, to generate the second content of text;
Format adjusting module, for using when the number of characters of second content of text is greater than preset characters number threshold value
Preset text adjustment rule is adjusted the display format of second content of text.
The third aspect of the embodiment of the present invention provides a kind of computer storage medium, and the computer storage medium is stored with
A plurality of instruction, described instruction are suitable for being loaded by processor and executing method as described in relation to the first aspect.
Fourth aspect of the embodiment of the present invention provides a kind of web page text adjustment equipment, comprising: processor and memory;Its
In, the memory is stored with computer program, and the processor is realized when executing the computer program such as first aspect institute
State method.
In embodiments of the present invention, after by obtaining the language switching instruction for the first content of text in target webpage,
The object language carried in analytic language switching command, and according to language switching instruction by the language form of the first content of text by
Original language switches to object language, so that the second content of text is generated, when the number of characters of the second content of text is greater than preset characters
When number threshold value, then the display format of the second content of text is adjusted using preset text adjustment rule.By to language
The display format of the content of text in webpage after switching is adjusted, and content of text is accurately completely shown, can
In a manner of abundant web page text Format adjusting, the accuracy of the content of text display format of different language type is improved.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of web page text method of adjustment provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of another web page text method of adjustment provided in an embodiment of the present invention;
Fig. 3 is a kind of schematic layout pattern of target webpage provided in an embodiment of the present invention;
Fig. 4 is the interface schematic diagram that a kind of target pages provided in an embodiment of the present invention show content;
Fig. 5 is a kind of interface schematic diagram of content of text adjustment provided in an embodiment of the present invention;
Fig. 6 is the interface schematic diagram of another content of text adjustment provided in an embodiment of the present invention;
Fig. 7 is a kind of interface schematic diagram of content of text difference display mode provided in an embodiment of the present invention
Fig. 8 is a kind of structural schematic diagram of web page text adjustment equipment provided in an embodiment of the present invention;
Fig. 9 is the structural schematic diagram of another web page text adjustment equipment provided in an embodiment of the present invention;
Figure 10 is the structural schematic diagram of another web page text adjustment equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Web page text method of adjustment provided in an embodiment of the present invention can be applied to the language switching of multilingual layout site
Scene, after obtaining the language switching instruction for the first content of text in target webpage, in analytic language switching command
The object language of carrying, and the language form of the first content of text is switched to by original language by target language according to language switching instruction
Speech, so that the second content of text is generated, when the number of characters of the second content of text is greater than preset characters number threshold value, then using default
Text adjustment rule the display format of the second content of text is adjusted.Pass through the text in the webpage after switching to language
The display format of content is adjusted, and content of text is accurately completely shown, can enrich web page text format tune
Whole mode improves the accuracy of the content of text display format of different language type.
The present embodiments relate to web page text adjustment equipment can be have language switching, text formatting adjustment etc. function
Background service equipment including energy, or tablet computer, personal computer (PC), smart phone, palm PC and shifting
Terminal devices such as dynamic internet device (MID).
Below in conjunction with attached drawing 1- attached drawing 7, it is situated between in detail to web page text method of adjustment provided in an embodiment of the present invention
It continues.
Referring to Figure 1, for the embodiment of the invention provides a kind of flow diagrams of web page text method of adjustment.Such as Fig. 1
It is shown, the embodiment of the present invention the method may include following steps S101- step S103.
S101, obtains the language switching instruction for the first content of text in target webpage, and the language switching instruction is taken
With object language;
Specifically, web page text adjustment equipment obtains the language switching instruction for the first content of text in target webpage,
It is understood that the target webpage may include at least one region, in each region at least one region
It can show different contents, such as text, picture, video.Wherein, the content of text before the handover in the target webpage is
First content of text, first content of text may include plain text, text on text and video on picture etc..
When user is when the display interface of target webpage carries out language handover operation, the language switching for such as clicking interface is pressed
Button, the corresponding language switching of the language handover operation that the available user of web page text adjustment equipment submits refer to
It enables, and further obtains the language form that the language switching instruction carries, is i.e. the target language of acquisition language switching instruction carrying
Speech, meanwhile, the content identification of the first content of text of language switching instruction carrying is obtained, the content identification can be described
The storage address of first content of text, such as http://abc.com, or the text information of the content of text, such as " power
Sharp claim ".Wherein, first content of text is shown using original language before switching, after switching, in first text
Appearance needs to be shown using object language, the source language and the target language be it is preset it is multilingual in two of them language
Speech.It should be noted that it is directed to the object language, it specifically can be by developer or user's self-defining, if exploitation
Personnel's definition, then can be for when user carries out language handover operation, every switching be primary, then default is switched to down from current language
One language, until user stops language handover operation after being switched to object language;It is defined if user, then can be user pre-
If multilingual middle select one such language as object language.
The language form of first content of text is switched to institute by original language according to the language switching instruction by S102
Object language is stated, to generate the second content of text;
Specifically, the web page text adjustment equipment can determine in the text after switching according to the language switching instruction
Hold corresponding object language, further, the web page text adjusts equipment and sends the carrying object language to server
It is requested with the String searching of the content identification of first content of text, so that the server is based on institute's object language and obtains institute
Corresponding second content of text of content identification is stated, and receives second content of text that the server returns.It needs to illustrate
If first content of text is plain text, the web page text adjustment equipment searches institute in preset database
The first content of text for stating object language mark, shows the result found as the second content of text, if described the
One content of text is the text (non-plain text) on text or video on picture, then the mesh is searched in preset database
The address information of the first content of text of language identification is marked, and picture or video source are obtained according to the address information, will be obtained
The picture or video source taken is shown as the second content of text.The multi-lingual of plain text is stored in the preset database
Say the multilingual storage address of text information and picture or video.It preferably, can be before language switching, by described the
One content of text is sent to translating server by preset interface and is translated, and the target can be used in the translating server
Language is translated, and the content of text after translation is sent to the web page text adjustment equipment and is shown, so as to user
Whether can detecte has the problems such as content of text display mistake or display format misplace.
Wherein, the corresponding language form of first content of text is original language, the corresponding language of second content of text
Speech type is object language.It should be noted that the source language and the target language be it is preset it is multilingual in two of them
Language.Search whether that there are user login informations in user's login record of the target webpage;If being logged in the user
There are the user login informations in record, then obtain historical log language, using the historical log language as the source language
Speech;If the user login information is not present in user's login record, search whether to exist in browsing record slow
Deposit information;If obtaining historical viewings language there are the cache information (cookie) in browsing record, being gone through described
History browses language as the original language;If the cache information is not present in browsing record, access terminal is obtained
IP address;Area belonging to the IP address (such as: Las Vegas, US) is determined, by the region language (English in the area
Language) it is used as the original language.
S103, when the number of characters of second content of text is greater than preset characters number threshold value, using preset text tune
Whole rule is adjusted the display format of second content of text;
Specifically, the preset text adjustment rule can for by second content of text from a line become multirow into
Row display, or second content of text is shown centered on or is occupied top display, can also be the described in display portion
After two texts, addition predetermined symbol (such as ellipsis) is shown, is not especially limited herein.
The web page text adjustment equipment is after generating second content of text, available second content of text
Number of characters, and the number of characters and preset characters number threshold value (number of characters that such as every row is shown) are compared, if the word
It accords with number and is less than or equal to preset characters number, then shown using display mode identical with the first content of text, if institute's word
It accords with number and is greater than preset characters number, then the display format of the second content of text is adjusted using preset text adjustment rule,
Such as: every row shows 10 characters, and the text character number of the second content of text after switching is 15, then the residence top that can enter a new line is aobvious
Show.
Preferably, when the number of characters of second content of text is greater than the first preset characters number threshold value and presets less than second
Number of characters threshold value is then adjusted the display format of second content of text using the first preset text adjustment rule,
The second preset characters number threshold value is greater than the first preset characters number threshold value;When the number of characters of second content of text is big
In the second preset characters number threshold value, then the display using the second preset text adjustment rule to second content of text
Format is adjusted, wherein the first preset characters number threshold value is less than the second preset characters number threshold value.
In embodiments of the present invention, after by obtaining the language switching instruction for the first content of text in target webpage,
The object language carried in analytic language switching command, and according to language switching instruction by the language form of the first content of text by
Original language switches to object language, so that the second content of text is generated, when the number of characters of the second content of text is greater than preset characters
When number threshold value, then the display format of the second content of text is adjusted using preset text adjustment rule.By to language
The display format of the content of text in webpage after switching is adjusted, and content of text is accurately completely shown, can
In a manner of abundant web page text Format adjusting, the accuracy of the content of text display format of different language type is improved.
Fig. 2 is referred to, for the embodiment of the invention provides the flow diagrams of another web page text method of adjustment.Such as figure
Shown in 2, the embodiment of the present invention the method may include following steps S201- step S207.
S201 adds preset self-adaptive layout template in the page of targeted website to generate target webpage;
Specifically, the self-adaptive layout module is cascading style sheets (CSS:Cascading Style Sheets) layout
Layout modules in technology.So-called layout exactly carries out size setting to the page and positions.That is, it is all with size and
Relevant attribute is positioned, may serve to be laid out, these attributes can be determined by self-adaptive layout module.Wherein, described
Self-adaptive layout module may include: inline-block layout, elastic box, absolute fix+margin, negative margin+
Padding, percentage layout and response type picture etc..The self-adaptive layout module can be combined according to demand,
To lay out layout pattern abundant.When carrying out self-adaptive layout, developer considers that the content of text carries out language
The case where multiline text is occurred that after switching, multline text can be used the modes such as placed in the middle or residence top and shown.
It should be noted that the CSS be it is a kind of be used to show HTML (application of standard generalized markup language) or
The computer language of the files patterns such as XML (a subset of standard generalized markup language), can be used Unicode (Unicode) into
Row coding.CSS not only can statically modified web page, various scripting languages can also be cooperated dynamically to carry out to webpage each element
It formats.CSS can accurately control the typesetting progress Pixel-level of element position in webpage, support almost all of font size
Pattern possesses the ability to web object and model pattern editor.
According to user to the Pages Design demand of targeted website, presets self-adaptive layout module and store.By
The self-adaptive layout module, and the loaded and displayed content in the page are added in the page of targeted website, to generate mesh
Webpage is marked, realizes layout and display to the page.It is understood that the target webpage may include at least one area
Domain can show different contents, such as text, picture, video in each region at least one region.
For example, being illustrated in figure 3 a kind of target webpage schematic diagram, which includes tetra- regions A, B, C, D, in a-quadrant
In have in picture (display text on picture) and plain text, B area and there is video, C and D to have plain text in region.
Optionally, by it is preset it is multilingual in the corresponding content of text of each language show respectively;In display format
When mistake, preset self-adaptive layout template is debugged;The self-adaptive layout template after debugging is added to target
In the page of website, to generate target webpage.
Specifically, being preset with multilingual in the targeted website, such as Chinese, English, French.For the same text
This content can be used the multilingual and be shown respectively.The realization for the content of text that every kind of language is shown can be
The translation request for carrying the content identification of object language and first content of text is sent to translation by preset interface
Server, translating server translate first content of text using the object language after receiving request.It is described to turn over
Translate server and the result after translation be sent to web page text adjustment equipment, web page text adjustment equipment to translation result into
Whether row display has the problems such as content of text display mistake or display format misplace so that user can detecte, once discovery is asked
It inscribes and can the self-adaptive layout module be debugged and be modified in time, and modified self-adaptive layout module is added
Into the page of targeted website, to generate the correct target webpage of display format.
S202, obtains the language switching instruction for the first content of text in the target webpage, and the language switching refers to
Order carries object language;
Specifically, web page text adjustment equipment obtains the language switching instruction for the first content of text in target webpage,
It is understood that the target webpage may include at least one region, in each region at least one region
It can show different contents, such as text, picture, video.Wherein, the content of text before the handover in the target webpage is
First content of text, first content of text may include plain text, text on text and video on picture etc..
For example, current (before switching) display content is as shown in figure 4, wherein if the target webpage only includes a region
The first content of text include text on plain text and picture.If the target webpage includes multiple regions, successively traverse
Each region obtains first content of text of described each region respectively.
When user is when the display interface of target webpage carries out language handover operation, the language switching for such as clicking interface is pressed
Button, the corresponding language switching of the language handover operation that the available user of web page text adjustment equipment submits refer to
It enables, and further obtains the language form that the language switching instruction carries, is i.e. the target language of acquisition language switching instruction carrying
Speech.Wherein, first content of text is shown using original language before switching, and after switching, first content of text needs
Shown using object language, the source language and the target language be it is preset it is multilingual in two of them language.It needs
Illustrate, it, specifically can be fixed if developer by developer or user's self-defining for the object language
Justice, then can be for when user carries out language handover operation, every switching be primary, then default is switched to next language from current language
Speech, until user stops language handover operation after being switched to object language;It is defined if user, then can be user preset
It is multilingual middle to select one such language as object language.
S203, the text for sending the content identification for carrying the object language and first content of text to server are looked into
Request is looked for, so that the server is based on institute's object language and obtains corresponding second content of text of the content identification;
S204 receives second content of text that the server returns;
Specifically, the web page text adjustment equipment can determine in the text after switching according to the language switching instruction
Hold corresponding object language, further, the web page text adjustment equipment can be corresponding by first content of text
Original language is switched to the object language, and the corresponding content of text of the object language is the second content of text.It needs to illustrate
If first content of text is plain text, the web page text adjustment equipment searches institute in preset database
The first content of text for stating object language mark, shows the result found as the second content of text, if described the
One content of text is the text on text or video on picture, then the object language mark is searched in preset database
The first content of text address information, and picture or video source are obtained according to the address information, the picture that will acquire or
Person's video source is shown as the second content of text.The acquisition picture or video source can be to download institute in the server
The corresponding file of address information is stated, the address information can connect for storage chains or uniform resource locator (Uniform
Resource Locator, URL) etc..
S205, when the number of characters of second content of text is greater than the first preset characters number threshold value and less than the second predetermined word
Number threshold value is accorded with, then the display format of second content of text is adjusted using the first preset text adjustment rule, institute
The second preset characters number threshold value is stated greater than the first preset characters number threshold value;
Specifically, the first preset text adjustment rule can for by first content of text corresponding position by
It is shown centered on and is adjusted to occupy top display, or multirow is adjusted to by a line and is shown etc., is not especially limited herein.
The web page text adjustment equipment is after generating second content of text, available second content of text
Number of characters, and the number of characters is compared with the first preset characters number threshold value and the second preset characters number threshold value.Wherein,
The first preset characters number threshold value can be the number of characters that every row is shown, the second preset characters number threshold value can be multirow
(such as two rows) total the sum of number of characters, does not limit specifically.
As shown in figure 5, a line is shown centered on, and after being switched to English, number of characters is more than if the first content of text is Chinese
The number of characters threshold number that every row is shown, and less than the total number of characters number of two rows and, then be adjusted to occupy and take one's place capable display.
S206, when the number of characters of second content of text is greater than the second preset characters number threshold value, then using second
Preset text adjustment rule is adjusted the display format of second content of text.
Specifically, the second preset display rule can be addition ellipsis compression display, do not limit specifically herein
It is fixed.
For example, as shown in fig. 6, Display Characters Per Frame is more than second after the first content of text is switched to the second content of text
Preset characters number threshold value then adds ellipsis after display portion text when display space is inadequate, after if desired checking switching
Complete content, can be by clicking ellipsis floating display.
Optionally, when the display space of the target webpage is sufficiently large, adaptively not maximum height limit line feed display.Such as figure
Shown in 7, for same language, multirow can be changed by a line and be shown.
In embodiments of the present invention, real after by adding preset self-adaptive layout module in the page of targeted website
The self-adaptive layout of the existing page, and loaded and displayed content, can be right before carrying out language switching to obtain target pages in the page
The corresponding content of text of preset each language shown respectively, so as to according to display mistake in time to self-adaptive layout template
It is debugged and is modified, after obtaining for the language switching instruction of the first content of text in target webpage, sent to server
The String searching request for carrying the content identification of object language and the first content of text, so that server is obtained based on object language
Corresponding second content of text of content identification, the number of characters of the second content of text and the first preset characters number threshold value and second is pre-
If number of characters threshold value is compared, and different text adjustment rules is respectively adopted to the second content of text when meeting condition
Display format is adjusted.The switching of multilingual may be implemented by adding a set of self-adaptive layout template, and by language
The display format of the content of text in webpage after speech switching is adjusted, and content of text is accurately completely shown,
The mode that web page text Format adjusting can be enriched improves the accuracy of the content of text display format of different language type.
Below in conjunction with attached drawing 8 and attached drawing 9, it is situated between in detail to web page text provided in an embodiment of the present invention adjustment equipment
It continues.It should be noted that attached drawing 8 and attached web page text shown in Fig. 9 adjust equipment, for executing shown in Fig. 1 and Fig. 2 of the present invention
The method of embodiment, for ease of description, only parts related to embodiments of the present invention are shown, and particular technique details does not disclose
, please refer to Fig. 1 of the present invention and embodiment shown in Fig. 2.
Fig. 8 is referred to, for the embodiment of the invention provides the structural schematic diagrams that a kind of web page text adjusts equipment.Such as Fig. 3
Shown, the web page text adjustment equipment 1 of the embodiment of the present invention may include: instruction acquisition module 11, language switching module
12 and Format adjusting module 13.
Instruction acquisition module 11, it is described for obtaining the language switching instruction for being directed to the first content of text in target webpage
Language switching instruction carries object language.
It, can be with specifically, instruction acquisition module obtains the language switching instruction for the first content of text in target webpage
Understand, the target webpage may include at least one region, can be in each region at least one region
Show different contents, such as text, picture, video.Wherein, the content of text in the target webpage is first before the handover
Content of text, first content of text may include plain text, text on text and video on picture etc..
When user is when the display interface of target webpage carries out language handover operation, the language switching for such as clicking interface is pressed
Button, described instruction obtain the corresponding language switching instruction of the language handover operation that the available user of module submits,
And further obtain the language form that the language switching instruction carries, that is, the object language that language switching instruction carries is obtained,
Meanwhile the content identification of the first content of text of language switching instruction carrying is obtained, the content identification can be described the
The storage address of one content of text, such as http://abc.com, or the text information of the content of text, such as " right
Claim ".Wherein, first content of text is shown using original language before switching, after switching, first content of text
Need to be shown using object language, the source language and the target language be it is preset it is multilingual in two of them language.
It should be noted that it is directed to the object language, it specifically can be by developer or user's self-defining, if developer
Definition, then can be for when user carries out language handover operation, every switching be primary, then default is switched to next language from current language
Speech, until user stops language handover operation after being switched to object language;It is defined if user, then can be user preset
It is multilingual middle to select one such language as object language.
Language switching module 12, for according to the language switching instruction by the language form of first content of text by
Original language switches to the object language, to generate the second content of text.
Optionally, as shown in figure 9, the language switching module is specifically used for:
The String searching for sending the content identification for carrying the object language and first content of text to server is asked
It asks, so that the server is based on institute's object language and obtains corresponding second content of text of the content identification;
Receive second content of text that the server returns.
Specifically, the language switching module is preset on the server if first content of text is plain text
The first content of text that the object language mark is searched in database, carries out the result found as the second content of text
It has been shown that, if first content of text is the text (non-plain text) on the text or video on picture, in preset data
Search the address information of the first content of text of object language mark in library, and according to the address information obtain picture or
Person's video source, the picture that will acquire or video source are shown as the second content of text.It is deposited in the preset database
Store up the multi-language text information of plain text and the multilingual storage address of picture or video.Preferably, it can be cut in language
Before changing, first content of text is sent to translating server by preset interface and is translated, the translating server
The object language can be used to be translated, and the content of text after translation is sent to the language switching module and is shown
Show whether there is the problems such as content of text display mistake or display format misplace so that user can detecte.
Wherein, the corresponding language form of first content of text is original language, the corresponding language of second content of text
Speech type is object language.It should be noted that the source language and the target language be it is preset it is multilingual in two of them
Language.Search whether that there are user login informations in user's login record of the target webpage;If being logged in the user
There are the user login informations in record, then obtain historical log language, using the historical log language as the source language
Speech;If the user login information is not present in user's login record, search whether to exist in browsing record slow
Deposit information;If obtaining historical viewings language there are the cache information (cookie) in browsing record, being gone through described
History browses language as the original language;If the cache information is not present in browsing record, access terminal is obtained
IP address;Area belonging to the IP address (such as: Las Vegas, US) is determined, by the region language (English in the area
Language) it is used as the original language.
Format adjusting module 13, for adopting when the number of characters of second content of text is greater than preset characters number threshold value
The display format of second content of text is adjusted with preset text adjustment rule.
Specifically, the preset text adjustment rule can for by second content of text from a line become multirow into
Row display, or second content of text is shown centered on or is occupied top display, can also be the described in display portion
After two texts, addition predetermined symbol (such as ellipsis) is shown, is not especially limited herein.
The Format adjusting module is after generating second content of text, the word of available second content of text
Number is accorded with, and the number of characters and preset characters number threshold value (number of characters that such as every row is shown) are compared, if the number of characters
Less than or equal to preset characters number, then shown using display mode identical with the first content of text, if institute's number of characters
Greater than preset characters number, then the display format of the second content of text is adjusted using preset text adjustment rule, such as:
Every row shows 10 characters, and the text character number of the second content of text after switching is 15, then can enter a new line the display of residence top.
Optionally, the Format adjusting module 13 is specifically used for:
When the number of characters of second content of text is greater than the first preset characters number threshold value and less than the second preset characters number
Threshold value is then adjusted the display format of second content of text using the first preset text adjustment rule, and described the
Two preset characters number threshold values are greater than the first preset characters number threshold value;
When the number of characters of second content of text is greater than the second preset characters number threshold value, then using second preset
Text adjustment rule is adjusted the display format of second content of text.
Optionally, as shown in figure 9, the equipment 1 further include:
Template adding module 14, for adding preset self-adaptive layout template in the page of targeted website to generate mesh
Mark webpage.
Specifically, the self-adaptive layout module is cascading style sheets (CSS:Cascading Style Sheets) layout
Layout modules in technology.So-called layout exactly carries out size setting to the page and positions.That is, it is all with size and
Relevant attribute is positioned, may serve to be laid out, these attributes can be determined by self-adaptive layout module.Wherein, described
Self-adaptive layout module may include: inline-block layout, elastic box, absolute fix+margin, negative margin+
Padding, percentage layout and response type picture etc..The self-adaptive layout module can be combined according to demand,
To lay out layout pattern abundant.When carrying out self-adaptive layout, developer considers that the content of text carries out language
The case where multiline text is occurred that after switching, multline text can be used the modes such as placed in the middle or residence top and shown.
It should be noted that the CSS be it is a kind of be used to show HTML (application of standard generalized markup language) or
The computer language of the files patterns such as XML (a subset of standard generalized markup language), can be used Unicode (Unicode) into
Row coding.CSS not only can statically modified web page, various scripting languages can also be cooperated dynamically to carry out to webpage each element
It formats.CSS can accurately control the typesetting progress Pixel-level of element position in webpage, support almost all of font size
Pattern possesses the ability to web object and model pattern editor.
According to user to the Pages Design demand of targeted website, presets self-adaptive layout module and store.By
The self-adaptive layout module, and the loaded and displayed content in the page are added in the page of targeted website, to generate mesh
Webpage is marked, realizes layout and display to the page.It is understood that the target webpage may include at least one area
Domain can show different contents, such as text, picture, video in each region at least one region.
Optionally, the template adding module 14 is specifically used for:
By it is preset it is multilingual in the corresponding content of text of each language show respectively;
In display format mistake, preset self-adaptive layout template is debugged;
The self-adaptive layout template after debugging is added in the page of targeted website, to generate target webpage.
Optionally, as shown in figure 9, the equipment 1 further include:
Information searching module 15, for searching whether that there are user's logins in user's login record of the target webpage
Information;
Language obtains module 16, if for, there are the user login information, obtaining in user's login record
Historical log language, using the historical log language as the original language;
The information searching module 15, if being also used in user's login record, there is no the users to log in letter
Breath then searches whether that there are cache informations in browsing record;
The language obtains module 16, if being also used to there are the cache information in browsing record, acquisition is gone through
History browses language, using the historical viewings language as the original language;
Address acquisition module 17, if obtaining access eventually for the cache information to be not present in browsing record
The IP address at end;
The language obtains module 16, is also used to determine area belonging to the IP address, by the region language in the area
As the original language.
In embodiments of the present invention, real after by adding preset self-adaptive layout module in the page of targeted website
The self-adaptive layout of the existing page, and loaded and displayed content, can be right before carrying out language switching to obtain target pages in the page
The corresponding content of text of preset each language shown respectively, so as to according to display mistake in time to self-adaptive layout template
It is debugged and is modified, after obtaining for the language switching instruction of the first content of text in target webpage, sent to server
The String searching request for carrying the content identification of object language and the first content of text, so that server is obtained based on object language
Corresponding second content of text of content identification, the number of characters of the second content of text and the first preset characters number threshold value and second is pre-
If number of characters threshold value is compared, and different text adjustment rules is respectively adopted to the second content of text when meeting condition
Display format is adjusted.The switching of multilingual may be implemented by adding a set of self-adaptive layout template, and by language
The display format of the content of text in webpage after speech switching is adjusted, and content of text is accurately completely shown,
The mode that web page text Format adjusting can be enriched improves the accuracy of the content of text display format of different language type.
The embodiment of the invention also provides a kind of computer storage medium, the computer storage medium can store more
Item instruction, described instruction are suitable for being loaded by processor and being executed the method and step such as above-mentioned Fig. 1-embodiment illustrated in fig. 7, specifically hold
Row process may refer to Fig. 1-embodiment illustrated in fig. 7 and illustrate, herein without repeating.
Referring to Figure 10, for the embodiment of the invention provides the structural schematic diagrams that another web page text adjusts equipment.Such as
Shown in Figure 10, web page text adjustment equipment 1000 may include: at least one processor 1001, such as CPU, at least one
Network interface 1004, user interface 1003, memory 1005, at least one communication bus 1002.Wherein, communication bus 1002 is used
Connection communication between these components of realization.Wherein, user interface 1003 may include display screen (Display), keyboard
(Keyboard), optional user interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 is optional
May include standard wireline interface and wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory,
It is also possible to non-labile memory (non-volatile memory), for example, at least a magnetic disk storage.Memory
1005 optionally can also be that at least one is located remotely from the storage device of aforementioned processor 1001.As shown in Figure 10, as one
May include in the memory 1005 of kind of computer storage medium operating system, network communication module, Subscriber Interface Module SIM and
Web page text adjusts application program.
In web page text shown in Fig. 10 adjustment equipment 1000, user interface 1003 is mainly used for providing input for user
Interface, obtain user input data;Network interface 1004 is mainly used for carrying out data communication with user terminal;And processor
1001 can be used for that the web page text stored in memory 1005 is called to adjust application program, and specifically execute following operation:
The language switching instruction for the first content of text in target webpage is obtained, the language switching instruction carries mesh
Poster speech;
The language form of first content of text is switched into the mesh by original language according to the language switching instruction
Poster speech, to generate the second content of text;
When the number of characters of second content of text is greater than preset characters number threshold value, rule is adjusted using preset text
The display format of second content of text is adjusted.
In one embodiment, the processor 1001 is being executed first text according to the language switching instruction
The language form of content switches to the object language by original language, specific to execute following behaviour when generating the second content of text
Make:
The String searching for sending the content identification for carrying the object language and first content of text to server is asked
It asks, so that the server is based on institute's object language and obtains corresponding second content of text of the content identification;
Receive second content of text that the server returns.
In one embodiment, the processor 1001 is executing the language obtained for the first content of text in target webpage
Before saying switching command, following operation is specifically also executed:
Preset self-adaptive layout template is added in the page of targeted website to generate target webpage.
In one embodiment, the processor 1001 adds in the page of targeted website preset adaptive in execution
It is specific to execute following operation when being laid out template to generate target webpage:
By it is preset it is multilingual in the corresponding content of text of each language show respectively;
In display format mistake, preset self-adaptive layout template is debugged;
The self-adaptive layout template after debugging is added in the page of targeted website, to generate target webpage.
In one embodiment, the processor 1001 also executes following operation:
Search whether that there are user login informations in user's login record of the target webpage;
If there are the user login informations in user's login record, historical log language is obtained, it will be described
Historical log language is as the original language;
If the user login information is not present in user's login record, search whether to deposit in browsing record
In cache information;
If in browsing record, there are the cache informations, historical viewings language are obtained, by the historical viewings
Language is as the original language;
If the cache information is not present in browsing record, the net association IP address of access terminal is obtained;
Area belonging to the IP address is determined, using the region language in the area as the original language.
In one embodiment, the processor 1001 is executing the number of characters when second content of text greater than default
When number of characters threshold value, when being adjusted using preset text adjustment rule to the display format of second content of text, tool
Body executes following steps:
When the number of characters of second content of text is greater than the first preset characters number threshold value and less than the second preset characters number
Threshold value is then adjusted the display format of second content of text using the first preset text adjustment rule, and described the
Two preset characters number threshold values are greater than the first preset characters number threshold value;
When the number of characters of second content of text is greater than the second preset characters number threshold value, then using second preset
Text adjustment rule is adjusted the display format of second content of text.
In embodiments of the present invention, real after by adding preset self-adaptive layout module in the page of targeted website
The self-adaptive layout of the existing page, and loaded and displayed content, can be right before carrying out language switching to obtain target pages in the page
The corresponding content of text of preset each language shown respectively, so as to according to display mistake in time to self-adaptive layout template
It is debugged and is modified, after obtaining for the language switching instruction of the first content of text in target webpage, sent to server
The String searching request for carrying the content identification of object language and the first content of text, so that server is obtained based on object language
Corresponding second content of text of content identification, the number of characters of the second content of text and the first preset characters number threshold value and second is pre-
If number of characters threshold value is compared, and different text adjustment rules is respectively adopted to the second content of text when meeting condition
Display format is adjusted.The switching of multilingual may be implemented by adding a set of self-adaptive layout template, and by language
The display format of the content of text in webpage after speech switching is adjusted, and content of text is accurately completely shown,
The mode that web page text Format adjusting can be enriched improves the accuracy of the content of text display format of different language type.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the program can be stored in a computer-readable storage medium
In, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainly
It encloses, therefore equivalent changes made in accordance with the claims of the present invention, is still within the scope of the present invention.
Claims (12)
1. a kind of web page text method of adjustment characterized by comprising
The language switching instruction for the first content of text in target webpage is obtained, the language switching instruction carries target language
Speech;
The language form of first content of text is switched into the target language by original language according to the language switching instruction
Speech, to generate the second content of text;
When the number of characters of second content of text is greater than the first preset characters number threshold value and less than the second preset characters number threshold value,
Then the display format of second content of text is adjusted using the first preset text adjustment rule, described second is default
Number of characters threshold value is greater than the first preset characters number threshold value;
When the number of characters of second content of text is greater than the second preset characters number threshold value, then using the second preset text
Adjustment rule is adjusted the display format of second content of text;
The first preset text adjustment rule is to be adjusted to second content of text by being shown centered in corresponding position
Top display is occupied, the second preset text adjustment rule is addition ellipsis compression display, the first preset characters number threshold
Value is the number of characters that every row is shown, the second preset characters number threshold value is total the sum of the number of characters of multirow.
2. the method according to claim 1, wherein described literary by described first according to the language switching instruction
The language form of this content switches to the object language by original language, to generate the second content of text, comprising:
The String searching request for the content identification for carrying the object language and first content of text is sent to server, with
So that the server is based on the object language and obtains corresponding second content of text of the content identification;
Receive second content of text that the server returns.
3. the method according to claim 1, wherein described obtain for the first content of text in target webpage
Before language switching instruction, further includes:
Preset self-adaptive layout template is added in the page of targeted website to generate target webpage.
4. according to the method described in claim 3, it is characterized in that, it is described added in the page of targeted website it is preset adaptive
Template should be laid out to generate target webpage, comprising:
By it is preset it is multilingual in the corresponding content of text of each language show respectively;
In display format mistake, preset self-adaptive layout template is debugged;
The self-adaptive layout template after debugging is added in the page of targeted website, to generate target webpage.
5. the method according to claim 1, wherein the method also includes:
Search whether that there are user login informations in user's login record of the target webpage;
If there are the user login informations in user's login record, historical log language is obtained, by the history
Language is logged in as the original language;
If the user login information is not present in user's login record, search whether to exist in browsing record slow
Deposit information;
If in browsing record, there are the cache informations, historical viewings language are obtained, by the historical viewings language
As the original language;
If the cache information is not present in browsing record, the net association IP address of access terminal is obtained;
Area belonging to the IP address is determined, using the region language in the area as the original language.
6. a kind of web page text adjusts equipment characterized by comprising
Instruction acquisition module, for obtaining the language switching instruction for being directed to the first content of text in target webpage, the language is cut
It changes instruction and carries object language;
Language switching module, for according to the language switching instruction by the language form of first content of text by original language
The object language is switched to, to generate the second content of text;
Format adjusting module, for when the number of characters of second content of text is greater than preset characters number threshold value, using default
Text adjustment rule the display format of second content of text is adjusted;
Wherein, the Format adjusting module is specifically used for:
When the number of characters of second content of text is greater than the first preset characters number threshold value and less than the second preset characters number threshold value,
Then the display format of second content of text is adjusted using the first preset text adjustment rule, described second is default
Number of characters threshold value is greater than the first preset characters number threshold value;
When the number of characters of second content of text is greater than the second preset characters number threshold value, then using the second preset text
Adjustment rule is adjusted the display format of second content of text;
The first preset text adjustment rule is to be adjusted to second content of text by being shown centered in corresponding position
Top display is occupied, the second preset text adjustment rule is addition ellipsis compression display, the first preset characters number threshold
Value is the number of characters that every row is shown, the second preset characters number threshold value is total the sum of the number of characters of multirow.
7. equipment according to claim 6, which is characterized in that the language switching module is specifically used for:
The String searching request for the content identification for carrying the object language and first content of text is sent to server, with
So that the server is based on the object language and obtains corresponding second content of text of the content identification;
Receive second content of text that the server returns.
8. equipment according to claim 6, which is characterized in that the equipment further include:
Template adding module, for adding preset self-adaptive layout template in the page of targeted website to generate target network
Page.
9. equipment according to claim 8, which is characterized in that the template adding module is specifically used for:
By it is preset it is multilingual in the corresponding content of text of each language show respectively;
In display format mistake, preset self-adaptive layout template is debugged;
The self-adaptive layout template after debugging is added in the page of targeted website, to generate target webpage.
10. equipment according to claim 6, which is characterized in that the equipment further include:
Information searching module, for searching whether that there are user login informations in user's login record of the target webpage;
Language obtains module, if obtaining history for there are the user login informations in user's login record and stepping on
Language is recorded, using the historical log language as the original language;
The information searching module, if being also used to that the user login information is not present in user's login record,
Search whether that there are cache informations in browsing record;
The language obtains module, if being also used to obtain historical viewings there are the cache information in browsing record
Language, using the historical viewings language as the original language;
Address acquisition module, if obtaining the IP of access terminal for the cache information to be not present in browsing record
Address;
The language obtains module, is also used to determine area belonging to the IP address, using the region language in the area as institute
State original language.
11. a kind of computer storage medium, which is characterized in that the computer storage medium is stored with a plurality of instruction, the finger
It enables and is suitable for being loaded by processor and being executed such as any one of claim 1 to 5 the method.
12. a kind of web page text adjusts equipment characterized by comprising processor and memory;Wherein, the memory is deposited
Computer program is contained, the processor realizes the side as described in any one of claim 1 to 5 when executing the computer program
Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710352610.1A CN107256234B (en) | 2017-05-18 | 2017-05-18 | A kind of web page text method of adjustment and its equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710352610.1A CN107256234B (en) | 2017-05-18 | 2017-05-18 | A kind of web page text method of adjustment and its equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107256234A CN107256234A (en) | 2017-10-17 |
CN107256234B true CN107256234B (en) | 2018-12-07 |
Family
ID=60027271
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710352610.1A Active CN107256234B (en) | 2017-05-18 | 2017-05-18 | A kind of web page text method of adjustment and its equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107256234B (en) |
Families Citing this family (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108241731A (en) * | 2017-10-18 | 2018-07-03 | 北京车和家信息技术有限公司 | Webpage multi-language switching method, device, computer equipment and storage medium |
CN108280128A (en) * | 2017-12-19 | 2018-07-13 | 苏宁云商集团股份有限公司 | A kind of method and apparatus of displaying personal page |
CN110019532B (en) * | 2018-02-07 | 2022-03-25 | 中国平安人寿保险股份有限公司 | Rule editing method, terminal equipment and storage medium |
CN108536407B (en) * | 2018-03-02 | 2019-09-10 | Oppo广东移动通信有限公司 | Text display method, device and mobile terminal |
CN110956016B (en) * | 2018-09-25 | 2024-03-22 | 珠海金山办公软件有限公司 | Document content format adjusting method and device and electronic equipment |
CN110362370B (en) * | 2019-06-14 | 2022-10-18 | 平安科技(深圳)有限公司 | Webpage language switching method and device and terminal equipment |
CN112446191A (en) * | 2019-08-12 | 2021-03-05 | 珠海金山办公软件有限公司 | Text processing method, device, equipment and storage medium |
CN110941471A (en) * | 2019-11-25 | 2020-03-31 | 厦门中软海晟信息技术有限公司 | Method and device for internationalizing basic data of software system |
CN112596803A (en) * | 2020-08-24 | 2021-04-02 | 文思海辉智科科技有限公司 | Control string truncation checking method and device, computer equipment and storage medium |
CN112330274A (en) * | 2020-10-30 | 2021-02-05 | 中欧卡航(江苏)物流服务有限公司 | Cross-border customs information management method, system, computer device and storage medium |
CN113553524B (en) * | 2021-06-30 | 2022-10-18 | 上海硬通网络科技有限公司 | Method, device, equipment and storage medium for typesetting characters of webpage |
CN113553802B (en) * | 2021-06-30 | 2023-02-07 | 上海硬通网络科技有限公司 | Typesetting method, device, equipment and storage medium for characters in hidden picture of webpage |
CN113778582A (en) * | 2021-07-28 | 2021-12-10 | 赤子城网络技术(北京)有限公司 | Setting method, device, equipment and storage medium for localized multi-language adaptation |
CN113867665A (en) * | 2021-09-17 | 2021-12-31 | 珠海格力电器股份有限公司 | Display language modification method and device, electrical equipment and terminal equipment |
CN114548079B (en) * | 2022-01-26 | 2023-05-16 | 广东联想懂的通信有限公司 | Text display method and device and readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104601595A (en) * | 2015-02-05 | 2015-05-06 | 浙江飞常哆科技有限公司 | Webpage publishing and accessing method and system |
CN105573969A (en) * | 2006-10-02 | 2016-05-11 | 谷歌公司 | Displaying original text in a user interface with translated text |
CN106598956A (en) * | 2016-11-30 | 2017-04-26 | 上海工程技术大学 | Language conversion server system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130198325A1 (en) * | 2012-01-26 | 2013-08-01 | Motorola Mobility Llc | Provision and running a download script |
-
2017
- 2017-05-18 CN CN201710352610.1A patent/CN107256234B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105573969A (en) * | 2006-10-02 | 2016-05-11 | 谷歌公司 | Displaying original text in a user interface with translated text |
CN104601595A (en) * | 2015-02-05 | 2015-05-06 | 浙江飞常哆科技有限公司 | Webpage publishing and accessing method and system |
CN106598956A (en) * | 2016-11-30 | 2017-04-26 | 上海工程技术大学 | Language conversion server system |
Also Published As
Publication number | Publication date |
---|---|
CN107256234A (en) | 2017-10-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107256234B (en) | A kind of web page text method of adjustment and its equipment | |
Asakawa et al. | Transcoding | |
US10515142B2 (en) | Method and apparatus for extracting webpage information | |
US8626486B2 (en) | Automatic spelling correction for machine translation | |
CN103984686B (en) | page switching method and device | |
US9430583B1 (en) | Extracting a portion of a document, such as a web page | |
US20150309993A1 (en) | Agile Enterprise Globalization | |
CN110020385B (en) | System and method for extracting website characteristics | |
US20150024351A1 (en) | System and Method for the Relevance-Based Categorizing and Near-Time Learning of Words | |
KR20110039233A (en) | Resource locator suggestions from input character sequence | |
US20120072831A1 (en) | Method for creating a multi-lingual web page | |
WO2008157322A1 (en) | Displaying content on a mobile device | |
US20190065444A1 (en) | Techniques for efficient & high-throughput web content-creation | |
CN103699674A (en) | Webpage storing method, webpage opening method, webpage storing device, webpage opening device and webpage browsing system | |
CN104391786A (en) | Webpage automatic test system and method thereof | |
CN102413297A (en) | Method for realizing webpage browsing on television and television | |
US11361169B2 (en) | Method and server for training a machine learning algorithm for translation | |
JP4771915B2 (en) | Apparatus, method, and program for converting HTML text | |
GB2558870A (en) | Internet browsing | |
CN105205080A (en) | Redundant file clearing method, device and system | |
Bader et al. | Responsive web design techniques | |
US9594737B2 (en) | Natural language-aided hypertext document authoring | |
CN102087653A (en) | Method and device for issuing website information | |
WO2014049310A2 (en) | Method and apparatuses for interactive searching of electronic documents | |
CN101676905A (en) | Layout for modifying resource contents based on customized rules |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |