Java Annotation Processor for Internationalization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current resource bundle solutions for national language support in software development are cumbersome during development, testing, and debugging, requiring manual maintenance of separate text files, leading to errors and inefficiencies, especially when multiple developers collaborate.
Innovation Solution
Integrating National Language Support (NLS) annotations directly into the source code, allowing an annotation processor to extract and store these annotations as resource bundles or DITA XML topics, enabling developers to work within the Java language context and reducing manual overhead.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If NLS text is kept in separate resource bundle files, then translation can be done independently of source code, but manual maintenance becomes cumbersome and error-prone during development and testing
Solution Approach 1:
The patent merges NLS annotations directly into the source code alongside the user interface element definitions. Instead of maintaining separate resource bundle files, developers can specify NLS text strings as annotations within the Java source code itself, eliminating the need to manually edit separate files during development and testing.
Solution Approach 2:
The patent introduces an annotation processor as an intermediary tool that automatically extracts NLS annotations from source code and generates the corresponding resource bundle files. This mediator handles the translation workflow automatically, reducing manual intervention and errors while preserving the ability to translate independently of source code.
2Ease of operation
If NLS text is embedded in source code, then developers can work within Java language context, but the code would need to be rebuilt and tested for each language
Solution Approach 1:
The patent enables developers to perform preliminary actions by specifying all NLS text strings as annotations during the initial source code development. The annotation processor then extracts these annotations and generates resource bundle files that can be translated independently, eliminating the need to rebuild and retest the entire application for each language.
Solution Approach 2:
The patent segments the NLS text content from the executable code by using annotations that can be automatically extracted. This segmentation allows the text portion to be processed separately through translation workflows while the source code remains unchanged, avoiding repeated rebuilding and testing cycles.
3Adaptability or versatility
If manual maintenance of separate text files is required, then translation independence is achieved, but errors and inefficiencies increase during collaborative development
Solution Approach 1:
The patent enables the system to serve itself by using the annotation processor to automatically extract NLS annotations from source code and generate resource bundle files without manual intervention. This self-service mechanism ensures translation independence while eliminating the manual maintenance errors and inefficiencies that occur during collaborative development.
Solution Approach 2:
The patent establishes a feedback loop where the annotation processor continuously monitors source code annotations and automatically updates resource bundle files. This feedback mechanism ensures that any changes in NLS text are automatically reflected in the translation files, maintaining synchronization without manual intervention and improving collaborative development efficiency.
Data Source
AI summary
Internationalizing a target program includes associating a text string in the program with an attribute of a user interface element. The user interface element is defined in the program and the associating is provided at least partly by a non-executable user interface element annotation in the program. A resource bundle annotation in the program defines a name for a resource bundle to which the text string of the user interface element annotation may be extracted. An annotation processor program automatically creates the resource bundle by processing source code of the target program, including the user interface element annotation and the resource bundle annotation. Executing a method in the target program causes the text string to be displayed on the attribute for a displayed instance of the user interface element. The method determines whether to obtain the displayed text string from the user interface element annotation or from the resource bundle.


