Multilingual text self-adaptive configuration method and electronic device

By obtaining the source text set at runtime, translating and detecting adaptability, and performing semantic rewriting, a closed-loop adaptation of multilingual text on the client side is achieved, solving text overflow and layout problems during multilingual switching, and improving user experience and page stability.

CN121031624BActive Publication Date: 2026-01-23INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511567448.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-01-23
Estimated Expiration
2045-10-30

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve dynamic adaptation when switching between multiple languages, leading to text overflow, layout inconsistencies, and a degraded user experience. Furthermore, they lack semantically equivalent compression capabilities.

Method used

By responding to page translation commands, the system obtains and translates the source text set, detects adaptability, performs semantic rewriting, aggregates suitable and candidate sets for batch rendering within the same rendering frame, and combines terminal capabilities and policy requirements to achieve real-time adaptation with a closed loop on the terminal side.

Benefits of technology

While ensuring semantic integrity and readability, it significantly reduces layout offset, improves page stability and user experience, and balances performance overhead and rendering stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121031624B_ABST
    Figure CN121031624B_ABST
Patent Text Reader

Abstract

The application discloses a multilingual text self-adaptive configuration method and electronic equipment, and relates to the technical field of computers, which comprises the following steps: in response to receiving a translation instruction during page running, obtaining a source text set; translating the source text set according to a target language identifier and a constraint strategy to obtain a translation text set; detecting the adaptability of each translation text in the translation text set according to the constraint strategy to obtain an adaptive set and a non-adaptive set; performing semantic rewriting on each non-adaptive translation text in the non-adaptive set to obtain a target candidate set; and aggregating the adaptive set and the target candidate set in the same rendering frame, batch rendering the adaptive set and the target candidate set and displaying the adaptive set and the target candidate set, so as to solve the problems of lack of multilingual dynamic adaptation capability and insufficient semantic equivalent compression, and achieve the technical effects of significantly reducing cumulative layout offset, improving page stability and user experience under the premise of guaranteeing semantic integrity and readability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a multilingual text adaptive configuration method and electronic device. Background Technology

[0002] With the globalization of web applications, front-end pages need to support multilingual switching. Traditional methods face significant challenges in real-world runtime environments: factors such as differences in translated text length, changes in writing direction, word segmentation rules, font availability, and dynamic changes in container size often cause visual and interactive issues such as text overflow, layout jumps, and cumulative layout offsets. Static rules or offline testing are insufficient to cover dynamic contexts, leading to delayed fixes. Furthermore, simple automatic translation often ignores semantically equivalent expressions within the limited user page space, impacting user experience and conversion rates. Related technologies mostly focus on static length prediction or visual verification during the testing phase, lacking real-time adaptation capabilities at runtime; they emphasize layout-level reformatting rather than semantic simplification and rewriting; and they fail to integrate translation results, space constraints, semantic compression, and one-time stable rendering into a closed-loop solution.

[0003] Therefore, in view of the shortcomings of existing technical solutions, the present invention provides a multilingual text adaptive configuration method. Summary of the Invention

[0004] This application provides a method, apparatus, device, and storage medium for adaptive configuration of multilingual text, in order to at least address the problems of lack of dynamic multilingual adaptation capabilities and insufficient semantically equivalent compression.

[0005] This application provides a multilingual text adaptive configuration method, the method comprising: in response to receiving a translation instruction at page runtime, obtaining a source text set; translating the source text set according to the target language identifier and constraint strategy to obtain a translation set; performing adaptation detection on each translation in the translation set according to the constraint strategy to obtain an adaptation set and an adaptation set; semantically rewriting each adaptation translation in the adaptation set to obtain a target candidate set; aggregating the adaptation set and the target candidate set in the same rendering frame, batch rendering the adaptation set and the target candidate set and displaying them.

[0006] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the above-described multilingual text adaptive configuration methods when executing the computer program.

[0007] This application achieves the following: Upon receiving a translation instruction at runtime, a source text set is obtained. Based on the target language identifier and constraint strategy, the source text set is translated to obtain a translation set. Adaptability testing is performed on each translation in the translation set according to the constraint strategy, resulting in an adapted set and a non-adapted set. Semantic rewriting is performed on each non-adapted translation in the non-adapted set to obtain a target candidate set. The adapted set and target candidate set in the same rendering frame are aggregated, and batch-rendered and displayed. Therefore, while ensuring semantic integrity and readability, the cumulative layout offset can be significantly reduced, improving page stability and user experience. Through a closed-loop, low-latency real-time adaptation mechanism on the client side, batch processing and off-screen trial layout are completed within a single frame, achieving a balance between performance overhead and rendering stability. Attached Figure Description

[0008] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0009] Figure 1 A flowchart illustrating a multilingual text adaptive configuration method provided in an embodiment of this application;

[0010] Figure 2 A schematic diagram of the overall system architecture of a multilingual text adaptive configuration method provided in this application embodiment;

[0011] Figure 3 A flowchart illustrating another multilingual text adaptive configuration method provided in this application embodiment;

[0012] Figure 4 A schematic diagram of the component-level strategy library structure of a multilingual text adaptive configuration method provided in this application embodiment;

[0013] Figure 5 A single-frame rendering timing diagram of a multilingual text adaptive configuration method provided in this application embodiment;

[0014] Figure 6 A structural block diagram of a multilingual text adaptive configuration device provided in an embodiment of this application;

[0015] Figure 7 This is an internal structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0017] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0018] It should be noted that the terms "S1," "S2," etc., are used only for descriptive purposes and do not specifically refer to the order or sequence, nor are they intended to limit this application. They are merely for the convenience of describing the method of this application and should not be construed as indicating the sequential order of the steps. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0019] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] The embodiments of this application provide a multilingual text adaptive configuration method, and the method is described in detail in conjunction with the execution flow of the multilingual text adaptive configuration method.

[0021] S101: In response to receiving a translation instruction at page runtime, obtain the source text set, translate the source text set according to the target language identifier and constraint strategy, and obtain the translation set.

[0022] Here, the source text set includes multiple source texts, and the translation is carried out using the source text as the smallest unit.

[0023] Here, the scenarios in which a translation instruction is received during page runtime can include language switching, page loading, etc.

[0024] This can be achieved by using punctuation, context, and rules to identify multiple source texts within a collection of source texts. For example, a rule could be that a sentence is generally considered to have ended when it ends with certain symbols followed by a space, a newline, or a capital letter (in English).

[0025] Specifically, identification can be performed using specialized libraries such as spaCy, NLTK (for English), or Jieba (which can also be used for Chinese when combined with rules).

[0026] When a page loads or a language is switched, a translation operation is triggered, loading the constraint policies for the current session from the policy library or configuration center, or loading the thesaurus, abbreviation table, and / or localization rules from the configuration and resources.

[0027] Constraint strategies may include minimum clickable area, maximum number of rows, and CLS (Cumulative Layout Shift) threshold.

[0028] Specifically, when translating, it is also necessary to ensure that "non-mirrorized semantics" such as numbers, brand names, and directional icons are not disrupted in a left-to-right writing environment.

[0029] S102: Perform fit detection on each translation in the translation set according to the constraint strategy to obtain the fit set and the non-fit set.

[0030] Here, the adaptability detection is based on scrollWidth, clientWidth, line height threshold, line number threshold, or shadow layout to determine whether the text goes out of bounds or causes misalignment.

[0031] Adaptability testing can include overflow detection and layout misalignment risk detection.

[0032] These methods may include shadow layout, container query, or size measurement.

[0033] S103: Semantically rewrite each unfit translation in the unfit set to obtain the target candidate set.

[0034] Here, semantic rewriting involves performing serialization processes on the translation without changing the core meaning, such as deduplication, synonym replacement, abbreviation, unit conversion, word segmentation, soft line breaks, and template catch-all, to meet container constraints.

[0035] This includes semantic rewriting for multiple non-adaptive translations, as well as priority ranking, where priority can be obtained through constraint strategies.

[0036] S104: Aggregate the adapter set and target candidate set in the same rendering frame, batch render the adapter set and target candidate set and display them.

[0037] Here, "same rendering frame" refers to the same browser rendering frame.

[0038] Specifically, text submissions are scheduled uniformly, and the target short text is batch-replaced onto the page within the same browser rendering frame to avoid cumulative layout offsets exceeding the threshold.

[0039] It should be noted that, while ensuring semantic integrity and readability, this application significantly reduces cumulative layout offset, improves page stability and user experience; through a closed-loop, low-latency real-time adaptation mechanism on the client side, batch processing and off-screen trial layout are completed within a single frame, balancing performance overhead and rendering stability.

[0040] In some specific implementations, in response to receiving a translation instruction at page runtime, a source text set is obtained, and the source text set is translated according to the target language identifier and constraint policy to obtain a translation set, including:

[0041] The translation mode is determined based on the terminal capabilities and / or policy requirements, wherein the translation mode includes a first translation mode and a second translation mode;

[0042] In response to the translation mode being the first translation mode, the source text set is translated through the runtime of the client-side model to obtain the translation set;

[0043] In response to the translation mode being the second translation mode, the source text set is translated through a remote translation service, and the translated text set is received.

[0044] Here, edge model runtime refers to the software environment and execution engine required to run artificial intelligence models locally on terminal devices (such as mobile phones, tablets, smartwatches, IoT devices, PCs, etc.).

[0045] Translation can be performed concurrently or in batches.

[0046] Specifically, the generated translations can be cached locally for reuse and to reduce latency.

[0047] Specifically, the terminal-side model is used for runtime execution first. If the terminal capability is insufficient or the policy requires otherwise, the service will be switched to remote translation.

[0048] In this way, low latency, enhanced privacy protection, and offline availability are achieved, improving response speed and user experience. At the same time, by using remote services as a supplement, the limitations of terminal computing power and resources are overcome, ensuring the ability to handle complex tasks, service reliability, and flexibility of global strategies, thereby achieving the best balance of performance, cost, security, and reliability overall.

[0049] In some specific implementations, the method further includes:

[0050] Based on the component type corresponding to each translation, the first strategy condition is determined, which is a functional and structural condition.

[0051] Based on the linguistic features of each translation, the second strategy conditions are determined, which are linguistic and typesetting conditions.

[0052] Based on the first and second strategy conditions, determine the constraint strategies corresponding to each translation.

[0053] The component types can include buttons, labels, table cells, breadcrumbs, etc.

[0054] Among them, language features may include language tags (such as language-region combinations that conform to BCP 47), writing direction (such as LTR (Left-To-Right) and RTL (Right-To-Left)), word segmentation or hyphenation rules, units, dates, number localization rules, fonts, font weights, and font widths.

[0055] Among them, the constraint strategies can be semantic rewriting priority sequence, line number limit, minimum click area, contrast threshold, whether soft line breaks are allowed, whether abbreviations are allowed, etc.

[0056] Specifically, a mapping is established based on language features and component types. This involves mapping the interactive and readability features of controls such as buttons, labels, table cells, and breadcrumbs to the target language's writing direction, word segmentation, hyphenation rules, unit and date localization standards, font axis preferences, etc., to obtain constraint strategies.

[0057] In one embodiment, it may also include loading a dictionary, abbreviation mapping, etc.

[0058] In one embodiment, the system may further include detecting terminal capabilities, such as whether local reasoning is possible or whether word segmentation strategies are allowed.

[0059] In one embodiment, the method further includes: obtaining user profile information; and dynamically adjusting the weights and thresholds of various detection conditions in the constraint strategy based on the user profile information.

[0060] Here, user profile information includes a first profile and a second profile. The first profile comes from user registration information, system settings, accessibility function activation status, etc., and may include user age group, language proficiency, whether the user is visually impaired, whether a screen reader is turned on, etc.; the second profile comes from behavioral data analysis, device capability detection, etc., and may include interaction mode, network environment, and device type, etc.

[0061] The various testing conditions can include readability, accessibility, length, information density, etc.

[0062] Specifically, for elderly users, the weight of readability and accessibility scores in the constraint policy can be increased; for expert users, more abbreviations and industry terms can be allowed; for low-speed network environments, on-device translation and more abbreviation rewriting can be prioritized to reduce reliance on cloud services and transmission volume.

[0063] Specifically, for mobile users, the threshold for "clickable area height" will be increased from 44pt to 60pt to reduce the rate of accidental touches; for users with low network speeds, the threshold for "translation latency" will be lowered to trigger earlier activation of on-device translation or caching of translations.

[0064] In this way, the weight and threshold of the adaptation strategy are intelligently adjusted according to the user's identity and usage environment, so as to achieve intelligent on-demand allocation of system resources while accurately optimizing the personalized user experience.

[0065] In this way, highly adapted localization strategies can be automatically generated, thereby fundamentally eliminating the problems of layout confusion and inconsistent interaction logic. While improving the consistency of user experience, it significantly reduces the development and maintenance costs of manual adaptation.

[0066] In some specific implementations, a fit test is performed on each translation in the translation set according to a constraint strategy to obtain a fit set and a non-fit set, including:

[0067] Based on the constraint strategy, check whether each translation overflows, and determine the first sub-adaptation set and the first sub-non-adaptation set based on the first detection result;

[0068] Based on the constraint strategy, check whether the size of the container corresponding to each translation in the first sub-adaptation set is within the preset safe size range. Based on the second detection result, determine the second sub-adaptation set and the second sub-non-adaptation set.

[0069] Based on the first and second sub-adapted sets, determine the unadapted sets, and use the second sub-adapted set as the adapted set.

[0070] Here, the safe size range includes both height and width ranges.

[0071] This includes, but is not limited to, the above-mentioned detection sequence, and the order of the above detection steps can be adjusted.

[0072] Detection can be performed using methods such as shadow containers, geometric measurement, and approximate estimation. For example, approximate estimation can establish a length estimation model based on known font, font size, and character spacing to estimate character space.

[0073] The detection results may also include the total character width, number of lines, whether the clickable area is compressed, and the difference from the threshold.

[0074] The second detection includes detecting height misalignment and width misalignment. Height misalignment is considered to be at risk if the height of a container increases due to text wrapping, causing the height difference with other containers in the same line to exceed a threshold. Width misalignment is considered to be at risk if the width of a container increases due to excessively long text (such as in a flex layout), causing other elements in the same line to be squeezed or wrap.

[0075] If the translation does not overflow, it is determined that the translation belongs to the first sub-adaptation set; if the translation overflows, it is determined that the translation belongs to the first sub-non-adaptation set; if the size of the container corresponding to the translation is within the preset safe size range, it is determined that the translation belongs to the second sub-adaptation set; if the size of the container corresponding to the translation is not within the preset safe size range, it is determined that the translation belongs to the second sub-non-adaptation set.

[0076] Specifically, a comprehensive risk assessment can be conducted through inline layout conflict detection, vertical space encroachment detection, text baseline alignment detection, and responsive layout break detection to obtain the second detection result.

[0077] Specifically, the process involves two steps of detection, each filtering out a portion of inappropriate translations. The first step checks whether the text exceeds the container's boundaries, for example, if a German word is too long and causes the button text to be incomplete. The second step checks for layout misalignment risks, such as changes in text length causing adjacent elements to overlap, abnormal spacing, or line breaks. This can be achieved by detecting whether the container's height exceeds expectations due to text line breaks, and whether the container's width is excessively stretched due to overly long text.

[0078] In this way, the detection process systematically ensures the comprehensive quality of localized translations in terms of layout, interaction, and visual aspects through screening from primary to secondary and from coarse to fine. It not only accurately identifies all substandard items to ensure user experience, but also efficiently selects high-quality translations that fully comply with technical constraints and design specifications, achieving a balance between quality control and screening efficiency.

[0079] In some specific implementations, overflow of each translation is detected according to a constraint strategy, and a first subset of fit and a first subset of non-fit are determined based on the first detection result, including:

[0080] Get the container corresponding to each translation;

[0081] Create corresponding shadow containers based on the containers corresponding to each translation;

[0082] Each translation is cloned into its corresponding shadow container, and the actual width, actual height, and number of lines of content within the shadow container are detected.

[0083] The first detection result is determined by comparing the actual width of the content with the visible width of the container, the actual height of the content with the visible height of the container, and the number of lines of the content with the number of lines of the container.

[0084] Here, the shadow container is an invisible container with the same style parameters as the original container.

[0085] Specifically, the element is cloned into an invisible container, the same style parameters as the visible container are applied, the translation is rendered in the invisible container, the width, height, and number of lines are measured, and the actual values ​​are compared with the preset values.

[0086] In this way, all potential problems that may lead to overflow, layout misalignment or decreased accessibility can be accurately identified before the actual page update, providing a reliable data basis for automated adaptation decisions and preventing poor translations from damaging real user pages from the source.

[0087] In some specific implementations, semantic rewriting is performed on each misfit translation in the misfit set to obtain a target candidate set, including:

[0088] Perform at least one semantic rewriting on each non-fit translation to obtain at least one candidate translation;

[0089] Based on the linguistic features of each non-adapted translation, determine the priority of the font axis adjustment order;

[0090] Based on priority and in conjunction with the component type corresponding to each unsuitable translation, the font width, weight, optical size and / or font size of at least one candidate translation are adjusted.

[0091] In response to the existence of multiple candidate translations for an unsuitable translation, the length score, line count score, readability score, reachability score, and / or stability score of the multiple candidate translations are obtained through trial ranking.

[0092] Based on length score, line count score, readability score, reachability score and / or stability score, calculate the scores of multiple candidate translations, and select the candidate translation with the highest score as the target candidate translation;

[0093] A target candidate set is generated based on the target candidate translations corresponding to each non-adapted translation.

[0094] In this process, simple non-adaptive translations undergo one semantic rewriting, while complex non-adaptive translations undergo multiple semantic rewritings.

[0095] Specifically, semantic rewriting is performed at least once for each unfit translation in the unfit set according to priority sequence. Each semantic rewriting yields a candidate translation. Each candidate translation is then re-ranked, and the fit score is calculated and readability and accessibility are verified. If the score of each candidate translation does not reach the target score, the process returns to the first step to rewrite the semantics or a fallback template is enabled.

[0096] Here, the font axis can include font width, font weight, optical size, and optimal font size, etc.

[0097] Different non-adaptive translations may correspond to different priorities in the font axis adjustment order.

[0098] Specifically, after the candidate translations are semantically rewritten, the font axis is dynamically adjusted by combining language profiling and container thresholds.

[0099] This further reduces the risk of spillover.

[0100] Here, accessibility refers to the set of requirements and technologies that ensure users with different capabilities can use the product.

[0101] Here, readability refers to the overall degree to which the translated text is easy for users to read, understand, and accept.

[0102] Among them, the length score Sl is higher when the text is shorter; the line count score is higher when there are fewer lines.

[0103] The readability score is calculated by comprehensively considering word frequency, terminology retention, and language profile preferences. The more high-frequency words, the more terminology is retained, and the text style and expression habits need to conform to the cultural preferences and common sentence structures of the target language community, the higher the readability score.

[0104] The accessibility score (Su) is evaluated based on whether the contrast and clickable area decrease. The higher the contrast and the greater the clickable area, the higher the accessibility score.

[0105] Among them, the stability score Sc can be calculated by the influence of CLS. The smaller the influence of CLS, the higher the score.

[0106] Specifically, the score can be calculated using the following formula: FitScore=wlSl+wrSr+waSa+wuSu+wcSc, where wl, wr, wa, wu, and wc are weights configured by the strategy library, and the weights may differ for different components and languages.

[0107] In this way, by using multi-dimensional quantification and configurable weights, and dynamically balancing multiple objectives such as layout efficiency, user experience and performance according to different component types and language characteristics, the solution with the best overall experience in a specific scenario is selected from many qualified candidate translations, thus achieving a decision-making effect that combines refinement and adaptability.

[0108] In one embodiment, after calculating scores for multiple candidate translations, the method further includes:

[0109] Calculate the score difference among multiple candidate translations;

[0110] When the score difference of multiple candidate translations is within a preset range, multiple candidate translations are detected according to the principles of preserving the original meaning and industry terminology, and the target candidate translation is obtained.

[0111] Specifically, when multiple candidate translations have similar scores, a decision can be made based on rules such as "preserving the original meaning first" and "industry terminology first" to obtain the target candidate translation.

[0112] In one embodiment, principles such as prioritizing the preservation of core semantics and industry terminology consistency, prioritizing reversibility, ensuring no loss of semantics, and ensuring no degradation of accessibility may also be included.

[0113] In this way, through multiple semantic rewritings and real-time trial layout feedback, while ensuring readability and accessibility, we explore the best balance between semantic fidelity and page adaptability, and ensure the robustness of the process with a fallback mechanism. This transforms incompatible translations into high-quality translations that meet both language quality and engineering requirements, greatly improving the automation level of localization processing and the reliability of the final output.

[0114] In some specific implementations, each unsuitable translation undergoes at least one semantic rewriting to obtain at least one candidate translation, including:

[0115] Identify and remove lossless semantic segments from the non-adapted translation to obtain the first candidate short text;

[0116] The first candidate short text is subjected to adaptation detection according to the constraint strategy. In response to passing the adaptation detection, the candidate translation is obtained.

[0117] In response to failing the fit test, the complex expressions in the first candidate short text are identified and replaced with synonymous simple expressions to obtain the second candidate short text;

[0118] The second candidate short text is subjected to adaptation detection according to the constraint strategy. In response to passing the adaptation detection, a candidate translation is obtained.

[0119] In response to failing the fit test, a fixed expression in the second candidate short text is identified, and the fixed expression is abbreviated to obtain the third candidate short text;

[0120] The third candidate short text is subjected to adaptation detection according to the constraint strategy. In response to passing the adaptation detection, the candidate translation is obtained.

[0121] In response to failing the adaptability test, the application environment is determined to allow soft line breaks according to the constraint policy. The third candidate short text is then segmented and soft line breaks are performed to obtain the fourth candidate short text.

[0122] The fourth candidate short text is subjected to adaptation detection according to the constraint strategy. In response to passing the adaptation detection, a candidate translation is obtained.

[0123] In response to failing the adaptation test, the fourth candidate short text is processed using a fallback template to obtain a candidate translation.

[0124] Here, lossless semantic fragments can include parentheses, redundant words, and repeated modifications.

[0125] Here, complex expressions can be long words or complex phrases.

[0126] Here, abbreviations can include standard abbreviations of terms, abbreviations of units, abbreviations of dates, and abbreviations of localized expressions.

[0127] Here, hyphenation and soft line breaks are opportunities to enable hyphens and soft line breaks when the environment allows.

[0128] Here, the catch-all template is a phrase template that still needs to express the core semantics in the most limited space (such as "View Details" or "Register Now"), and it works with aria-label / title to provide complete semantics.

[0129] Specifically, semantic rewriting is achieved by using a lightweight language model combined with a local dictionary and abbreviation mapping, while providing remote service degradation and result caching and reuse mechanisms.

[0130] Specifically, after generating candidate translations through redundancy removal, synonym replacement, abbreviation or unit adjustment, word segmentation or soft line breaks, and fallback templates, the process immediately proceeds to trial layout. If the constraints are met, the subsequent steps are stopped; otherwise, the next strategy is continued.

[0131] Specifically, it maintains synonym pairs for phrases, term abbreviation mappings, and unit / date style conversion tables through dictionaries and abbreviation mappings, supports layering by language and business domain, and supports local caching and version control.

[0132] Thus, the semantic rewriting strategy sequence systematically explores the optimal solution for page adaptability by progressively compressing and transforming text from light to heavy, while ensuring the semantic core and readability. Its real-time feedback mechanism ensures the efficiency and minimal intrusion of the processing, achieving a seamless balance from semantic fidelity to strong format adaptation through automated processes.

[0133] In some specific implementations, aggregating the adapter set and target candidate set in the same rendering frame, batch rendering the adapter set and target candidate set, and displaying them includes:

[0134] Determine the container's footprint height based on the containers corresponding to the adaptation set and the target candidate set;

[0135] Based on the placeholder height, the translations in the fit set and target candidate set replace the source text in the container.

[0136] Here, the container's footprint height can include minimum height, skeleton footprint, etc.

[0137] Specifically, a minimum height or skeleton placeholder is set for the container, and only the text is replaced during rendering without adjusting the surrounding structure, thereby maintaining a stable visual baseline.

[0138] Specifically, all text changes within a single language switch or page rendering cycle are aggregated into a batch and submitted in a single rendering frame to avoid cumulative offsets caused by multiple layout settlements.

[0139] In this way, by reducing the number of reflows through batch updates and preventing page jumps by stabilizing the layout structure, the visual instability and performance loss during localized page switching are minimized. This avoids the cumulative performance overhead caused by multiple layout calculations through single-frame submission and suppresses layout offsets during content redrawing from the root through the placeholder strategy.

[0140] In some specific implementations, the method further includes:

[0141] In response to rendering, record end-to-end data during the configuration process and collect page metrics data, including cumulative layout offset, hit area and / or contrast.

[0142] Based on the metric data, determine whether to perform a page rollback;

[0143] Periodically collect rollback rates and adjust the adaptation strategy when the rollback rate exceeds a preset threshold;

[0144] Through gray-scale experiments, the impact of the adjusted adaptation strategy on the entire data chain is evaluated, and it is determined whether to use the adjusted adaptation strategy.

[0145] Here, a gray-scale experiment, also known as an A / B test or gray-scale release, is a method of observing the effects of different approaches by randomly allocating traffic to experimental and control groups. Its core concept is to create a parallel world to compare changes in business metrics between the old and new systems.

[0146] The adaptation strategies may include adjusting strategy weights, updating dictionaries or abbreviation mappings, etc.

[0147] This includes generating a full-link identifier for each adaptation, and obtaining full-link data through the identifier.

[0148] Among them, rollback refers to rolling back to the most recent stable candidate or using a fallback template.

[0149] The record of the entire configuration process includes the original text, translation, rewriting steps, trial layout results, final candidates, submission sequence, CLS value, and whether a rollback was triggered.

[0150] Specifically, the impact of the adjusted adaptation strategy on end-to-end data can be assessed using data such as CLS, click-through rate, and conversion rate.

[0151] Specifically, telemetry data is periodically aggregated, and the weight of aggressive strategies is reduced for components / language combinations with high rollback rates, or dictionary / abbreviation mappings are updated. The impact of new strategies on CLS, click-through rate, and conversion rate can be evaluated through gray-scale experiments. Dictionary / strategy updates are subject to signature and version verification to prevent tampering and improper rewriting.

[0152] Specifically, telemetry data contains only necessary technical indicators and anonymized information, and does not contain user-identifiable content.

[0153] In one embodiment, if a change in the terminal environment is detected (such as window size, font, or breakpoint), the adaptability detection can be triggered again.

[0154] In this way, telemetry, rollback, and strategy optimization mechanisms together form a data-driven closed-loop optimization system. Through full-link monitoring, the system ensures the stability of the online experience in real time, utilizes the automatic rollback mechanism to quickly stop losses and quantify risks, and continuously optimizes strategy weights and rules based on real data. This enables the entire localization adaptation system to have the ability to self-diagnose, quickly self-heal, and continuously evolve.

[0155] In one embodiment, Figure 2 This is a schematic diagram of the overall system architecture in the embodiments of this application, such as... Figure 2 As shown, the overall system architecture in this application includes: a user-side browser / front-end application, a presentation layer, configuration and resources, a strategy library / configuration center, an overflow detection device, a semantic rewriting device, a translation device, a telemetry and monitoring device, a terminal-side model runtime, a rendering control device, and a local cache.

[0156] Specifically, the translation device is used to call on the client-side lightweight model or external translation service during the page rendering process to translate the source text into the target language; it supports batch translation and concurrent queue management, and outputs translation candidates.

[0157] Specifically, the overflow detection device is used to perform adaptability testing on the translation before presentation, and determines whether there is a risk of text overflow or layout misalignment based on container query, scrollWidth / clientWidth comparison, shadow layout or ResizeObserver.

[0158] Specifically, the semantic rewriting device is used to perform semantic length control processing on the translation according to a preset priority strategy when a risk is detected. It sequentially performs redundancy removal, synonym replacement, abbreviation / unit conversion, word segmentation / soft line break, and fallback template generation, and outputs one or more candidate short texts.

[0159] Specifically, the rendering control unit is used to uniformly schedule text submissions, batch replace target short texts to the page within the same browser rendering frame, and avoid generating cumulative layout offsets (CLS) that exceed the threshold; it also supports failure rollback and secondary trial layout.

[0160] Specifically, the strategy library / configuration center is used to maintain rewrite steps, constraints and priorities according to "component type × language features" (including exclusive strategies for components such as buttons, labels, table cells, breadcrumbs, etc., as well as language features such as RTL / LTR, CJK, word segmentation rules, variable font axis, etc.).

[0161] Specifically, the telemetry and monitoring device is used to record and report key indicators of the adaptation process, including rewriting the step chain, time consumption, CLS value, reachability criteria and rollback events, and supports A / B testing and strategy optimization.

[0162] Specifically, the edge model runtime is used to execute a lightweight NLP / rule kernel in the browser using WebAssembly or WebGPU, supporting edge translation and semantic rewriting candidate generation.

[0163] Specifically, the local caching device is used to cache the dictionary, synonym map, abbreviation table, and rewritten results (IndexedDB / memory) to reduce redundant calculations and first-frame latency.

[0164] Specifically, the configuration and resource device is used to manage static resources such as language packs, domain dictionaries, accessibility thresholds, and style / layout restrictions, enabling online updates and canary releases.

[0165] Specifically, the translation device receives the source text and target language code, and outputs the initial translation; it can call the edge model runtime or remote services; the overflow detection device performs layout measurement on the translation before presentation and obtains an adaptation judgment; the semantic rewriting device generates candidate short texts in priority sequence in "incompatible" scenarios; the rendering control device summarizes the submittable items and final candidates, and replaces them in batches within the same rendering frame; the strategy library / configuration center provides rules and thresholds for detection, rewriting and submission; the telemetry and monitoring device records indicators and triggers rollback / optimization; the edge model runtime, local cache and configuration resources provide runtime, reuse and static resource support for translation and rewriting.

[0166] In one embodiment, Figure 3 This is a flowchart illustrating an embodiment of this application, such as... Figure 3As shown, the process in this application includes: runtime translation; temporary storage of translation and generation of a queue to be inspected; whether the adaptability test passes; if it passes, it is added to the submission queue; if it fails, semantic rewriting is performed and trial arrangement is conducted; whether the trial arrangement passes, if not, semantic rewriting is returned, if yes, it is added to the submission queue; single-frame batch submission; telemetry, threshold verification, rollback, and determination of whether environmental changes have occurred, if yes, the adaptability test is returned.

[0167] Specifically, the trigger and context initialization are triggered by page loading or language switching, and the context is as follows: loading the policies and constraints for this session from the policy library / configuration center according to "component type × language features"; loading the thesaurus / abbreviation table / localization rules from configuration and resources. Preheating the client-side model runtime is also performed when necessary.

[0168] Specifically, during the translation phase, the translation device receives the source text set and target language identifiers, and calls the edge model / translation service to generate the translation; this can be done concurrently and in batches. If the edge model is enabled, it is responsible for performing inference at runtime; the generated translation and intermediate features can be cached locally for reuse and latency reduction.

[0169] Specifically, the adaptability pre-check / trial layout is performed by the overflow detection device using shadow trial layout / container query / size measurement without contaminating the visible layout. The output can be a directly submit set (Fit=true) and an unfit set (Fit=false, requiring rewriting). The detection process follows the constraints of the policy library.

[0170] Specifically, the semantic rewriting control is performed by the semantic rewriting device on the "unsuitable set" according to a priority sequence: redundancy removal → synonym replacement → abbreviation / unit → word segmentation / soft line breaks → fallback template. The semantic rewriting device calls the runtime-generated candidate short text when needed; it matches the thesaurus / abbreviation table and writes the valid candidates into the cache.

[0171] Specifically, the secondary ranking and candidate selection are performed by the overflow detection device, which re-ranks each candidate, calculates the Fit Score, and verifies readability / reachability. If the candidate still fails to meet the requirements, the process returns to the semantic rewriting device to continue the next strategy or enables a fallback template. Output: A unique final candidate for each target node.

[0172] Specifically, the single-frame submission process involves the rendering control unit converging all "directly submittable + final candidates" and replacing the text in batches in the next requestAnimationFrame. If necessary, a minimum height / skeleton placeholder is applied to the container to ensure a complete single-frame submission and suppress CLS (Content Streaming). The page code then writes the final text to the DOM / CSSOM, completing a stable rendering.

[0173] Specifically, telemetry and rollback are achieved by telemetry and monitoring devices collecting CLS, latency, policy chains, rollback events, etc. If a threshold is exceeded, a rollback is triggered (the most recent stable candidate / fallback template), and the results are written back for online optimization and A / B testing of the policy library. If ResizeObserver / container query detects environmental changes (window / breakpoint / font), it can re-enter from the adaptability pre-detection to form a self-healing closed loop.

[0174] In one embodiment, Figure 4 This is a schematic diagram of the component-level strategy library structure in the embodiments of this application, such as... Figure 4 As shown, the component-level strategy library structure in this application includes: strategy library, strategy, specific component strategy, and language profile.

[0175] Specifically, the strategy library includes obtaining strategies (component type, language tag). When a specific component (such as a button) needs to be rendered in a specific language (such as Arabic), the system requests the corresponding strategy from the strategy library. Update rules: Allows dynamic updates to the rules in the strategy library, enabling continuous optimization.

[0176] Specifically, the strategy includes the following steps: redundancy removal → synonym replacement → abbreviation / unit replacement → word segmentation / soft line breaks → fallback. Constraints include: maximum number of lines, minimum clickable area, contrast ratio, and CLS threshold.

[0177] Specifically, language features include writing direction: from left to right, from right to left, or the complex direction rules unique to Chinese, Japanese, and Korean; word segmentation and hyphenation rules; localization rules: units / dates / numbers; font preferences: font weight / subwidth / variable font axis.

[0178] Specifically, the component strategies include button strategies, label strategies, table cell strategies, and breadcrumb strategies.

[0179] Specifically, the system needs to render a button in the target language and request a strategy (button, ar) from the strategy library. The strategy library returns a strategy, which contains a sequence of steps for the target language (such as prioritizing RTL layout) and constraints (such as the minimum width of the button). When executing each step of the strategy, the system will refer to the writing direction (RTL) and word segmentation rules of the target language in the language profile. Finally, a button in the target language that is perfectly adapted in terms of layout, functionality and accessibility will be generated.

[0180] In one embodiment, Figure 5 This is a schematic diagram of the single-frame rendering timing in the embodiments of this application, as shown below. Figure 5As shown, the single-frame rendering sequence in this application includes: the rendering layer sends a batch translation request to the translation device; the translation device returns the translation result to be detected to the rendering layer; the rendering layer sends a trial layout or measurement request to the overflow detection; the overflow detection returns an adaptation determination to the rendering layer; in response to incompatibility, the rendering layer sends a semantic rewriting candidate to the semantic rewriting; the semantic rewriting returns a candidate short text to the rendering layer; the rendering layer sends a second trial layout to the overflow detection; the overflow detection returns a pass to the rendering layer; the rendering layer sends an enqueue pending submission to the rendering control; the rendering control returns a single-frame batch replacement rAF (request Animation Frame, browser frame-by-frame scheduling interface) to the rendering layer; and the rendering layer sends a report of CLS / rollback / time consumption to the telemetry.

[0181] It should be understood that, although Figures 1-5 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figures 1-5 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0183] Embodiments of this application also provide a multilingual text adaptive configuration device, comprising: a first processing module 601, configured to receive a translation instruction at page runtime, obtain a source text set, and translate the source text set according to a target language identifier and a constraint strategy to obtain a translation set; a second processing module 602, configured to perform adaptability detection on each translation in the translation set according to the constraint strategy to obtain an adapted set and an unadapted set; a third processing module 603, configured to perform semantic rewriting on each unadapted translation in the unadapted set to obtain a target candidate set; and a fourth processing module 604, configured to aggregate the adapted set and the target candidate set in the same rendering frame, batch render the adapted set and the target candidate set, and display them.

[0184] As a preferred implementation, in this embodiment of the application, the first processing module 601 is specifically used to: determine a translation mode according to terminal capabilities and / or policy requirements, wherein the translation mode includes a first translation mode and a second translation mode; in response to the translation mode being the first translation mode, translate the source text set through the terminal-side model runtime to obtain a translation set; in response to the translation mode being the second translation mode, translate the source text set through a remote translation service and receive the translation set.

[0185] In a preferred embodiment of this application, the device further includes a strategy module, which is specifically used to: determine a first strategy condition based on the component type corresponding to each translation, wherein the first strategy condition is a functional and structural condition; determine a second strategy condition based on the linguistic features corresponding to each translation, wherein the second strategy condition is a linguistic and typographical condition; and determine a constraint strategy corresponding to each translation based on the first and second strategy conditions.

[0186] In a preferred embodiment of this application, the second processing module 602 is specifically used for: detecting whether each translation overflows according to a constraint strategy; determining a first sub-adaptation set and a first sub-non-adaptation set according to a first detection result; detecting whether the size of the container corresponding to each translation in the first sub-adaptation set is within a preset safe size range according to a constraint strategy; determining a second sub-adaptation set and a second sub-non-adaptation set according to a second detection result; determining a non-adaptation set based on the first sub-non-adaptation set and the second sub-non-adaptation set; and using the second sub-adaptation set as the adaptation set.

[0187] As a preferred implementation, in this embodiment of the application, the second processing module 602 is further configured to: obtain the container corresponding to each translation; create a corresponding shadow container based on the container corresponding to each translation; clone each translation into the corresponding shadow container; detect the actual width, actual height, and number of lines of content in the shadow container; compare the actual width of content with the visible width of the container, the actual height of content with the visible height of the container, and the number of lines of content with the number of lines of the container to determine the first detection result.

[0188] In a preferred embodiment of this application, the third processing module 603 is specifically used for: performing at least one semantic rewriting on each non-adapted translation to obtain at least one candidate translation; determining the priority of the font axis adjustment order based on the language features corresponding to each non-adapted translation; adjusting the font width, font weight, optical size, and / or font size of the at least one candidate translation based on the priority and the component type corresponding to each non-adapted translation; in response to the existence of multiple candidate translations for the non-adapted translation, obtaining the length score, line count score, readability score, accessibility score, and / or stability score of multiple candidate translations through trial sorting; calculating the score of multiple candidate translations based on the length score, line count score, readability score, accessibility score, and / or stability score, and selecting the candidate translation with the highest score as the target candidate translation; and generating a target candidate set based on the target candidate translations corresponding to each non-adapted translation.

[0189] In a preferred embodiment of this application, the third processing module 603 is further configured to: identify and delete lossless semantic segments in the unsuitable translation to obtain a first candidate short text; perform adaptation detection on the first candidate short text according to a constraint strategy, and obtain a candidate translation in response to passing the adaptation detection; in response to failing the adaptation detection, identify complex expressions in the first candidate short text, replace the complex expressions with synonymous simple expressions, and obtain a second candidate short text; perform adaptation detection on the second candidate short text according to a constraint strategy, and obtain a candidate translation in response to passing the adaptation detection; in response to failing the adaptation detection, Identify fixed expressions in the second candidate short text, abbreviate these expressions to obtain the third candidate short text; perform an adaptation test on the third candidate short text according to a constraint policy; if the adaptation test passes, obtain the candidate translation; if the adaptation test fails, determine whether the application environment allows soft line breaks according to the constraint policy, and perform word segmentation and soft line breaks on the third candidate short text to obtain the fourth candidate short text; perform an adaptation test on the fourth candidate short text according to the constraint policy; if the adaptation test passes, obtain the candidate translation; if the adaptation test fails, process the fourth candidate short text using a fallback template to obtain the candidate translation.

[0190] As a preferred implementation, in this embodiment of the application, the fourth processing module 604 is specifically used to: determine the placement height of the container according to the containers corresponding to the adaptation set and the target candidate set; and replace the source text in the container with the translation in the adaptation set and the target candidate set according to the placement height.

[0191] In a preferred embodiment of this application, the device further includes a fifth processing module, which is specifically used for: recording end-to-end data during the configuration process and collecting page metrics data in response to rendering, wherein the metrics data includes cumulative layout offset, hit area and / or contrast; determining whether to perform page rollback based on the metrics data; periodically collecting rollback rate, and adjusting the adaptation strategy when the rollback rate is higher than a preset threshold; and evaluating the impact of the adjusted adaptation strategy on the end-to-end data through grayscale experiments to determine whether to use the adjusted adaptation strategy.

[0192] For a description of the features in the embodiment corresponding to the multilingual text adaptive configuration device, please refer to the relevant description in the embodiment corresponding to the multilingual text adaptive configuration method, which will not be repeated here.

[0193] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above embodiments of the multilingual text adaptive configuration method.

[0194] This electronic device can be a server, and its internal structure diagram can be as follows: Figure 7 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores multilingual text adaptive configuration data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a multilingual text adaptive configuration method.

[0195] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above embodiments of the multilingual text adaptive configuration method at runtime.

[0196] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0197] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the multilingual text adaptive configuration method.

[0198] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the multilingual text adaptive configuration method.

[0199] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0200] The foregoing has provided a detailed description of a multilingual text adaptive configuration method, electronic device, storage medium, and computer program product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to aid in understanding the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A multilingual text adaptive configuration method, characterized in that, The method includes: In response to receiving a translation instruction at page runtime, the source text set is obtained, and the source text set is translated according to the target language identifier and constraint policy to obtain a translation set; Based on the constraint strategy, the adaptability of each translation in the translation set is detected to obtain the adapted set and the unadapted set. Semantically rewrite each unfitted translation in the unfitted set to obtain the target candidate set; Aggregate the adaptation set and the target candidate set in the same rendering frame, batch render the adaptation set and the target candidate set and display them; The step of performing adaptability testing on each translation in the translation set according to the constraint strategy to obtain an adapted set and an unadapted set includes: Based on the constraint strategy, detect whether each translation overflows, and based on the first detection result, determine the first sub-adaptation set and the first sub-non-adaptation set; Based on the constraint strategy, detect whether the size of the container corresponding to each translation in the first sub-adaptation set is within the preset safe size range, and determine the second sub-adaptation set and the second sub-non-adaptation set based on the second detection result; Based on the first sub-adaptive set and the second sub-adaptive set, the non-adaptive set is determined, and the second sub-adaptive set is used as the adaptive set. The step of detecting whether each translation overflows according to the constraint strategy, and determining the first sub-adaptation set and the first sub-non-adaptation set according to the first detection result, includes: Get the container corresponding to each translation; Create corresponding shadow containers based on the containers corresponding to each translation; Each translation is cloned into its corresponding shadow container, and the actual width, actual height, and number of lines of content in the shadow container are detected. The first detection result is determined by comparing the actual width of the content with the visible width of the container, the actual height of the content with the visible height of the container, and the number of lines of the content with the number of lines of the container.

2. The multilingual text adaptive configuration method according to claim 1, characterized in that, The process involves receiving a translation instruction at page runtime, obtaining a set of source texts, translating the source texts according to the target language identifier and constraint policy, to obtain a set of translated texts, including: The translation mode is determined based on the terminal capabilities and / or policy requirements, wherein the translation mode includes a first translation mode and a second translation mode; In response to the translation mode being the first translation mode, the source text set is translated by the terminal model at runtime to obtain the translated text set; In response to the translation mode being the second translation mode, the source text set is translated through a remote translation service, and the translated text set is received.

3. The multilingual text adaptive configuration method according to claim 1, characterized in that, The method further includes: Based on the component type corresponding to each translation, the first strategy condition is determined, wherein the first strategy condition is a functional and structural condition; Based on the linguistic features corresponding to each translation, the second strategy conditions are determined, wherein the second strategy conditions are linguistic and typesetting conditions; Based on the first and second strategy conditions, determine the constraint strategy corresponding to each translation.

4. The multilingual text adaptive configuration method according to claim 1, characterized in that, The semantic rewriting of each unfitted translation in the unfit set to obtain the target candidate set includes: Perform at least one semantic rewriting on each non-fit translation to obtain at least one candidate translation; Based on the linguistic features corresponding to each non-adapted translation, the priority of the font axis adjustment order is determined; Based on the priority and in conjunction with the component type corresponding to each unsuitable translation, the font width, weight, optical size and / or font size of at least one candidate translation are adjusted. In response to the existence of multiple candidate translations for the unsuitable translation, the length score, line count score, readability score, reachability score and / or stability score of the multiple candidate translations are obtained through trial ranking; Based on the length score, the number of lines score, the readability score, the accessibility score, and / or the stability score, the scores of the multiple candidate translations are calculated, and the candidate translation with the highest score is selected as the target candidate translation. The target candidate set is generated based on the target candidate translations corresponding to each non-adapted translation.

5. The multilingual text adaptive configuration method according to claim 4, characterized in that, The step of performing at least one semantic rewriting on each unsuitable translation to obtain at least one candidate translation includes: Identify and remove lossless semantic segments from the non-adapted translation to obtain the first candidate short text; The first candidate short text is subjected to adaptation detection according to the constraint strategy, and the candidate translation is obtained in response to passing the adaptation detection; In response to failing the adaptability detection, complex expressions in the first candidate short text are identified, and the complex expressions are replaced with synonymous simple expressions to obtain the second candidate short text; The second candidate short text is subjected to the adaptation detection according to the constraint strategy, and the candidate translation is obtained in response to passing the adaptation detection; In response to failing the adaptability detection, a fixed expression in the second candidate short text is identified, and the fixed expression is abbreviated to obtain a third candidate short text; The third candidate short text is subjected to the adaptation detection according to the constraint strategy, and the candidate translation is obtained in response to passing the adaptation detection; In response to failing the adaptability test, based on the constraint strategy, if the application environment allows soft line breaks, the third candidate short text is segmented and soft line breaks are performed to obtain the fourth candidate short text. The fourth candidate short text is subjected to the adaptation detection according to the constraint strategy, and the candidate translation is obtained in response to passing the adaptation detection; In response to failing the adaptability test, the fourth candidate short text is processed using a fallback template to obtain the candidate translation.

6. The multilingual text adaptive configuration method according to claim 1, characterized in that, The aggregation of the adapter set and the target candidate set in the same rendering frame, batch rendering and displaying the adapter set and the target candidate set includes: The occupancy height of the container is determined based on the containers corresponding to the adaptation set and the target candidate set; Based on the placeholder height, the translations in the adapter set and the target candidate set replace the source text in the container.

7. The multilingual text adaptive configuration method according to claim 1, characterized in that, The method further includes: In response to rendering, record end-to-end data during the configuration process and collect page metrics data, including cumulative layout offset, hit area and / or contrast. Based on the aforementioned metric data, determine whether to perform a page rollback; Periodically collect rollback rates and adjust the adaptation strategy when the rollback rate exceeds a preset threshold; The impact of the adjusted adaptation strategy on the end-to-end data is evaluated through gray-scale experiments to determine whether the adjusted adaptation strategy should be used.

8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the multilingual text adaptive configuration method as described in any one of claims 1 to 7 when executing the computer program.

Citation Information

Patent Citations

  • Vehicle multi-language adaptive translation method, device and equipment and storage medium

    CN119940378A