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.
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!
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).
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.