Localized Drawing templates ...

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
r-frank
Posts: 2181
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Localized Drawing templates ...

Postby r-frank » Tue May 12, 2015 7:56 pm

Hello.

Just realised this in 0.16.4924 - Windows 7 - 64 bit - Language set to german:
Landscape_no_please.jpg
Landscape_no_please.jpg (85.78 KiB) Viewed 1510 times
Yes, the basic translation of "Landscape" is "Landschaft", but in this context, PLEASE
> change "Landschaft" to be "Querformat"
> change "Portrait" to be "Hochformat"
> change "Plain" to be "blanko"

Thank you.

Another thing:
Am I correct that changing the language setting in FreeCAD won't affect the title block text in the drawing templates ?
I would have to set up my own localised (translated) templates ?

One more Thing:
Is there a way to store the "germanized" templates somewhere so that i can choose them when creating a new page ?
On Windows ? (i am asking because this thread here applies to Linux)

Thanks again.

Roland
Deutsche FreeCAD Tutorials auf Youtube
My GrabCAD FreeCAD-Projects
FreeCAD lessons for beginners in english

Native german speaker - so apologies for my english, no offense intended :)
triplus
Posts: 9278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Localized Drawing templates ...

Postby triplus » Wed May 13, 2015 8:11 am

I would have to set up my own localised (translated) templates ?
I would like to see localized drawing templates but ATM i don't know how that could be done. Could translation system be used for SVG/DXF drawing templates? Or would we need to provide drawing template set for each language? Ideally translation system would be used as for the rest of FreeCAD user interface. I am not sure this could be done directly or some localized string replacing would need to be implemented instead.

But it should be quite easy for you to localize drawing templates yourself:
  • Open all of them in text editor capable of replacing text in all opened files. This way you basically only localize one and all are localized. Non ISO7200 ones A4 and A3 would need to be addressed individually.
  • I see there is some localization already going on and Landscape from drawing template file name does get translated to Landschaft in drop down menu. I could be wrong but this is probably something that would need to be changed in official FreeCAD German translations if you want "Landschaft" to be "Querformat" and "Portrait" to be "Hochformat".
  • To change "Plain" to be "blanko" automatically probably that would need to be added to translation system in the same way Landscape is translated to Landschaft and Portrait to Portrat ATM.
On Windows ? (i am asking because this thread here applies to Linux)
Yes you would need latest development release and create Templates folder inside the folder where your FreeCAD stores user.cfg and system.cfg files.

To sum up:
  • Translate SVG/DXF drawing templates.
  • Copy them to local user Templates folder (you need latest development release).
  • Name the drawing templates:
XY_Landscape_custom.svg
XY_Portrait_custom.svg

X = Paper size A,B,C,D,E
Y = Paper size number
custom = any text

Landscape and Portrait will be translated to "Landschaft" and "Portrat" as i guess FreeCAD translation takes over. And about the custom part you can use "blanko" as you can use anything for the custom part (until FreeCAD translation system doesn't automatically starts translating Plain to Blanko for German language).
User avatar
r-frank
Posts: 2181
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: Localized Drawing templates ...

Postby r-frank » Thu May 14, 2015 7:55 am

Hello triplus.

Thanks for your reply.

1) although upgrading to 0.16.4957 on Windows my Templates are not recognized (in the pull-down-menu) by FreeCAD.
2) the names of the standard-templates seem to be "hard coded", which means adding templates in the FreeCaD\Mod\Drawing\Templates
directory won't work either

This leaves me with two choices on windows atm:
a) have "edited" versions of the Templates in the FreeCAD-Install-Directory.
b) have "edited" versions of the Templates in my user-directory (better for backup and updating FreeCAD) and insert a
"standard" template and then replace it via the data-tab with the edited version.

Roland
Deutsche FreeCAD Tutorials auf Youtube
My GrabCAD FreeCAD-Projects
FreeCAD lessons for beginners in english

Native german speaker - so apologies for my english, no offense intended :)
triplus
Posts: 9278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Localized Drawing templates ...

Postby triplus » Thu May 14, 2015 8:21 am

1) although upgrading to 0.16.4957 on Windows my Templates are not recognized (in the pull-down-menu) by FreeCAD.
Yes i am sorry i mislead you. I just tested this commit yesterday:

https://github.com/FreeCAD/FreeCAD_sf_m ... 7eb17461e5

And honestly i don't know what it does. I assumed it will look for templates in UserAppDataDir/Templates and show them in drop down menu but at least for me it does not do anything or i am doing something wrong. I asked for feedback here:

http://www.freecadweb.org/tracker/view.php?id=1963
2) the names of the standard-templates seem to be "hard coded", which means adding templates in the FreeCaD\Mod\Drawing\Templates
directory won't work either
Yes they are hardcoded with a bit of customization allowed. Until recently there were basically NO customizations allowed. You could only rewrite 2 default ones and everything else had to be done manually (Template Property).
XY_Landscape_custom.svg
XY_Portrait_custom.svg

X = Paper size A,B,C,D,E
Y = Paper size number
custom = any text
For example this will work:

A4_Landscape_blanko.svg

And this will not:

A4_Querformat_blanko.svg

That is why i said if Querformat should be used instead of Landschaft for German localization somebody should probably change that in official German translations.
b) have "edited" versions of the Templates in my user-directory (better for backup and updating FreeCAD) and insert a
"standard" template and then replace it via the data-tab with the edited version.
You are probably talking about Template Property. ATM i would advise you not to change templates this way as there is bug involved:

viewtopic.php?f=10&t=10697#p87930

But as new DW is being pursued i am not sure if current one is in "feature/bug fix freeze" state already or not. I could easily believe there is lack of motivation to work on current DW but i could be wrong.
triplus
Posts: 9278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Localized Drawing templates ...

Postby triplus » Thu May 14, 2015 9:20 am

OK now i think i understand what UserAppDataDir/Templates is all about. You could put your custom templates in here if you would try to open .fcstd file with custom template on different location (different PC) instead of putting it in "system wide" template directory. Therefore be aware when using custom templates. You have to pack custom template + .fcstd file + instructions on how to open this file successfully if you will send this file to somebody else or try to open it on different PC.

For now i would advice you to not use custom templates or only use them if you know what you are doing and for use on your own PC. Everything else is will "blow up" sooner or latter.
triplus
Posts: 9278
Joined: Mon Dec 12, 2011 4:45 pm

Re: Localized Drawing templates ...

Postby triplus » Thu May 14, 2015 10:43 am

Sum up (to avoid bugs/restrictions/limitations) this is how you should do what you are after ATM:
  • Translate drawing template
  • Copy to system wide drawing template location.
  • Rename following naming convention. For example:
A4_Landscape_blanko.svg
A4_Landscape_ISO7200DE.svg

Important: Don't try to rename to any of the currently provided drawing template names as this would work but in future update or used on different PC it can easily "blow up".

Both drawing templates will be available in drop-down menu. If you will use them and want to open .fcstd file on different PC you will need to copy drawing templates to that location first. For example:

A4_Landscape_blanko.svg
A4_Landscape_ISO7200DE.svg

Would need to be copied to new PC in system wide drawing templates location or inside UserAppDataDir/Templates directory before opening .fcstd file. And remember to backup your custom templates as you will need to restore them in the future if for example reinstalling FreeCAD and opening .fcstd file where you used custom templates.

Additional notes:
  • You could probably have all custom templates inside UserAppDataDir/Templates folder and use macros with hardcoded paths to insert the drawing template instead of using drop down menu. I used to do it like that when there was no customization possible for drop down menu. This way you would avoid mentioned bug where you can't use Template Property ATM to change drawing template. But remember ATM you have to use UserAppDataDir/Templates or it won't work.
  • As said if you want different translation for Landscape and Portrait for German localization you need to do that (here).
  • Things could easily change in the future and for any future readers coming here first check what has changed in this area in FreeCAD before following this instructions!