[Tiki-devel] tra or tr when use one or the other ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Tiki-devel] tra or tr when use one or the other ?

Bernard Sfez-3
Hello,

I see in PHP files that sometimes we use "tr" and sometimes "tra".
May be I’m missing a difference between case, or may be both are ok.

Can someone explain ?

Sample A
trunk/lib/userslib.php 2017-03-06 16:44:00 UTC (rev 61525)
+ 'description' => tra('Can view results from webservice requests'),

Sample B
+++ trunk/lib/wiki-plugins/wikiplugin_metatag.php (revision 61368)
+ 'description' => tr('Add custom meta tags to HTML head on page where the plugin is used'),


Bernard Sfez | bsfez.com


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] tra or tr when use one or the other ?

Jonny Bradley-4
Hi Bernard,

The tr function calls tra, so there's slightly more overhead calling tr but it can do the parameter replacement for %0 etc in the translation string, like

tr("Cannot remove item %0 from this tracker", $itemId)

so tra could be seen as "translate simple"... but i expect the extra overhead isn't really worth saving and we should just use tr everywhere maybe?

HTH

jb



On 8 Mar 2017, at 06:47, Bernard Sfez <[hidden email]> wrote:

Hello,

I see in PHP files that sometimes we use "tr" and sometimes "tra".
May be I’m missing a difference between case, or may be both are ok.

Can someone explain ?

Sample A
trunk/lib/userslib.php 2017-03-06 16:44:00 UTC (rev 61525)
+ 'description' => tra('Can view results from webservice requests'),

Sample B
+++ trunk/lib/wiki-plugins/wikiplugin_metatag.php (revision 61368)
+ 'description' => tr('Add custom meta tags to HTML head on page where the plugin is used'),


Bernard Sfez | bsfez.com

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] tra or tr when use one or the other ?

Bernard Sfez-3
Thanks

On 8 Mar 2017, at 12:04 , Jonny Bradley <[hidden email]> wrote:

The tr function calls tra, so there's slightly more overhead calling tr but it can do the parameter replacement for %0 etc in the translation string, like

tr("Cannot remove item %0 from this tracker", $itemId)

so tra could be seen as "translate simple"... but i expect the extra overhead isn't really worth saving and we should just use tr everywhere maybe?

Bernard Sfez | bsfez.com


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Tiki-devel] tra or tr when use one or the other ?

luciash d' being
In reply to this post by Jonny Bradley-4

Hi B and J,

yep, I agree, we should use only the tr() form instead of tra() because as you said it allows the %0 substitutions and it would be more consistent (and less confusing for new developers).

luci


On 03/08/2017 11:04 AM, Jonny Bradley wrote:
Hi Bernard,

The tr function calls tra, so there's slightly more overhead calling tr but it can do the parameter replacement for %0 etc in the translation string, like

tr("Cannot remove item %0 from this tracker", $itemId)

so tra could be seen as "translate simple"... but i expect the extra overhead isn't really worth saving and we should just use tr everywhere maybe?

HTH

jb



On 8 Mar 2017, at 06:47, Bernard Sfez <[hidden email]> wrote:

Hello,

I see in PHP files that sometimes we use "tr" and sometimes "tra".
May be I’m missing a difference between case, or may be both are ok.

Can someone explain ?

Sample A
trunk/lib/userslib.php 2017-03-06 16:44:00 UTC (rev 61525)
+ 'description' => tra('Can view results from webservice requests'),

Sample B
+++ trunk/lib/wiki-plugins/wikiplugin_metatag.php (revision 61368)
+ 'description' => tr('Add custom meta tags to HTML head on page where the plugin is used'),


Bernard Sfez | bsfez.com

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford


_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
TikiWiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel