andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


multilanguage

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> String Functions
View previous topic :: View next topic  
Author Message
V@no
Light Poster


Joined: 10 Apr 2003
Posts: 30

PostPosted: Sun Oct 17, 2004 3:01 am    Post subject: multilanguage Reply with quote

Hi!
Its very nice class!
What do u think to add an multilanuge function?
I mean, in the input a text that has more then one language separated by "tags" and the output would return only the needed language part from the text.
I'm using this method on my site, u can see the function here:
http://gallery.vano.org/multilang.php
if u think its usefull and want to add in your class feel free to do so.
if u know any other way to accomplish this or how to optimize it, please let me know Wink
I know preg_match is not the best way to do...
Back to top
View user's profile Send private message Visit poster's website
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Sat Oct 23, 2004 7:32 am    Post subject: Reply with quote

Hi V@no,

It's a good idea, certainly. I'm not sure it quite fits into the string functions class, and it's more for the manipulation and testing of strings rather than to do with languages itself. What you're proposing could certainly be a class unto itself, and would certainly be benificial in that way.

I'm not sure of the viability of putting the tags in with the text though. IF you have a lot of text then the tags could get easily lost, or you might have to scan/search for them when trying to update the text.

In the past I've created multiple level arrays, indexed first by country and then by the string indicator, such as:

Code:
$lang['uk']['error'] = 'Sorry,there has been an error';
$lang['ru']['error'] = 'Whatever the translation would be in russian';


I've also used different files for different languages, such as us.lang, ru.lang, etc., and then loaded those at runtime based on what language was required, rather than loading all of the languages in one go as I would with the above array example.

I think in the above two ways, maintainability is higher, though it might take up a little more memory because you have a complex structure. However, access time might be faster because you're using a hash and not regular expressions to get the tag positions.

Some thing to think about, perhaps?

Thanks for the suggestion!!

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
V@no
Light Poster


Joined: 10 Apr 2003
Posts: 30

PostPosted: Sat Oct 23, 2004 11:16 am    Post subject: Reply with quote

yes, thats the case when everything is static, but when text is dynamic or stored in database that could be problem. So other words, this method is more suitible for text that not being set in php but stored somewhere externaly, in the database.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> String Functions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group