POS Tagging for Hard-Coded String Translatability in Source Code

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for handling hard-coded strings in software localization are time-consuming and error-prone, requiring rule-based code analysis for different programming languages, and do not adequately consider the context for determining translatability.

Innovation Solution

A method that parses source code and localization resource files to identify hard-coded strings and their context, uses a POS tagging model trained with confidence scores to tag strings as translatable or non-translatable, eliminating the need for language-specific parsers and rules.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If rule-based code analysis is used to search for and translate hard-coded strings, then translation can be performed, but the process becomes time-consuming and error-prone

Engineering Contradiction:
Improvetranslation speedVSAvoidtranslation accuracy
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent replaces rule-based mechanical code analysis with a machine learning-based system that uses neural networks to automatically detect and translate hard-coded strings. The system employs a detector module that uses learned patterns from training data to identify translatable strings, eliminating the need for manually crafted rules and significantly improving both speed and accuracy of localization.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Measurement precision

If language-specific parsers and rules are developed for different programming languages, then accurate parsing can be achieved, but device complexity increases

Engineering Contradiction:
Improveparsing accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent implements a universal detector module that can handle multiple programming languages through a single unified architecture. Instead of developing separate parsers for each language, the system uses a single detector trained on multi-language data that learns to recognize translatable strings across different programming contexts, thereby achieving language-agnostic parsing accuracy without proportionally increasing system complexity.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Reliability

If hard-coded strings are manually located and translated, then translation quality can be controlled, but the process requires significant time and effort

Engineering Contradiction:
Improvetranslation qualityVSAvoidlocalization time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system enables automated self-service localization by using the detector module to automatically identify hard-coded strings and the translator module to automatically translate them. The system processes localization tasks autonomously without requiring manual intervention for string detection or translation, significantly reducing localization time while maintaining quality through the trained machine learning models.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS12602225B2Identifying the translatability of hard-coded strings in source code via POS tagging
Publication Date: 2026.04.14 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US12602225B2 patent drawing
  • US12602225B2 patent drawing
  • US12602225B2 patent drawing

AI summary

A method for identifying hard-coded strings in source code is disclosed. In one embodiment, such a method parses source code and associated localization resource files to identify hard-coded strings and their associated context. The method provides a confidence score for each hard-coded string that indicates whether the hard-coded string is translatable or non-translatable. Based on the confidence score for each hard-coded string, the method transforms each hard-coded string into a single equivalence word. The method then prepares training data by tagging the hard-coded strings in the source code and associated localization resource files as one of translatable and non-translatable. The method then trains a parts-of-speech (POS) tagging model using the training data. At runtime, the method fetches potential hard-coded strings and tags each hard-coded string as one of translatable and non-translatable using the POS tagging model. A corresponding system and computer program product are also disclosed.