For some very odd reason the text found on user/%user/tokenauth ("You may use an alphanumeric token to see restricted content...") is saved in a variable in the database. I have got no clue why this would be a good idea. How many administrators would need to replace that text? The text does convey the information it needs to...
I suggest the string is properly wrapped in a t() to make it translatable to more than one language (storing a translated value in the database won't work for multilingual sites/users with different languages). This will allow all users to have it translated to their language.
I've gone through the module and removed all instances of the variable tokenauth_text and optimized the code, where it was needed.
| Comment | File | Size | Author |
|---|---|---|---|
| tokenauth-remove_tokenauth_text_variable_to_allow_translations.patch | 4.28 KB | lund.mikkel |
Comments
Comment #1
Grayside commentedThe text for that UI is set because Tokenauth serves a wide number of use cases and workflows because of it's configurability. If we were to add #990468: Setting to always add token to links we could discuss moving the UI to a separate module, and treating it more as an example than a configurable feature.
As such, using t() to fix this is unacceptable, however using the utilities provided by modules like i18n might take this forward.
Comment #2
lund.mikkel commentedI'm not sure I quite follow you. The current setup may be configurable, but it still doesn't allow for translations on multilingual sites...
Why is t() unacceptable in this case?
Comment #3
Grayside commentedTook a closer look, seems I mistook your argument for the patch.
To address the actual change:
tokenauth_text_load()does have default text that can be wrapped in a t(), but there are two problems with this:My point is thus that t() is not compatible with the existing configurability, but internationalization functionality is compatible.