Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extraction on a folder #7

Open
syrjay opened this issue May 20, 2022 · 3 comments
Open

Extraction on a folder #7

syrjay opened this issue May 20, 2022 · 3 comments

Comments

@syrjay
Copy link
Collaborator

syrjay commented May 20, 2022

Hi @lassoan , Actually I have improved the extraction package so that it can run on a folder containing several .py files
in this case, what would be the context name? It won't be able to be packagename.classname, because we will have several files in the folder, I don't know if you understand what I mean...

@lassoan
Copy link
Collaborator

lassoan commented May 20, 2022

In Python, the same classname is often used in multiple packages, that's why we need to add the package name (which is the folder name) to generate a context name. So, the context name is folderName.className.

For example, for this message, the context would be DICOM.DICOMFileDialog. This is not completely arbitrary, because this is the same how you would access this class in Python:

>>> import DICOM
>>> DICOM.DICOMFileDialog
<class 'DICOM.DICOMFileDialog'>

The filename is not used for generating the context name. We would only use the relative file path and line number in the location attribute, for the translator's convenience (so that he can look up where exactly each string comes from).

@syrjay
Copy link
Collaborator Author

syrjay commented May 20, 2022 via email

@lassoan
Copy link
Collaborator

lassoan commented May 21, 2022

Dialog context is an exception. lupdate picked up some unused file (qSlicerAnnotationModulePropertyDialogWIP.ui). The whole Annotations module (Modules\Loadable\Annotations) will be removed soon.

For normal cases, you'll see that the context is the class name for classes defined in C++ code and by .ui fies. However, this is insufficient for Python, becase in Python the same classname is often used in multiple packages. That's why we need to add the package name (which is the folder name) to generate a context name. So, the context name for Python classes is folderName.className.

If you have any doubts what the context name should be for any string in any .py file then let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants