Application resource package configuration method and apparatus, electronic device, and storage medium
Patent Information
- Application Number
- CN202610918381.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-10-13
AI Technical Summary
以及翻译周期与应用开发周期难以解耦
本申请方案提供的应用资源配置方法中,系统先获取目标应用的资源ID映射表,该资源ID映射表中记录有各资源项与资源ID的对应关系,且同一资源项在不同应用版本的资源ID保持一致;从翻译管理系统获取目标语种的翻译内容,该翻译内容通过全局唯一标识符UUID与对应的资源项建立关联;根据获得的资源ID映射表和翻译内容,确定各翻译内容对应的资源ID,将该翻译内容和对应的资源ID编译生成二进制资源索引文件;该二进制资源索引文件中各翻译内容的资源ID与目标应用中对应资源项的资源ID一致,进而应用可以通过该资源ID获取翻译内容;在生成二进制索引文件以后,将二进制资源索引文件封装为外置资源包,部署至车机端该应用指定的加载目录,以使应用可以通过该指定目录查找该外置资源包;进而,本实施例实现了将应用业务本体与语言文本的解耦分离,极大降低了研发迭代复杂度与OTA分发流量消耗,并且在语言翻译更新或者替换工作时,因为可以直接在外置资源包进行操作,具有极大的便利性和高效性,具有可扩展和易维护的优点。
Smart Images

Figure CN122903032A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent driving technology, and in particular to an application resource package configuration method, apparatus, electronic device and storage medium. Background Technology
[0002] Against the backdrop of rapid development in intelligent driving technology, in-vehicle systems, as the core carrier of human-machine interaction, undertake key functions such as displaying driving status, providing assisted driving prompts, presenting navigation information, and facilitating multimodal interaction. With the global deployment of intelligent driving products, in-vehicle application software needs to support an increasing number of languages to meet the interaction needs of users in different countries and regions.
[0003] In existing multilingual implementations of in-vehicle infotainment systems, language resources are typically compiled as part of the application resource files along with the business code and released on the Android platform along with the application installation package. Multilingual resources are usually maintained as resource files in a resource qualifier directory, compiled together with the business code, and released with the application installation package (APK, Android Package Kit). Currently, several technical solutions exist for Android multilingual translation and updates. For example, solutions include exporting the string to be translated and re-importing it into the target language directory after translation; or exporting, comparing, and writing back the code based on an Excel translation comparison table.
[0004] However, the above solutions mainly focus on source code translation and processing, and still have the following technical problems: Strong coupling between multilingual resources and the application ontology. Revising any language term requires recompiling the entire APK and redeploying, resulting in coarse-grained updates. Furthermore, the translation cycle is difficult to decouple from the application development cycle. In scenarios with multiple business lines operating in parallel, the translation progress of each language is inconsistent, and the development team must wait for all translation results to be returned before final packaging, making the translation cycle a delivery bottleneck. Summary of the Invention
[0005] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides an application resource package configuration method, apparatus, electronic device and storage medium.
[0006] Firstly, this application provides an application resource package configuration method, including: Obtain the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions. The translation content in the target language is obtained from the translation management system, and the translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID). Based on the resource ID mapping table and the translated content, each translated content and its corresponding resource ID are extracted, and a binary resource index file is generated. The resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application. The binary resource index file is packaged into an external resource package and deployed to the loading directory specified by the application on the vehicle-mounted system.
[0007] In one possible implementation of this application, the method further includes: In advance, a globally unique identifier (UUID) is assigned to the target language terms that the application needs to externalize in the translation management system. The target language terms include the initial content of the terms. The UUID is used to identify the target language terms. The corresponding translation content of the target language terms is associated with the corresponding resource items through the UUID.
[0008] In one possible implementation of this application, the step of pre-assigning a globally unique identifier (UUID) to the target language terms required by the application in the translation management system includes: The translation management system matches the target language terms with the read XML main language file; wherein, the XML main language file stores all the string resources of the application; If a match is found, a universally unique identifier (UUID) is automatically generated and added, and a new XML file is generated. Save the updated XML file to the source file.
[0009] In one possible implementation of this application, the step of obtaining the target language translation content from the translation management system, wherein the translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID), includes: Based on the application version information, obtain the resource file of the target application corresponding to the version, and the resource file carries the globally unique identifier UUID; Based on the UUID and language information in the resource file, the translation content in the target language is obtained from the translation management system.
[0010] In one possible implementation of this application, the method further includes: During the Application.attachBaseContext() initialization phase, the application searches for and loads the external resource package according to the directory, and then retrieves and displays the translated content.
[0011] In one possible implementation of this application, the method further includes: If the application fails to load the external resource package or fails to obtain the translated content, it will revert to matching and reading the built-in resources of the application installation package.
[0012] In one possible implementation of this application, the resource ID mapping table is generated and maintained in the following manner: When compiling the installation package of the target application, the stable-ids parameter of the Android resource compilation tool AAPT2 is called, and the historical resource ID mapping table is used as the compilation input, so that the existing resource items continue to use the original resource IDs, and the newly added resource items are assigned new resource IDs that are not occupied. After compilation, the updated resource ID mapping table is output via the output resource ID parameter emit-ids.
[0013] In one possible implementation of this application, the step of extracting each translated content and its corresponding resource ID based on the resource ID mapping table and the translated content, and compiling to generate a binary resource index file, includes: By matching the resource names in the translated content with the resource ID mapping table, each translated content and its corresponding resource ID are determined, thus completing the binding of the translated content with the corresponding resource ID; wherein, the ID mapping table stores the mapping relationship between the resource names and resource IDs; The translated content bound to the resource ID is compiled into binary format and written into the resources.arsc file.
[0014] In one possible implementation of this application, when the translation content of existing target language terms in the translation management system is updated, the target application does not need to be recompiled. The method further includes: The updated translation content is obtained from the translation management system based on the globally unique identifier (UUID) corresponding to the target language term; The updated translation content is bound to the corresponding resource ID according to the resource ID mapping table, and the updated external language pack is compiled and generated. The updated external language pack is deployed to the vehicle's infotainment system, replacing the original external language pack of the target application.
[0015] Secondly, this application provides an application resource package configuration device, comprising: The first acquisition module is used to acquire the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions. The second acquisition module is used to acquire translation content in the target language from the translation management system. The translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID). The compilation module is used to extract each translated content and its corresponding resource ID according to the resource ID mapping table and the translated content, and compile it to generate a binary resource index file; the resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application; The encapsulation and deployment module is used to encapsulate the binary resource index file into an external resource package and deploy it to the loading directory specified by the application on the vehicle terminal.
[0016] Thirdly, this application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the application resource package configuration method described in any of the first aspects.
[0017] Fourthly, this application provides a computer-readable storage medium storing a program for an application resource package configuration method, wherein when the program for the application resource package configuration method is executed by a processor, it implements the steps of the application resource package configuration method described in any of the first aspects.
[0018] The beneficial effects of this invention are: In the application resource configuration method provided in this application, the system first obtains a resource ID mapping table for the target application. This resource ID mapping table records the correspondence between each resource item and its resource ID, and the resource ID of the same resource item remains consistent across different application versions. Next, it obtains translated content in the target language from a translation management system. This translated content is associated with its corresponding resource item using a globally unique identifier (UUID). Based on the obtained resource ID mapping table and the translated content, it determines the resource ID corresponding to each translated content and compiles the translated content and its corresponding resource ID into a binary resource index file. The resource ID of each translated content in the binary resource index file is then compared with the target application's resource ID. The resource IDs of the corresponding resource items in the application are consistent, and the application can obtain the translated content through the resource ID. After generating the binary index file, the binary resource index file is packaged into an external resource package and deployed to the loading directory specified by the application on the vehicle terminal, so that the application can find the external resource package through the specified directory. Thus, this embodiment achieves the decoupling and separation of the application business ontology and language text, which greatly reduces the complexity of R&D iteration and OTA distribution traffic consumption. Moreover, when updating or replacing language translations, it can be operated directly in the external resource package, which has great convenience and efficiency, and has the advantages of scalability and easy maintenance. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating an application resource package configuration method provided in one embodiment of this application; Figure 2 This is a schematic diagram of the resource ID mapping table generation process provided in an embodiment of this application; Figure 3 A flowchart illustrating an application resource package configuration method provided in another specific embodiment of this application; Figure 4 A schematic diagram illustrating the process of assigning UUIDs to target language terms according to an embodiment of this application; Figure 5 A flowchart illustrating an application resource package configuration method provided in yet another specific embodiment of this application; Figure 6A flowchart illustrating an application resource package configuration method as provided in yet another specific embodiment of this application; Figure 7 This application provides a schematic diagram illustrating the functional implementation module interaction of an application resource package configuration method according to a specific embodiment. Figure 8 A schematic diagram illustrating the process of updating the translation content of existing target language terms according to an embodiment of this application; Figure 9 This is a schematic diagram of the structure of an application resource pack configuration device provided in an embodiment of this application; Figure 10 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] In the existing multilingual implementation of in-vehicle infotainment system software, resources and business code for each language are compiled together and released with the APK (Android Package Kit). When it is necessary to revise any language entry, such as adjusting Arabic parking prompts for the Middle Eastern market or adding Thai navigation guidance for the Southeast Asian version, the entire in-vehicle application installation package needs to be recompiled and redistributed. This method has coarse-grained updates, high release costs, and a large testing scope.
[0024] Furthermore, in traditional build processes, resource compilation tools reallocate resource IDs based on the current compilation input. When the order of resource items changes, resources are added or deleted, or the module merging method changes, the resource IDs of historical resource items may drift, causing independently compiled language packs to fail to form a stable match with older APK versions. This problem is particularly prominent in the specific application scenarios of vehicle internationalization: different batches of exported vehicles may run different versions of APKs. If the resource IDs in the external language pack do not match the older APK version, runtime resource addressing errors will occur, leading to the display of incorrect language text on the dashboard or central control screen, and even causing interface functions to malfunction, directly affecting driving safety.
[0025] Based on this, embodiments of this application provide an application resource configuration method, apparatus, device, and storage medium.
[0026] The technical solution of this application will be described in detail below through specific embodiments.
[0027] Figure 1 A flowchart illustrating an application resource package configuration method provided in one embodiment of this application; see also... Figure 1 As shown, this embodiment provides an application resource package configuration method, including the following steps S10-S40: S10. Obtain the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions.
[0028] In this embodiment, the system pulls the strings.xml file and stable-ids.txt file corresponding to the target application version from the file server by building a process business CI / CD. The stable-ids.txt file contains a resource ID mapping table, which records the correspondence between each resource item and the resource ID.
[0029] In this embodiment, strings.xml is the default language resource file of the App, which contains the term name, translation content, and UUID used to bind to the translation management platform; stable-ids.txt is a resource ID fixed file generated and continuously maintained by the Android build tool AAPT2, which is used to record the fixed mapping relationship between resource name and resource ID.
[0030] For example, the contents of the resource ID mapping table above are as follows: com.vehicle.media:string / btn_auto_park= 0x7f010001; com.vehicle.media:string / btn_stop = 0x7f010002; com.vehicle.media:string / btn_play= 0x7f010003; com.vehicle.media:string / btn_pause= 0x7f010004.
[0031] Figure 2 This is a schematic diagram of the resource ID mapping table generation process provided in an embodiment of this application; see reference. Figure 2 As shown, the above resource ID mapping table is generated through the following steps S201-S202: S201. When compiling the installation package of the target application, the system calls the stable-ids parameter of the AAPT2 compilation tool, takes the historical resource ID mapping table as the compilation input, so that existing resource items continue to use the original resource ID, and new resource items are assigned new resource IDs that are not occupied.
[0032] S202. After compilation, the updated resource ID mapping table is output through the output resource ID parameter emit-ids.
[0033] In this embodiment, the system build script checks whether a historical version of the stable-ids.txt file already exists in the project root directory before compilation. If it exists, it enters incremental compilation mode; if it does not exist, it enters initial compilation mode.
[0034] In incremental compilation mode, the historical stable-ids.txt is used as compilation input, and AAPT2 follows the following allocation rules during the compilation process: For existing resource items in stable-ids.txt, such as com.vehicle.media:string / btnautopark = 0x7f010001, their original resource IDs will be forcibly retained and will not be reassigned. For newly added resource items, a new ID will be assigned in the unoccupied resource ID space. For deleted resource items, their historical records in stable-ids.txt will be retained (placeholder records), and these resource IDs will not be reclaimed or reassigned to other resource items to avoid addressing ambiguity caused by subsequent reuse.
[0035] In a preferred embodiment, after compilation, AAPT2 outputs the complete resource ID allocation result, output-ids.txt, via the --emit-ids parameter. The build script automatically executes the append-only logic: it merges the new entries in output-ids.txt with the historical stable-ids.txt (using the resource name as the primary key and retaining existing resource ID allocations), sorts them, and overwrites them in stable-ids.txt. The merged file is automatically committed back to the version control repository (e.g., Gerrit) as input for the next compilation (i.e., the historical stable-ids.txt).
[0036] In the initial compilation mode, since there is no historical stable-ids.txt during the first compilation, AAPT2 freely allocates resource IDs. After compilation, the resource ID allocation result is output as the initial stable-ids.txt through the --emit-ids parameter.
[0037] In this embodiment, the `--stable-ids` parameter forces AAPT2 to use historical resource IDs, ensuring that the source ID of the same resource item remains consistent across different application versions. For example, regardless of how many iterations the application undergoes, the resource ID corresponding to the term "automatic parking" remains 0x7f010001, unaffected by the addition, deletion, or reordering of other terms. This provides a fundamental guarantee for cross-version compatibility between external language packs and the host APK. Furthermore, the append-only strategy ensures backward compatibility; the resource IDs of deleted terms are permanently retained as placeholders and will not be reclaimed or reallocated. This ensures that external language packs compiled for any historical version of the APK can be correctly addressed on the corresponding version, without ID conflicts or addressing ambiguities.
[0038] S20. Obtain the translation content in the target language from the translation management system. The translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID).
[0039] In one embodiment of this application, step S20, obtaining the translated content of the target language from the translation management system, wherein the translated content is associated with the corresponding resource item through a globally unique identifier (UUID), specifically includes the following steps A10-A20: Step A10: Obtain the resource file of the target application corresponding to the application version based on the application version information. The resource file carries the globally unique identifier UUID.
[0040] Step A20: Obtain the translation content in the target language from the translation management system based on the UUID and language information in the resource file.
[0041] In the scenario of building multilingual packages for in-vehicle infotainment systems, multiple versions of the same application may be deployed simultaneously on different batches of exported vehicles, with different versions corresponding to different sets of terms. If the obtained translation content is not aligned with the specific APK version, the following problems may occur: (1) Directly pull translations from TMS by application package name and language. The term set returned by TMS is inconsistent with the actual term contained in the target version APK. For example, V2.0 added the translation of the term "voice assistant", but this translation was incorrectly used to compile the language pack for V1.0. The resource ID corresponding to this term does not exist in the V1.0 APK, resulting in redundant translation content or even addressing conflicts. (2) The strings.xml in the source code repository may have been modified in subsequent iterations. If the source code is used directly instead of the snapshot at the time of compilation, the list of UUIDs pulled may be inconsistent with the actual term in the deployed APK.
[0042] Therefore, this embodiment describes the complete chain of obtaining target language translation content from TMS. This chain occurs in the "language pack compilation task" stage of the CI / CD pipeline, and specifically includes, for example: When the CI / CD pipeline triggers a language pack build task, the target ROM version is specified (e.g., "2025Q2 Middle East version ROM compiled language pack"). The build system retrieves the strings.xml file generated by compiling the APK of that version from the file server based on the application package name com.vehicle.media and the version information 2.1.0.
[0043] The contents of the strings.xml file mentioned above are as follows: <string name="btn_auto_park" trans:uuid="550e8400-e29b-41d4-a716-446655440000">Automatic parking < / string; <string name="btn_stop" trans:uuid="550e8400-e29b-41d4-a716-446655440001"> stop< / string> .
[0044] It is important to emphasize that this strings.xml file is not the latest version from the source code repository, but rather a compile-time snapshot that is automatically uploaded and archived when the APK compilation task is completed. Each string resource in this file carries a UUID attribute.
[0045] This step ensures that the list of UUIDs used for translation requests is strictly consistent with the set of terms in the deployed APK, rather than being mixed with the latest development version in the source code repository.
[0046] The system extracts all UUIDs from the obtained strings.xml file and sends them along with language information to the Translation Management System (TMS). TMS uses the UUIDs as the core index to accurately match the multilingual translation records for each term in its internal database, and returns the translated content in batches by language.
[0047] For example, when the system requests a translation in English (en), TMS matches and returns the UUIDs one by one from the list. UUID-ResourceName-EnglishTranslation: 550e8400-e29b-41d4-a716-446655440000-btn_auto_park-Auto Park; 550e8400-e29b-41d4-a716-446655440001-btn_stop-Stop.
[0048] In this embodiment, a snapshot of the strings.xml file corresponding to the corresponding version is obtained through version information, rather than the latest version from the source code repository. This ensures that the UUID list used for translation requests is strictly consistent with the terminology set of the deployed APK, avoiding translation redundancy or addressing conflicts caused by cross-version mixing. TMS uses UUID as the primary key for queries, rather than resource names or version numbers, ensuring that even if the resource name changes, as long as the UUID remains the same, it can still accurately link to historical translation records, preventing translation assets from being lost or duplicated. Furthermore, since TMS only cares about UUIDs and languages, not APK versions, the management of translation assets and APK iterations are conducted independently, supporting parallel compilation of external language packs for multiple versions without interference. Moreover, when different batches of vehicles run different versions of the APK, the corresponding external language packs can be independently compiled and distributed for each version without interference.
[0049] S30. Based on the resource ID mapping table and the translated content, extract each translated content and its corresponding resource ID, and compile to generate a binary resource index file; the resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application.
[0050] In one embodiment of this application, step S30, which involves determining the resource ID corresponding to each translated content based on the resource ID mapping table and the translated content, and compiling to generate a binary resource index file, specifically includes the following steps B10-B20: Step B10: By matching the resource names in the translated content with the resource ID mapping table, the translated content is bound to the corresponding resource ID; wherein, the ID mapping table stores the mapping relationship between the resource names and resource IDs; Step B20: Compile the translated content bound to the resource ID into binary format and write it into the resources.arsc file.
[0051] For example, the translation content returned by TMS is organized by resource name as an index. The build system matches these resource names one by one with the mapping relationship in stable-ids.txt. stable-ids.txt records the correspondence of "package name:type / resource name=resource ID". During matching, the resource name in the translation content is compared with the resource name part of "package name:type / resource name" in stable-ids.txt to extract the corresponding resource ID.
[0052] Therefore, in this embodiment, the resource names in the obtained translations of each language are matched with the resource name-resource ID mapping relationship in the resource ID mapping table in stable-ids.txt, and the corresponding resource ID is bound to each piece of translation content.
[0053] Taking English translation as an example, the matching process is shown in Table 1 below:
[0054] Table 1 After the binding is completed, the system calls the AAPT2 compilation tool to compile the translated content of the bound resource ID into binary format and write it into the resources.arsc file, thereby obtaining the binary resource index file.
[0055] Specifically, during the compilation process, the `stable-ids` parameter specifies a resource ID mapping file, ensuring that AAPT2 strictly allocates resources according to the specified IDs, rather than reassigning new IDs. After compilation, the generated resource index file `resources.arsc` contains translated binary data indexed by resource IDs. Its internal structure is completely consistent with the resource table format built into the APK, and it can be directly parsed and loaded by the Android runtime's ResourceLoader.
[0056] For example, the resource ID for the English translation "Auto Park" in resources.arsc is 0x7f010001, which is exactly the same as the resource ID for the original Chinese text of "Auto Park" in the host APK. Therefore, when the application queries this term by resource ID at runtime, whether in the APK's built-in resource table or in an external language pack, it can correctly locate the corresponding language translation content using the same resource ID, achieving cross-package resource ID alignment.
[0057] Furthermore, in this embodiment, since the external language pack adopts the resources.arsc standard format and utilizes the native Android resource table format, it can be directly parsed by the Android runtime's ResourcesLoader without requiring custom parsing logic, thus reducing implementation complexity and compatibility risks. S40. The binary resource index file is packaged into an external resource package and deployed to the loading directory specified by the application on the vehicle terminal.
[0058] In this embodiment, the system encapsulates the compiled resources.arsc file into an external resource package according to the standard directory structure. For example, the directory structure uses the application package name as the subfolder identifier. All external language packages of related business APPs are finally integrated into a standard ZIP compressed package for distribution by the OTA platform.
[0059] After receiving the OTA update, the vehicle's infotainment system decompresses the language pack and saves it to the specified directory / data / local / langpack / . Each application can then find the corresponding external language pack by its own package name.
[0060] Further, in this embodiment, the compilation dependency between multilingual resources and the application body is decoupled, so that updating the translated content no longer requires recompiling the entire APK, and it is only necessary to independently compile the external language pack and deliver it via OTA, which significantly reduces the update granularity and release cost. Secondly, the compilation process is constrained by the resource ID mapping table, ensuring that the resource ID of each translated content in the external language pack is completely consistent with the resource ID of the corresponding resource item in the host APK, avoiding addressing errors, display abnormalities or function failures caused by resource ID drift, thereby ensuring the cross-version resource addressing consistency between the external language pack and the host APK.
[0061] Further, in the specific implementation process, this solution realizes the parallelization of the translation process and the development process. The development team only needs to pre-embed the original Chinese text and UUID in the source code, and the translation platform can complete the translation of each language asynchronously. The translation cycle no longer blocks APK compilation and release, which greatly improves the delivery efficiency in the scenario where multiple business lines operate in parallel.
[0062] Figure 3 is a flowchart of an application resource package configuration method provided by another specific embodiment of the present application; with reference to Figure 2 as shown, in the embodiment of the present application, the above method further includes the following step S10': S10', pre-assign a globally unique universal identifier (UUID) for the target language entries that need to be externalized by the application in the translation management system, where the UUID is used to identify the target language entry, and the corresponding translated content of the target language entry is associated with the corresponding resource item through the UUID.
[0063] In this embodiment, in the preliminary preparation stage of application development, when a product personnel creates a target language entry in the translation management platform TMS, the TMS automatically assigns a globally unique and permanently immutable UUID to each entry.
[0064] For example, taking the creation of the "Auto Parking" entry as an example, the product personnel enters the following content in the TMS: Original text (Chinese): 自动泊车; Language: English; Translation: Auto Park.
[0065] TMS automatically assigns UUID: 550e8400-e29b-41d4-a716-446655440000.
[0066] Further, the content record as shown in Table 2 below can be obtained as an example:
[0067] Table 2 Figure 4 is a schematic flowchart of assigning a UUID to a target language entry provided by an embodiment of the present application; with reference to Figure 4 As shown, the above step S10′, which involves pre-assigning a globally unique identifier (UUID) to the target language terms that the application needs to externalize in the translation management system, specifically includes the following steps S401-S403: S401. In the UUID injection tool, the target language terms exported by the translation management system are matched with the read XML main language file; wherein, the XML main language file stores all the string resources of the application.
[0068] S402. If a match is successful, the Universally Unique Identifier (UUID) assigned by the translation management system is added to the successfully matched term, and a new XML file is generated.
[0069] S403. Save the new XML file to the source file.
[0070] For projects with a large number of ongoing or existing historical projects, the number of existing entries may reach hundreds or even thousands. If developers are required to declare namespaces and manually add UUID attributes to each one in an XML file, the manual operation is extremely inefficient, prone to errors, and has high maintenance costs.
[0071] This embodiment provides an automated UUID injection tool to achieve low-cost and highly reliable integration of existing project code. The tool includes components such as a user interface UUIDGeneratorView, a controller UUIDGeneratorController, a UUID generation processor, an XML file processor xmlhandler, and an Excel parser excelparser.
[0072] For example, the specific process is as follows: On the UUIDGeneratorView interface, the user selects an Excel file exported from TMS. This Excel file contains the original text of the entry, a list of UUIDs assigned by TMS, and the directory path of the Android project's resource files.
[0073] The excel_parser component parses the Excel file, extracts the original text and UUID of each term, and forms a TMS term list, as shown in Table 3 below:
[0074] Table 3 The xml_handler component locates values / strings.xml (the main language resource file, which stores all string resources for the application) in the Android project directory and reads its XML content. For example, the content of this file might be: <resources> <string name="btn_auto_park"> Automatic parking< / string> <string name="btn_stop"> stop< / string> < / resources> .
[0075] The UUID generation processor matches the original text in the TMS term list with the term text in strings.xml one by one. For successfully matched terms, it automatically adds the UUID assigned by TMS to the corresponding term using the custom XML namespace attribute trans:uuid. <string>Within the element, new XML content (a new XML file) is generated.
[0076] The xml_handler writes the updated XML content (the new XML file) back to the values / strings.xml source file, overwriting the original content.
[0077] The xml_handler continues to traverse the strings.xml files in other language directories such as values-en / and values-ja / , adding the same UUID attribute to entries with the same resource name to ensure that the UUID of the same entry is consistent in all language versions of strings.xml.
[0078] In this embodiment, the automated matching and injection process avoids problems such as missed bindings, UUID spelling errors, or duplicate allocations that may occur with manual operations, ensuring consistency between all entries and the TMS. Furthermore, by synchronizing UUIDs to strings.xml in all language versions, it ensures that the UUIDs of the same entry are completely consistent across different language resource files, guaranteeing accurate matching by the subsequent translation management platform.
[0079] In this embodiment, by establishing a UUID and ensuring that the UUID remains permanently unchanged, the term is permanently bound after the UUID is assigned, ensuring a one-to-one correspondence between the term and the UUID. This provides a unique business key for accurate matching of translation platform text in the future, avoids the loss of references caused by modifying the business text itself, and solves the problem of duplicate or ambiguous resource names that may occur between different modules.
[0080] Figure 5 A flowchart illustrating an application resource package configuration method provided in another specific embodiment of this application; see also Figure 5 As shown, the above application resource package configuration method further includes the following step S50: S50. During the Application.attachBaseContext() initialization phase, the application searches for and loads the external resource package according to the directory, and then retrieves and displays the translated content.
[0081] In in-vehicle infotainment systems, users first see the startup screen and main interface text after launching the application. If the external language pack is loaded too late (e.g., in Activity.onCreate() or later), the application will still display the text in the built-in default language during the initial startup phase. Users will need to restart the application to see the changes after switching languages, resulting in a poor user experience.
[0082] Therefore, in this embodiment, the application is set to actively intervene in the Application.attachBaseContext() callback phase, which is the earliest initialization time in the application lifecycle, before any Activity (Activity) is created and UI (UserInterface) is rendered, to perform the lookup and loading of external language packs.
[0083] For example, the specific implementation steps are as follows: The application uses `File.exists()` and `File.canRead()` to determine if the file `resources.arsc` in the target path exists and if it has read permissions. If the file exists and is readable, it opens the `resources.arsc` file in read-only mode using `ParcelFileDescriptor.open(file, MODEREADONLY)` to obtain the file descriptor.
[0084] The reason for adopting read-only mode is that the external language pack is only used for resource querying and does not need to be written or modified; at the same time, read-only mode avoids the risk of language pack corruption due to accidental writing, ensuring the stability of the vehicle system in the mass production environment.
[0085] A ResourcesProvider instance is created based on the obtained ParcelFileDescriptor, and then this ResourcesProvider is added to the newly instantiated ResourcesLoader. The resource loader is injected into the current context's resource access system by calling context.getResources().addLoaders(resourcesLoader). Subsequently, when the application's business layer calls native interfaces such as getString(R.string.btnautopark), it will first look for the translation content corresponding to the resource ID in the already mounted external ResourcesLoader.
[0086] All the above loading operations are completed before super.attachBaseContext(), ensuring that the external language pack is ready when all subsequent Activities and Services are created, so that the external translation content can be used directly during the first UI rendering.
[0087] In this embodiment, the external language pack is loaded very early in the application's lifecycle, ensuring that the first interface the user sees uses the external translation content, thus avoiding issues such as flickering text or disjointed language switching. Furthermore, the business logic still uses native R constants and Resources access interfaces (such as getString() and getText()), requiring no modification to resource access methods, making it suitable for smooth integration with existing applications.
[0088] Figure 6 A flowchart illustrating an application resource package configuration method provided in another specific embodiment of this application; see also... Figure 6 As shown in one possible embodiment of this application, the above method further includes the following step S60: S60. If the application fails to load the external resource package or fails to obtain the translated content, it will revert to matching and reading the built-in resources of the application installation package.
[0089] In the context of mass production of in-vehicle infotainment systems, external language packs may become unavailable or partially unavailable due to the following reasons: (1) OTA transmission anomalies cause language pack files to be corrupted or incomplete; (2) in-vehicle infotainment system storage failures cause language packs to be lost or have abnormal permissions; (3) external language packs only contain translations of some languages, and some entries are missing; (4) the version of the external language pack does not match the version of the host APK, and some resource IDs do not correspond. Without a safe rollback mechanism, any of the above anomalies will cause abnormal display of the application interface or even functional crashes, seriously affecting driving safety and user experience.
[0090] Therefore, this embodiment provides a multi-layered fallback mechanism, which, for example, can automatically fall back to the built-in resources of the application installation package in the following three scenarios: Scenario 1: External resource package file-level loading fails; If the application detects that an external language pack file is missing, has a file size of zero, has abnormal file permissions, or fails file format verification, it will skip the loading process of the external language pack. In this case, ResourcesLoader is not injected, and all resource access is done through the APK's built-in resource table, essentially reverting to the traditional mode without external language packs. The user interface will then display the default language (e.g., Chinese) built into the APK.
[0091] Scenario 2: External resource package loads successfully but resource query fails; After the external language pack is successfully loaded, when the application queries the English translation of "automatic parking" using getString(0x7f010001), ResourcesLoader first searches for a resource item with resource ID 0x7f010001 and a configuration qualifier matching the current Locale (e.g., English en) in the mounted external resource providers. If the external language pack does not contain an English translation, or if the resource ID does not exist in the external language pack, the search will not find a match. At this point, the Android resource management subsystem automatically continues to search for the resource item corresponding to the same resource ID in the APK's built-in resource table according to the resource query priority, and finally returns the built-in Chinese text "automatic parking" as a fallback.
[0092] Scenario 3: Some terms are missing from the external resource package; Assume the external language pack only contains the English translation for "automatic parking" and not the English translation for "stop". When the application queries these two terms separately: getString(0x7f010001) (Auto Parking): If the external package is hit, it returns "Auto Park"; getString(0x7f010002) (Stop): External package not found, automatically reverts to the APK's built-in resource table and returns "Stop".
[0093] This fine-grained rollback at the term level ensures that the interface can still be displayed normally even if the external language pack translation is incomplete, without blanking or crashing.
[0094] In this embodiment, whether it is a file-level loading failure or a term-level query failure, it can automatically fall back to the built-in resources of the APK, ensuring the continuity of interface display and system stability in the mass production environment of the vehicle system.
[0095] Figure 7 This application provides a specific embodiment of an application resource package configuration method, illustrating the functional implementation module interaction diagram; see reference. Figure 7 As shown, in the specific implementation of the above embodiments of this application, the overall workflow can be completed collaboratively at three levels: the vehicle terminal, the cloud, and the CI / CD pipeline. For example, the specific implementation can be divided into five stages in chronological order: Phase 1 (Cloud Preparation): Product personnel import terms into the Translation Management System (TMS). TMS assigns a UUID to each term and provides the term and UUID list to the R&D personnel.
[0096] Phase Two (In-Vehicle Infotainment System Development): Developers bind UUIDs in the strings.xml file of the application source code to complete the development of business functions.
[0097] Phase 3 (CI / CD APK Compilation): Developers submit code, and the CI / CD pipeline automatically triggers the APK compilation task, fixing resource IDs. After compilation, base.apk, strings.xml with UUID, and stable-ids.txt are generated. The build script automatically uploads these three artifacts to the file server for archiving.
[0098] Phase Four (CI / CD Language Pack Compilation): The CI / CD pipeline triggers the language pack building task, pulls the strings.xml and stable-ids.txt corresponding to the target version from the file server, extracts the UUID from strings.xml and requests translation content from the cloud TMS. TMS returns translations for each language based on precise matching of UUIDs. CI / CD then combines stable-ids.txt to compile and generate an external language pack that is strictly aligned with the host APK resource ID, and archives and integrates it into an OTA distribution package.
[0099] Phase 5 (Deployment and Loading on the Vehicle Infotainment System): The OTA platform distributes the external language pack to the vehicle infotainment system and stores it in the external storage directory specified by the application. During application startup, the external language pack is detected and loaded in the `Application.attachBaseContext()` stage. Business code prioritizes reading the external translation content through the native resource access interface; if the external language pack is not found, it automatically falls back to the APK's built-in resources.
[0100] For a detailed description of the implementation of each step in this process, please refer to the above method embodiments.
[0101] Figure 8 A schematic diagram illustrating the process of updating the translation content of existing target language terms according to an embodiment of this application; see reference. Figure 8 As shown, when the translation content of existing target language terms in the translation management system is updated, the target application does not need to be recompiled. The method includes S801-S803: S801. Obtain the updated translation content from the translation management system based on the globally unique identifier (UUID) corresponding to the target language term; S802. Bind the updated translation content to the corresponding resource ID according to the resource ID mapping table, and compile to generate the updated external language pack; S803. Deploy the updated external language pack to the vehicle's infotainment system to replace the original external language pack of the target application.
[0102] Therefore, in this embodiment, when the translated content is updated, the update can be achieved very efficiently through an external language pack, and the application only needs to load and use it.
[0103] In this embodiment, when adding a new term in the application, the process is as follows: A new target term is created in the translation management system, a globally unique identifier (UUID) is assigned to the target term, and the corresponding translation content for each language is entered; a string resource corresponding to the target term is added to the main language resource file of the application source code, and the UUID is bound to the newly added string resource; when compiling the application installation package, a new resource ID is assigned to the newly added string resource and updated to the resource ID mapping table, while the resource IDs corresponding to existing terms remain unchanged; based on the updated resource ID mapping table and the translation content for each language in the translation management system, an external language package containing the new term is compiled and generated; after deploying the external language package to the vehicle's infotainment system, when the application starts, it first reads the translation content of the new term from the external language package; if the corresponding term does not exist in the external language package, it falls back to the application's built-in resources.
[0104] This application provides a complete end-to-end process from the creation of a new term to its activation on the vehicle's infotainment system. The following is a detailed explanation using examples: The product requirements call for the addition of a "voice assistant" function button.
[0105] Product personnel log in to the Translation Management Platform (TMS), create an entry: original text "Voice Assistant", and enter the translations for each language: English: Voice Assistant; Russian: Голосовой помощник.
[0106] TMS automatically assigned a UUID to this entry: 660e8400-e29b-41d4-a716-446655440099.
[0107] TMS provides the term and UUID to the developers. TMS will provide the new term's resource name btnvoiceassistant and UUID 660e8400-e29b-41d4-a716-446655440099 to the developers.
[0108] Developers add string resources and bind UUIDs in strings.xml, and simultaneously add the following content to values / strings.xml in the application source code to complete business function development: / / xml <string name="btn_voice_assistant" trans:uuid="660e8400-e29b-41d4-a716-446655440099"> voice assistant< / string> .
[0109] CI / CD triggers the compilation of the APK artifact, assigning resource IDs. The CI / CD pipeline then triggers the APK compilation task. AAPT2 reads the historical stable-ids.txt and assigns a new unused resource ID, 0x7f010010, to the newly added term btn_voice_assistant. After compilation, the updated stable-ids.txt is output and automatically committed back to the version control repository.
[0110] Output of this compilation: base.apk (contains the original Chinese text for "voice assistant", resource ID is 0x7f010010); strings.xml (with UUID).
[0111] The updated stable-ids.txt (with the new entry: com.vehicle.media:string / btnvoiceassistant = 0x7f010010) The build system retrieves the stable-ids.txt and strings.xml files corresponding to the target ROM version from the file server, and sends the strings.xml file containing the UUID to TMS. TMS accurately matches the translation results for each language based on the UUID and returns them.
[0112] The build system matches the resource names in the translated content returned by TMS with stable-ids.txt, binding a corresponding resource ID to each translated content. Subsequently, the build system calls AAPT2 in conjunction with stable-ids.txt to compile an independent external language pack that is strictly aligned with the application ontology resource IDs.
[0113] The external language pack is deployed to the vehicle's infotainment system. The external language pack is downloaded via OTA and stored in the / data / local / langpack / com.vehicle.media / directory on the vehicle's infotainment system.
[0114] When the application starts, it prioritizes reading the translations of newly added terms from the external language pack. The application loads the external language pack during the Application.attachBaseContext() stage. Subsequently, when the application calls getString(0x7f010010) to query the translation of "voice assistant", the system prioritizes searching in the external language pack, and returns "Voice Assistant" if it is found.
[0115] If the external language pack does not yet include an English translation of "Voice Assistant" (e.g., translation is still in progress, language pack has not been updated), the system will automatically revert to the APK's built-in resource table and return the original Chinese text "Voice Assistant" as a fallback display, without any blank space or crash.
[0116] The entire process, from TMS creating entries to the vehicle-mounted system taking effect, is fully automated. The translation of new entries no longer blocks the compilation and release of the APK. Developers only need to pre-embed the Chinese original text and UUID in the source code, and the translation platform can complete the translation asynchronously.
[0117] Figure 9 This is a schematic diagram of an application resource pack configuration device provided in an embodiment of this application; see reference. Figure 9 As shown, an application resource pack configuration device includes: The first acquisition module 901 is used to acquire the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions. The second acquisition module 902 is used to acquire translation content in the target language from the translation management system. The translation content is associated with the corresponding resource item through a pre-allocated globally unique identifier (UUID). The compilation module 903 is used to extract each translated content and its corresponding resource ID according to the resource ID mapping table and the translated content, and compile to generate a binary resource index file; the resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application; The encapsulation and deployment module 904 is used to encapsulate the binary resource index file into an external resource package and deploy it to the loading directory specified by the application on the vehicle terminal.
[0118] In one embodiment of this application, the above-mentioned apparatus further includes: The allocation module (not shown in the figure) is used to pre-assign a globally unique identifier (UUID) to the target language terms that the application needs to externalize in the translation management system. The target language terms include the initial content of the terms. The UUID is used to identify the target language terms. The corresponding translation content of the target language terms is associated with the corresponding resource items through the UUID.
[0119] In one embodiment of this application, the allocation module (not shown in the figure) is specifically used for: The UUID injection tool matches the target language terms exported by the translation management system with the read XML main language file; wherein, the XML main language file stores all the string resources of the application; If a match is found, the Universally Unique Identifier (UUID) assigned by the translation management system is added to the matched term, and a new XML file is generated. Save the new XML file to the source file.
[0120] In one embodiment of this application, the second acquisition module 902 described above is specifically used for: Based on the application version information, obtain the resource file of the target application corresponding to the version, and the resource file carries the globally unique identifier UUID; Based on the UUID and language information in the resource file, the translation content in the target language is obtained from the translation management system.
[0121] In one embodiment of this application, the above-mentioned apparatus further includes: The loading module (not shown in the figure) is used by the application to locate and load the external resource package according to the directory during the Application.attachBaseContext() initialization phase, and to obtain and display the translated content.
[0122] In one embodiment of this application, the above-mentioned apparatus further includes: The rollback module (not shown in the figure) is used to fall back to the matching and reading of the built-in resources of the application installation package if the application fails to load the external resource package or fails to obtain the translation content.
[0123] In one embodiment of this application, the above-described apparatus further includes a resource ID mapping generation and maintenance module, used for: When compiling the installation package of the target application, the stable-ids parameter of the Android resource compilation tool AAPT2 is called, and the historical resource ID mapping table is used as the compilation input, so that the existing resource items continue to use the original resource IDs, and the newly added resource items are assigned new resource IDs that are not occupied. After compilation, the updated resource ID mapping table is output via the output resource ID parameter emit-ids.
[0124] In one embodiment of this application, the compilation module 903 is used for: By matching the resource names in the translated content with the resource ID mapping table, each translated content and its corresponding resource ID are determined, thus completing the binding of the translated content with the corresponding resource ID; wherein, the ID mapping table stores the mapping relationship between the resource names and resource IDs; The translated content bound to the resource ID is compiled into binary format and written into the resources.arsc file.
[0125] In one embodiment of this application, the above-described apparatus includes: The second acquisition module 902 is further configured to acquire an updated term module, which is configured to acquire the updated translation content from the translation management system based on the globally unique identifier (UUID) corresponding to the target language term; The compilation module 903 is also used to bind the updated translation content with the corresponding resource ID according to the resource ID mapping table, and compile and generate the updated external language pack; The encapsulation and deployment module 904 is further configured to deploy the updated external language pack to the vehicle infotainment system, replacing the original external language pack of the target application. In yet another embodiment of this application, an electronic device is also provided. Figure 10 A structural diagram of an electronic device provided in an embodiment of this application is shown below. Figure 10 As shown, the electronic device includes a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1120, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus. Memory 1130 is used to store computer programs; Processor 1110, when executing a program stored in memory, implements the application resource package configuration method described in any of the foregoing method embodiments, including: Obtain the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions. The translation content in the target language is obtained from the translation management system, and the translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID). Based on the resource ID mapping table and the translated content, each translated content and its corresponding resource ID are extracted, and a binary resource index file is generated. The resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application. The binary resource index file is packaged into an external resource package and deployed to the loading directory specified by the application on the vehicle-mounted system.
[0126] In one possible implementation, the method further includes: In advance, a globally unique identifier (UUID) is assigned to the target language terms that the application needs to externalize in the translation management system. The target language terms include the initial content of the terms. The UUID is used to identify the target language terms. The corresponding translation content of the target language terms is associated with the corresponding resource items through the UUID.
[0127] In one possible implementation, the pre-assignment of globally unique identifiers (UUIDs) for target language terms required by the application in the translation management system includes: The UUID injection tool matches the target language terms exported by the translation management system with the read XML main language file; wherein, the XML main language file stores all the string resources of the application; If a match is found, the Universally Unique Identifier (UUID) assigned by the translation management system is added to the matched term, and a new XML file is generated. Save the new XML file to the source file.
[0128] In one possible implementation, the step of obtaining the target language translation content from the translation management system, wherein the translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID), includes: Based on the application version information, obtain the resource file of the target application corresponding to the version, and the resource file carries the globally unique identifier UUID; Based on the UUID and language information in the resource file, the translation content in the target language is obtained from the translation management system.
[0129] In one possible implementation, the method further includes: During the Application.attachBaseContext() initialization phase, the application searches for and loads the external resource package according to the directory, and then retrieves and displays the translated content.
[0130] In one possible implementation, the method further includes: If the application fails to load the external resource package or fails to obtain the translated content, it will revert to matching and reading the built-in resources of the application installation package.
[0131] In one possible implementation, the resource ID mapping table is generated and maintained in the following manner: When compiling the installation package of the target application, the stable-ids parameter of the Android resource compilation tool AAPT2 is called, and the historical resource ID mapping table is used as the compilation input, so that the existing resource items continue to use the original resource IDs, and the newly added resource items are assigned new resource IDs that are not occupied. After compilation, the updated resource ID mapping table is output via the output resource ID parameter emit-ids.
[0132] In one possible implementation, the step of extracting each translated content and its corresponding resource ID based on the resource ID mapping table and the translated content, and compiling to generate a binary resource index file, includes: By matching the resource names in the translated content with the resource ID mapping table, each translated content and its corresponding resource ID are determined, thus completing the binding of the translated content with the corresponding resource ID; wherein, the ID mapping table stores the mapping relationship between the resource names and resource IDs; The translated content bound to the resource ID is compiled into binary format and written into the resources.arsc file.
[0133] In one possible implementation, when the application adds a new resource entry, the method further includes the following steps: Create new target terms in the translation management system, assign a globally unique identifier (UUID) to the target terms, and enter the corresponding translation content for each language; Add a string resource corresponding to the target term to the main language resource file of the application source code, and establish a binding relationship between the UUID and the newly added string resource; When compiling the application installation package, a new resource ID is assigned to the newly added string resource and updated to the resource ID mapping table, while the resource IDs corresponding to existing entries remain unchanged; Based on the updated resource ID mapping table and the translation content of each language in the translation management system, an external language pack containing the newly added terms is compiled and generated. After the external language pack is deployed to the vehicle's infotainment system, the application will first read the translation of newly added terms from the external language pack when it starts up. If the corresponding terms are not found in the external language pack, the application will fall back to the built-in resources.
[0134] The electronic device provided in this embodiment of the invention achieves decoupling and separation of application business ontology and language text by executing programs stored in memory, which greatly reduces the complexity of R&D iteration and OTA distribution traffic consumption. Furthermore, when updating or replacing language translations, it can be operated directly on external resource packages, which has great convenience and efficiency, and has the advantages of scalability and easy maintenance. Therefore, the implementation of this solution can greatly facilitate the internationalization of vehicle systems.
[0135] The communication bus 1140 mentioned in the above-mentioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 1140 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0136] The communication interface 1120 is used for communication between the above-mentioned electronic device and other devices.
[0137] The memory 1130 may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0138] The processor 1110 mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0139] In another embodiment of this application, a computer-readable storage medium is also provided, on which a program for an application resource package configuration method is stored. When the program for the application resource package configuration method is executed by a processor, it implements the steps of the application resource package configuration method described in any of the foregoing method embodiments.
[0140] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0141] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.< / string> < / string>
Claims
1. A method for configuring application resource packages, characterized in that, include: Obtain the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions. The translation content in the target language is obtained from the translation management system, and the translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID). Based on the resource ID mapping table and the translated content, extract each translated content and its corresponding resource ID, and compile to generate a binary resource index file; The resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application; The binary resource index file is packaged into an external resource package and deployed to the loading directory specified by the application on the vehicle-mounted system.
2. The application resource package configuration method according to claim 1, characterized in that, The method further includes: In advance, a globally unique identifier (UUID) is assigned to the target language terms that the application needs to externalize in the translation management system. The target language terms include the initial content of the terms. The UUID is used to identify the target language terms. The corresponding translation content of the target language terms is associated with the corresponding resource items through the UUID.
3. The application resource package configuration method according to claim 2, characterized in that, The pre-assignment of globally unique identifiers (UUIDs) for target language terms required by the application in the translation management system includes: The UUID injection tool is used to match the target language terms exported by the translation management system with the read XML main language file; wherein, the XML main language file stores all the string resources of the application; If a match is found, the Universally Unique Identifier (UUID) assigned by the translation management system is added to the matched term, and a new XML file is generated. Save the new XML file to the source file.
4. The application resource package configuration method according to claim 1, characterized in that, The process of obtaining translation content in the target language from the translation management system, wherein the translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID), includes: Based on the application version information, obtain the resource file of the target application corresponding to the version, and the resource file carries the globally unique identifier UUID; Based on the UUID and language information in the resource file, the translation content in the target language is obtained from the translation management system.
5. The application resource package configuration method according to claim 1, characterized in that, The method further includes: During the Application.attachBaseContext() initialization phase, the application searches for and loads the external resource package according to the directory, and then retrieves and displays the translated content.
6. The application resource package configuration method according to claim 5, characterized in that, The method further includes: If the application fails to load the external resource package or fails to obtain the translated content, it will revert to matching and reading the built-in resources of the application installation package.
7. The application resource package configuration method according to claim 1, characterized in that, The resource ID mapping table is generated and maintained in the following manner: When compiling the installation package of the target application, the stable-ids parameter of the Android resource compilation tool AAPT2 is called, and the historical resource ID mapping table is used as the compilation input, so that the existing resource items continue to use the original resource IDs, and the newly added resource items are assigned new resource IDs that are not occupied. After compilation, the updated resource ID mapping table is output via the output resource ID parameter emit-ids.
8. The application resource package configuration method according to claim 1, characterized in that, The step of extracting each translated content and its corresponding resource ID based on the resource ID mapping table and the translated content, and compiling it into a binary resource index file, includes: By matching the resource names in the translated content with the resource ID mapping table, each translated content and its corresponding resource ID are determined, thus completing the binding of the translated content with the corresponding resource ID; wherein, the ID mapping table stores the mapping relationship between the resource names and resource IDs; The translated content bound to the resource ID is compiled into binary format and written into the resources.arsc file.
9. The application resource package configuration method according to claim 1, characterized in that, When the translation content of existing target language terms in the translation management system is updated, the target application does not need to be recompiled. The method further includes: The updated translation content is obtained from the translation management system based on the globally unique identifier (UUID) corresponding to the target language term; The updated translation content is bound to the corresponding resource ID according to the resource ID mapping table, and the updated external language pack is compiled and generated. The updated external language pack is deployed to the vehicle's infotainment system, replacing the original external language pack of the target application.
10. An application resource package configuration device, characterized in that, include: The first acquisition module is used to acquire the resource ID mapping table of the target application. The resource ID mapping table is generated and continuously maintained during the compilation phase of the target application. It records the correspondence between each resource item and the resource ID, and the resource ID of the same resource item remains consistent in different application versions. The second acquisition module is used to acquire translation content in the target language from the translation management system. The translation content is associated with the corresponding resource item through a pre-assigned globally unique identifier (UUID). The compilation module is used to extract each translated content and its corresponding resource ID based on the resource ID mapping table and the translated content, and compile it to generate a binary resource index file; The resource ID of each translated content in the binary resource index file is consistent with the resource ID of the corresponding resource item in the target application; The encapsulation and deployment module is used to encapsulate the binary resource index file into an external resource package and deploy it to the loading directory specified by the application on the vehicle terminal.
11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the application resource package configuration method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for an application resource package configuration method, which, when executed by a processor, implements the steps of the application resource package configuration method according to any one of claims 1-9.