What does the underscore translate function do in my code without a textdoman
I am hooking into comment_form_default_fields
doing some heavy string replacements.
There are translated strings like __( 'Name' )
in there. I need the text.
I have two or three different ways to solve this.
- I could just use my own text domain, but that would mean I have to provide my own translation for my code, do not like that. Especially because I just reuse already translated strings.
- Extract the text (with regex). Better but not a huge fan either.
- Just use the same words
__( 'Name' )
as in core without textdomain?
The translation is done by lines in files to some extent I think, but when lines change the translations do not suddenly stop to work correctly, but I think there can be different translation for the same world, and it will pick the right ones. If the translation is properly done.
My question is what actually happens when I use no domain? Will it work at all? Will it just pull the first translation for a word it can find in WP core?
Topic xgettext localization Wordpress
Category Web