0

I need to implement Gettext. If I have to translate

<p>Title: </p>

I can use the following:

<p><?php _e("Title: ","language");?></p>

Which is pretty simple for single word of sentences in PHP files. However how can I implement the above Gettext if in PHP I have already

<?php  the_tags('Tags: ', ', ', '<br />'); ?>

?

What I would like to translate is the word "Tags: "... but I can't figure out how to wrap the work "Tags"... or how to change the code...

Thanks

Pikk
  • 2,343
  • 6
  • 25
  • 41
  • _“What I would like to translate is the word "Tags: "”_ – and that does not work in the same way as it does with the word _Title_ _because_ …? – CBroe May 03 '14 at 21:51
  • @CBroe I am looking how to write the right Gettext for "Tags". I was thinking that something like the_tags(__"('Tags: ', ', ', '
    ')", "language"); ... but I don't think it works like this....
    – Pikk May 03 '14 at 21:55
  • If `_e("Title: ","language")` translates the term `Title: ` to your satisfaction, then what code would probably do the same for the term `Tags: ` …? – CBroe May 03 '14 at 21:58
  • If tags was out of PHP code and was like `

    Tags:

    ` then it would have been `_e("Tags: ","language")`. But in this case I have `the_tags('Tags: ', ', ', '
    ');` and I don't know how to edit that the right way, thus I decided to write here.
    – Pikk May 03 '14 at 22:01
  • Well, `_e` is for direct output of a translation, and `__` is its counterpart to only get the translation as a return value, so that it can be used within other functions. But in your code line you mentioned in your comment you are passing nonsense parameters to it. – CBroe May 03 '14 at 22:08
  • nonsense parameters? They do have a sense 'the_tags( $before, $sep, $after );'. See here: https://codex.wordpress.org/Function_Reference/the_tags it displays a list of the tags with a line break after it. – Pikk May 03 '14 at 22:10
  • I meant parameters for the `__` function. (But you are not even actually calling that within the shown code, because that would require a `(` after the function name.) – CBroe May 03 '14 at 22:26
  • I think I found the answer to my question... it seems that the right code I have to use is `the_tags(__('Etykiety: ','language'), ', ', '
    ');`
    – Pikk May 03 '14 at 22:29

0 Answers0