SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 41 of 41
  1. #26
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh one question,

    Do i create templates for multi language or per language?

    What i mean is, do i create templates like

    template/en/templates
    template/de/templates
    template/fr/templates

    OR

    i just create on etemplate and rather than putting menus (or any thing like for field names or something like that) in particular language, i AGAIN use INI file and use the language specific things??

    Because, if not so, they have to go and (copy and paste) templates and then change the words for partiicular language.

    If i use INI file, they have to only change INI file.

    which method is better in your opinion?>
    ---------------------------
    Errors = Improved Programming.
    My Site

  2. #27
    SitePoint Addict
    Join Date
    May 2003
    Location
    The Netherlands
    Posts
    391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana
    Oh one question,

    Do i create templates for multi language or per language?
    [...]
    If i use INI file, they have to only change INI file.

    which method is better in your opinion?>
    I don't know why you would have to use different templates for different languages, I don't know what your requirements exactly are. Normally you would use it only when the language to be displayed differs in lay-out, as for example the case would be with Chinese or Arabic, where as opposed to Western languages, the direction of the text goes from right to left. Otherwise I would suggest to use the same template and only replace the strings with the correct translation. For more info on this subject I'd suggest also to take a peek at PRADO. Wei is a developer for PRADO and the responsible of building the I18N support into it. He's also a member of SP and you'll find a number of post from him on this subject right here on SP.

    As for the use of INI files, I would go always for it as long as their structure is enough to reflect the data you'll be needing. Unfortunately, INI files are limited as to how many levels deep you may nest your data into, so beware of that.
    There’s more than one way to skin a cat.

  3. #28
    SitePoint Guru
    Join Date
    May 2005
    Location
    Finland
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Quote Originally Posted by BerislavLopac
    No I didn't.
    In spite of sounding repetitive: yes, you did. "INI and CSV files have a tremendous advantage from a practical standpoint" - just those two?

    Personally, I prefer the approach where each language has its own file, as you very rarely need more than one language at the same time. Then I use INI file sections for sections of application or individual pages, depending on the context.
    That's a good point, and one I missed myself.

    As for using a different template for each language - usually you won't need to do that. It's enough to use helpers to format dates and such. I'm not saying a situation warranting such an elaborate solution is impossible, but that it's rare enough not to consider before you actually feel the need.

    Gettext seems like a major hassle. I'd likely just put together a simple system of my own. Many frameworks define a gettext-like __() function for i18n purposes - that's what I'd do, too.

  4. #29
    SitePoint Guru
    Join Date
    May 2005
    Location
    Finland
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Variable messages are one thing to think about. How's this for one:
    PHP Code:
    if($message_count == 1) {
       echo 
    __('You have one new message.');
    } else {
       echo 
    __('You have {num} new messages.'$message_count);


  5. #30
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ezku
    Variable messages are one thing to think about. How's this for one:
    PHP Code:
    if($message_count == 1) {
       echo 
    __('You have one new message.');
    } else {
       echo 
    __('You have {num} new messages.'$message_count);

    You could just do;
    PHP Code:
    $body->assign('num'$lang['nums']['three']);

    // Language file looks like this then (php array)
    $lang['nums']['one'] = 'Uno';
    $lang['nums']['two'] = 'Dos';
    $lang['nums']['two'] = 'Tre';
    // Etc 
    or something similar

  6. #31
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ezku
    In spite of sounding repetitive: yes, you did. "INI and CSV files have a tremendous advantage from a practical standpoint" - just those two?
    From a practical standpoint, YAML has the disadvantage of being overly dependent on proper formatting, and from my experience most translators are not tech savvy enough to know or care about formatting issues. CSVs easily translate to Excel tables, which is mostly used by them (along with Word, of course), while INI is not dependant on the formatting: "just translate everything after a colon".

  7. #32
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The best way to make a multilingual application is to separate hard coded code from the dynamic generated code. So the multilingual part has to come as a part of the dynamic code (that's where PHP comes in).
    Otherwise you make it hard to make even a slight change later

  8. #33
    SitePoint Wizard Mike Borozdin's Avatar
    Join Date
    Oct 2002
    Location
    Edinburgh, UK
    Posts
    1,743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way, I guss you have a some kind of CMS that you use for adding data, right? So you will have a filed in the table 'language' that will determine that this record beloings to a particular language?

  9. #34
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not using any CMS. I just meant to ask this question, so i know how i can make multilanguage applications in future. or atleast the basis.
    ---------------------------
    Errors = Improved Programming.
    My Site

  10. #35
    SitePoint Wizard Mike Borozdin's Avatar
    Join Date
    Oct 2002
    Location
    Edinburgh, UK
    Posts
    1,743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana
    I am not using any CMS. I just meant to ask this question, so i know how i can make multilanguage applications in future. or atleast the basis.
    You must have misunderstood me. Since you are talking about creating a multi-language application, you are going to build a one, people will be able to add some content, right? I was asking about the way of storing multi-lingual content.

  11. #36
    SitePoint Enthusiast didimo's Avatar
    Join Date
    Jan 2006
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysql 5 has good unicode support

  12. #37
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh yes, i think i misunderstood.

    I dont even know what kind of application i would built. I was just getting information so i'll know what to do when i start one. But, yeah i understand what you mean.

    I had this problem last week, but in that application the data was grabbed from Google API in different language (user dint need to add any data).

    But, for content site, yeah in CMS i would allow different languages.

    Now, i have to find an editor which can have multiple languages.
    ---------------------------
    Errors = Improved Programming.
    My Site

  13. #38
    SitePoint Enthusiast didimo's Avatar
    Join Date
    Jan 2006
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    checkout komodo

    its a great php editor with unicode support [unlike zend studio ]

  14. #39
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, i meant, PHP Editor which i can use for my small CMS system, rather than creating one.

    i mean, wysiwyg editor (i think).

    Off Topic:


    BTW, is komondo resource hog like zend studio or is it simple like Ultra Edit??
    ---------------------------
    Errors = Improved Programming.
    My Site

  15. #40
    SitePoint Enthusiast didimo's Avatar
    Join Date
    Jan 2006
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unlike zend studio which is writen in java and is quite slow, komodo is very fast ( http://www.activestate.com/Products/Komodo/ )

    btw why would u need a wysiwyg editor for php (is such thing possible?or needed?)

  16. #41
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not for PHP, but for CMS system, which i can use in my applications, so users can use it and publish data online.

    Like FCKEditor or something.
    ---------------------------
    Errors = Improved Programming.
    My Site


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •