I programmed an URCap, that includes a ProgramNode and a template that uses this ProgramNode. Basically I change language of Descriptions, comments etc using resource files and load them depending on which language is set on the robot. If I create the template using the ProgramNodeFactory to add wayponts, folders, comments and my URCap ProgrammNode, it will do it in the right language.
My problem is the following
- set languag of UR o german
- create program where I added my URCap template ProgramNode (everything is fine and in german)
- save program
- change language of UR to english
- restart robot
- open the program
Parts of the my URCap template like MoveNode and my URCap ProgramNode changed the language (marked in green in the images below.
Parts of the my URCap template like Folder and comments did not changed the language, they are still in german (marked in redin the images below.
Create and Store in german:
Open in english:
How can I change the folder name and comments to other language when open a program.
You can traverse the program tree. When you reach a CommentNode or a FolderNode you use the _getComment()_and getName() to retrieve the values stored in their dataModel. For each you can then iterate over you stored string and languages and see if you find a match that is not aligned with the current language selection. In these cases you can now set the value that is aligned with the current language selection.
I think what my problem is, that I do not have a dataModel of my template, that contains the information of the TreeNode. I can not store the complete root TreeNode of my template to the DataModel. I did try a lot, but did not get a solution. Can you maybe get my some example code.