-
Notifications
You must be signed in to change notification settings - Fork 3
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
Comments
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
The filename is not used for generating the context name. We would only use the relative file path and line number in the |
Yes it is possible when it is a single file, that's what I did, but here it
is about extracting strings in several files at once. For example when I
tried the same thing with lupdate on the Slicer folder, the context name is
"Dialog"... but for the location tag, I can find the exact path for each
string.
Le ven. 20 mai 2022 à 02:27, Andras Lasso ***@***.***> a
écrit :
… 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
<https://github.com/Slicer/Slicer/blob/43e8f5b2407b4c83509406b1acf266e25412eb49/Modules/Scripted/DICOM/DICOM.py#L490-L491>,
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).
—
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO5IL6KZFMCAFH4KF466MADVK32B5ANCNFSM5WN2TG2Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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 If you have any doubts what the context name should be for any string in any .py file then let me know. |
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...
The text was updated successfully, but these errors were encountered: