Regular expressions is a general method for matching strings. In Studio, there are several ways of using regular expressions to change the behaviour of the system. I will describe one case here. This relates to my previous posting
If you open the translatable file from TranslateCad, trans1 file in a text editor, it looks something like this:
-----------------
##000019##
FIRMA OY
##000020##
1:10
##000021##
1010
##000022##
Piirustukset ovat ohjeellisia.
##000023##
-----------------
The codes with numbers ##000XX## are created by the converter, to keep track of the reimport of texts. But you do not want to have them in Studio, of several reasons. They have to be untouched; and if you use Autopropagate in Studio, they are propagated to all similar lines every time you confirm a row, which is time consuming. A drawing typically also includes a lot of standalone numbers (measurements), that shows up as integers in Studio.
However, there is a nice function in Studio that allows you to define nontranslatable units when importing in text format. In the CAD case I have chosen to hide both the code and numbers/integers, so they do not show up in the Studio editor.
Workflow for text import
The best way to work with this would probably be to create a dummy project first in the desired language combination. Then you have a place for your experiments, without changing any parameters that will affect the global settings or any ongoing projects.
1) Go to menu Project/Project settings
2) Expand file types by clicking on the preceding +
3) At the bottom of the list, choose the file type Text.
4) Click on Inline patterns.
5) Click on Add rule... and paste the following into the field Opening:
##\d+##
That will make the tags into not translatable placeholders.
6) Click on Add rule... and paste the following into the field:
^([-+] ?)?[.0-9]+(.[0-9]+)?$ [corrected expression]
Note: the ^ symbol is not found on your keyboard, so either use cut and paste from here or use the alt code Alt 94.
Note: http://usefulshortcuts.com/downloads/ALT-Codes.pdf
Note: http://usefulshortcuts.com/downloads/ALT-Codes.pdf
The second rule will remove all standalone numbers. I am actually not quite sure what this expression does, I found it on a computer geek site. But it at least removes the standalone integers. Probably it will also remove numbers preceded by +- and with commas in them.
The above example, the trans1 from TranslateCAD will now look like this:
-----------------
FIRMA OY
1:10
Piirustukset ovat ohjeellisia.
-----------------
If you still would like to see the codes and measurements while working, use the Display Filter bar. If you do not see the Filter toolbar, use View/Toolbars/Display Filter. The display field probably says All segments; change that to All content. Now you will see a number tag on all rows that contains untranslatable tags only, the Tag ID is displayed. To see the whole tag content, click on Full Tag content on the QuickInsert toolbar. Now you can see all codes and numbers as non-editable tags.
Save and reuse your settings
When you are ready with the settings, you should save your work in a project template.
Go to Project/Create project template
Give the template a file name, e.g. FinnishToSwedishCAD and save. Now you can use this template for your present and future AutoCAD projects without having to do all the settings again.
0 comments:
Post a Comment