Question

I'm including gettext library in my application. But, as our team decided to go with native php gettext. The gettext library accepts the string and converts it using the "Translate" function which is defined in the library. Now how can I shift suddenly to native lib? Is it only for performance? Any suggestions on using native lib. Thanks in advance.

Was it helpful?

Solution

It is mainly for performance and well as ease of use.

When you use an external library inside PHP using system() for e.g., then the pros are that you will be able to use ALL of its options, which will make you a power user. The cons are that, each time you run it, you have to do like a parsing of the return string and then figure out the results and stuff, which is a hassle and pretty error prone.

When you use a language-binding of the external library, then cons are that you are confined to the API calls that the binding provides. The pros are that the return values, the error status etc will be well defined within the API calls so handling the calls will be easier.

This is usually a tradeoff and it will vary from case to case as to whether one should use native interfaces or just execute the library directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top