• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Language strings support in localization

#1
I find it pretty hard to come up with unique language keys for every text strings. Its very useful if we have language string support in localization.

for example: lang('My text string');

Also its better we cant have alternative method for lang() method. like __(). its more cleaner and minimalitic.

Thanks.
Reply

#2
You are not required to always put your translations in a language file. You can do it directly:
PHP Code:
lang('The {0} is {1}.', ['fox''here]); // echoes "The fox is here." 

For the
Code:
__()
alias, you can do that in your own implementation. But if you want others to make use of it, you can submit a PR in the github repo.
Reply

#3
CI4 has a great online manual, you should always first look there and only afterwards flooding this forum.
https://codeigniter4.github.io/CodeIgnit...ation.html

I don't recommend and i don't support idea of "__()". That function has no general meaning, purpose, understanding what it stands for, will make more confusion than useability. That would be really bad to implement in CI4.
Reply

#4
I'm with davis.lasis on this one.
lang() is only 4 letters. I don't see how __() is an improvement.
Also, double underscores an reserved for magic methods: https://www.php.net/manual/en/language.oop5.magic.php
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
Reply

#5
I guess he saw that __() in other frameworks.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.