How to work with system/user parameters.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: How to work with system/user parameters.
Thanks I will try to prepare PR for review with translation in App.
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
- adrianinsaval
- Veteran
- Posts: 5551
- Joined: Thu Apr 05, 2018 5:15 pm
Re: How to work with system/user parameters.
@yorik @wmayer could you guys confirm this?adrianinsaval wrote: ↑Sat Jul 09, 2022 4:31 pm according to this post: https://forum.freecadweb.org/viewtopic. ... 30#p600030 it might be possible to translate stuff at the App level now.
It might be necessary to remove the "Unnamed" argument from all those lines you mentioned in my PR so they will just use the function's default value that would be translated.
Re: How to work with system/user parameters.
I prepare PRadrianinsaval wrote: ↑Sat Jul 09, 2022 9:01 pm@yorik @wmayer could you guys confirm this?adrianinsaval wrote: ↑Sat Jul 09, 2022 4:31 pm according to this post: https://forum.freecadweb.org/viewtopic. ... 30#p600030 it might be possible to translate stuff at the App level now.It might be necessary to remove the "Unnamed" argument from all those lines you mentioned in my PR so they will just use the function's default value that would be translated.
https://github.com/FreeCAD/FreeCAD/pull/7156
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
Re: How to work with system/user parameters.
This is the wrong way and it causes a (minor) regression because if only the first argument is passed the Label will always be set to the translation of "Unnamed" and this is not what (macro) programmers want to have.
Example:
Code: Select all
doc = App.newDocument("This_is_a_special_name")
doc.Label # => This is not "This_is_a_special_name" but "Unnamed"
Code: Select all
std::string Application::getDefaultDocumentName()
{
QString name = QObject::tr("Unnamed");
return name.toStdString();
}
Code: Select all
App::GetApplication().newDocument(App::GetApplication().getDefaultDocumentName().c_str())
On many systems the translation of "Unnamed" will contain non-7-bit ASCII characters and at the moment each of them will be replaced with '_'. So, in the worst case you can end up with a document name "____________".
Since Py3 supports unicode for its identifiers we can make this less restrictive for our internal names (documents and document objects), too.
Re: How to work with system/user parameters.
Thanks. I understand my mistake.wmayer wrote: ↑Mon Jul 11, 2022 11:55 amThis is the wrong way and it causes a (minor) regression because if only the first argument is passed the Label will always be set to the translation of "Unnamed" and this is not what (macro) programmers want to have.
Example:Code: Select all
doc = App.newDocument("This_is_a_special_name") doc.Label # => This is not "This_is_a_special_name" but "Unnamed"
Please review this https://github.com/FreeCAD/FreeCAD/pull ... 9b2c93ae48
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki