Info
- 4 posts
- 3 voices
- Started 5 years ago by wittmania
- Latest reply from wittmania
- This topic is not resolved
Syntax questions
-
- Posted 5 years ago #
A couple of questions about what syntax to use, especially on template pages:
1. I see that a lot of people use
_e('string...')instead ofecho('string...'). Is this just a bbpress/wordpress thing or is this generally acceptable php coding?2. In front-page.php of kakumei (and many other places), I see people using this shorthand echo where normal text would work just fine. For instance, in the hottags div, it is:
<h2><?php _e('Hot Tags'): ?></h2>Why would you have PHP echo that when you could just have it as plain ol' text in the first place? Am I missing something?
I realize neither of these is of any earth-shaking importance, but I would like to know so I can keep my code modifications in line with the default syntax that is used throughout. Thanks!
-
- Posted 5 years ago #
My assumption is that they're in place for localisation purposes. I don't know for sure.
-
- Posted 5 years ago #
fel64's assumption is correct. You can see the definition of _e() and __() in bb-includes/l10n.php:
...
// Return a translated string.
function __($text, $domain = 'default') {
...
// Echo a translated string.
function _e($text, $domain = 'default') {
... -
- Posted 5 years ago #
So, if I have a Japanese installation (for example), it would translate "Hot Tags" into its Japanese equivalent?
That makes sense. Thanks for the info.
-
You must log in to post.