1
There is a way to put in .po
strings outside the _e()
?
For example, hypothetically, 'real' for 'dollars'. If on a page I quote real 517 times I will translate 517 times. Instead I intend to use _p('reais')
(hypothetically, p of pegarStringDoArray()
), a function that finds inside array. Then it would have _e( "Custa 2.43 %s", _p('reais') )
.
My question is the following: I can translate strings that are outside the eco()
and if so how?
If I haven’t made myself clear I can better illustrate.
Note: Google does not have everything... search by "php gettext array of strings" only returns comparative speed... "php gettext for common used strings" becomes a single mess.
reading my question and to illustrate better, I can change it( "It costs 2.43 %s", _p('real') to _e( "%s: 2.43 %s", _p('Value', 'real') )
– Jefferson S. Siqueira
@Maiconcarraro I don’t think it’s duplicate, it’s just related. The question you pointed out is generic about translation and localization applied to PHP. Already this from here is a specific doubt on the implementation of this.
– Victor Stafusa
@But in doing so, you voted for the closing. And if you voted to close as a duplicate, I understand it’s because you think this question should be closed because it’s a duplicate, after all that’s what the vote means. If you want the question to remain open and only indicate that there is another related one, just have posted a comment with the link.
– Victor Stafusa
I don’t quite understand your doubt... Can you explain how you’re doing?
– Papa Charlie
@Papacharlie like this: I can implement anyway, but I imagined creating an array $gettext= array('First widely used string', 'Second widely used string')... For instead of using on the echo(), _(), _e()... I can at any time use $gettext['Very first string used']...
– Jefferson S. Siqueira
@Papacharlie this is just an example... I don’t intend to use it that way. Array in this case would be the strings I use too much, such as months' name... Numbers up to 20 in full... got it... if I give _('January') 200 times it’s better to use only one January instead of translating 200 Windows
– Jefferson S. Siqueira
@Papacharlie being so, I did not implement because regardless of the way I use... only comes out on the echo... in sprintf... and I intend to have variables instead of using the echo. My _e() function for example automatically detects sprint %s and others, __e() makes the plural... But I want an array with standard strings to use with %s in _e() and __e(). I think I explained it a little better this time.
– Jefferson S. Siqueira
You could have edited the question with this information to make it more readable. Are you using any FW? It’s Cake?
– Papa Charlie