I would like to add Sphinx roles (e.g. :ref:`some-link`, :class:`someClass`, meth:`some_method`) to my python-doc organization’s glossary so I can be sure that they are not missing in the translations.
I tried adding them as shown in the above examples, but Transifex will not match them in the source string.
I was only successful when matching “:ref:`Availability”, probably because it ends with letter characters (differently form the above examples).
How can I add sphinx roles to glossary and have them successfully match in source string?
Thank you for reaching out to Transifex support.
By what you mentioned I assume you are looking for some type of variables to match whatever text is after certain words, Am I right ? for example “class: $textVariables”. If this is the case then our Glossary is not an option as there is no logic but to match the specific text between the string and the glossary. Perhaps our Translation Checks could help you achieve what you need, Please give it a try and let me know if you have any further questions.
Working in your suggestion I tried adding custom placeholder like :...:`, :[a-zA-Z]+:` , and :class:` as an attempt to match the beginning of occurrences like e.g. :class:`turtle`, however it didn’t see it as a placeholder in the Editor.
Now, In the editor, we can see that the placeholder was recognized
Let me know if this example helps or if you encounter any further issues
Best Regards
Cesar
After reading your message, I realized that I was trying to enter placeholders using the “Enter a custom variable” field, and, for some reason, entering placeholders like :class:`...` didn’t work.
However when I used your strategy and used “Starts with:” and “Ends with” fields, the placeholders worked! For instance, I set :class:` as start and ` as end, and now occurrences like :class:`turtle` are successfully considered placeholders!
Genius. It turned 54 placeholders into 2, and works perfectly. Thanks.
EDIT: Actually, only the first custom placeholder is matched, and the second one is ignored. Looks like the first match of :` makes it impossible to match the second placeholder.
I apologize for the inconvenience, Yes, This is expected behavior as order matters inside placeholders, meaning that if the first instance is a match then the 2nd one will be ignored
I wish I could regex somehow like :[\w]+:`, but doesn’t seem to work. I read in the docs it is not available for free plans (quoting the docs: Custom translation checks is a feature available on Premium and Enterprise plans).
Thought about it too but feared a technical/security reason for not implementing them…
… but that looks like a marketing choice, actually
If I can understand it for private projects, I believe it is an error to not bundle it for public/open source projects.
If this is for the docs of the project I think it is, maybe Transifex could grant it at least a Premium plan…
We really appreciate your feedback, I have forwarded your comments to my product team.
As you already mention REGEX is only available for premium plans and up, at least for now.
@rffontenelleUPDATE
Please receive my apologies as I forgot to mention that order matters when placing translation checks. Could you try to perform the following and see how it goes ?
one for roles values: starting with “:”, ending with “”.
one for roles names: starting with “:”, ending with “:`”,
Sorry for taking too long to reply, but I wasn’t notified of your message update.
I tried your suggestion and what happened was that only the first custom placeholder was applied, and the second one was ignored. For instance, the expression :data:`sys.path_hooks` becomes :data:`sys.path_hooks` (i.e. only :`sys.path_hooks` becomes a placeholder, while the :data is left as a normal text.)
I assume the second placeholder didn’t kick in because the ending :` already met the previous custom placeholder.
I apologize for the delay.
Regarding your last comment, As I mentioned before, This is expected behavior as order matters inside placeholders, meaning that if the first instance is a match, then the 2nd one will be ignored Unfortunately, there is no workaround to avoid this as is part of our logic but in case you have any other questions please feel free to reach out to us.