Timeline for Is this really always bad? (variables in l10n functions)
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 13, 2018 at 12:05 | history | edited | Luca Reghellin | CC BY-SA 4.0 |
added 196 characters in body
|
Jul 31, 2017 at 13:21 | vote | accept | Luca Reghellin | ||
Jul 31, 2017 at 13:20 | comment | added | Luca Reghellin |
@Milo: _e2('hello','stratboy','it_IT') contains the string 'hello' (and the string 'hello' is supposed to be in a .po/mo file). Anyway, in my case it's for a file to be used in admin so not sure PoEdit would indeed recognize even regular _e() calls. I also very often do not use PoEdit (even if I have the pro version) because I like to organise .po files my way, put meaningful comments and so on.. Anyway, I get the point. You're right if you need to always use auto-tools, but I'm happy to hear, cause I thought there were much more issues with the thing :)
|
|
Jul 28, 2017 at 16:16 | comment | added | Milo | I mean, how do you generate the file of strings to be translated? That's the problem with using variables in translation functions. The tool that extracts strings to be translated won't find anything, because the function calls contain variables, not static strings. | |
Jul 28, 2017 at 15:36 | history | edited | Luca Reghellin | CC BY-SA 3.0 |
added 66 characters in body
|
Jul 28, 2017 at 15:33 | comment | added | Luca Reghellin | If you take a look to __2(), you'll see this: load_textdomain($textdomain, get_template_directory() . '/languages/'. $locale . '.mo'); | |
Jul 28, 2017 at 15:25 | comment | added | Milo | I did read it. You haven't explained how strings can be extracted for translation. I assume you have done this manually? | |
Jul 28, 2017 at 13:27 | comment | added | Luca Reghellin | You probably didn't read the article. It's not mine. It's an article explaining l10n "bad practices". Probably you didn't face this argument, so, apart from this thread, I strongly recommend you to read the article I linked, cause it's really important and useful. My question is about edge cases. | |
Jul 28, 2017 at 13:22 | comment | added | Milo | You don't at all address the reason why this doesn't work as explained in the page you linked, or how to solve that. | |
Jul 28, 2017 at 12:18 | history | answered | Luca Reghellin | CC BY-SA 3.0 |