Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add dummy translation function to mark translatable strings #1421

Merged
merged 8 commits into from
Oct 4, 2017
Merged

Add dummy translation function to mark translatable strings #1421

merged 8 commits into from
Oct 4, 2017

Conversation

pafcu
Copy link
Contributor

@pafcu pafcu commented Sep 22, 2017

Signed-off-by: Stefan Parviainen pafcu@iki.fi

Add a new function _td() which is used to mark strings as translatable in contexts where _t() does not work (i.e. before translations have been initialized). It does not actually do anything with the strings, just returns the input. You still need to call _t() later to do the actual translation.

Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
@ara4n
Copy link
Member

ara4n commented Sep 24, 2017

this is great, thanks! I suspect it needs to be added to the translation readme otherwise nobody will understand how to use it...

@pafcu
Copy link
Contributor Author

pafcu commented Sep 24, 2017

Sure, I'll add it to the documentation too. However, I wanted to see if I get some protests regarding e.g the function name (I suppose it might be better with e.g. translatable(), or not having the leading underscore), but I decided to go with something as similar as possible to the existing _t() function. The one-letter difference does make it easier to extract strings using a regular expression since you can just find everything using _t(d|Jsx)? rather than something more complex.

@ara4n
Copy link
Member

ara4n commented Sep 26, 2017

_td() is fine by me; we already have _tJsx and huffmanizing super-common special functions like this. plus it'll be trivial to change in future!

@pafcu
Copy link
Contributor Author

pafcu commented Sep 27, 2017

element-hq/element-web#5110 now also includes a commit to document when to use _td()

@ara4n
Copy link
Member

ara4n commented Oct 2, 2017

lgtm - thanks!

@lukebarnard1
Copy link
Contributor

lukebarnard1 commented Oct 3, 2017

@pafcu I've reviewed element-hq/element-web#5110

@lukebarnard1 lukebarnard1 merged commit 011aadc into matrix-org:develop Oct 4, 2017
@pafcu pafcu deleted the develop branch October 4, 2017 09:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants