Professional Web Applications Themes

Translating output of PHP functions - PHP Development

The standard output of a PHP function (like date, time etc) is English. However, I need to translate them to Danish. Does anybody know a easy way to do this? Is there a functionality to do translations like this I am not aware of? The main issue is to translate things like "Tuesday, 11 October 2005" into Danish (or any other language for that matter). Jochem...

  1. #1

    Default Translating output of PHP functions

    The standard output of a PHP function (like date, time etc) is English.
    However, I need to translate them to Danish. Does anybody know a easy
    way to do this? Is there a functionality to do translations like this I
    am not aware of?

    The main issue is to translate things like "Tuesday, 11 October 2005"
    into Danish (or any other language for that matter).

    Jochem

    Jochem Guest

  2. #2

    Default Re: Translating output of PHP functions

    "Jochem" <com> 

    Prepare tables like:
    Day array=(DanishNameOfDay1, DanishNameOfDay2...)
    Month array=(DanishNameofMonth1...)
    then get the date in format 01-28-08-2005 exploded into 4 variables:
    daynum,day, month,year.
    Then get the proper values from the arrays:
    DanishDate=$Day[$daynum]."-".$day."-".$Month[$month]...

    Regards,
    Talthen


    Guest

  3. #3

    Default Re: Translating output of PHP functions

    Jochem wrote: 

    You can use the setlocale() function:

    /* Set locale to Danish */
    setlocale(LC_ALL, 'da_DK.ISO_8859-1');

    /* Output: fredag 22 december 1978 */
    echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));

    This is based on the info found at http://www.php.net/setlocale; also notice
    the user contribution from misc dot anders at feder dot dk
    on that page.


    JW


    Janwillem Guest

Similar Threads

  1. Translating from Flex to AS3
    By SiHoop in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: June 25th, 06:52 PM
  2. Help translating fread to substr
    By RootShell in forum PHP Development
    Replies: 1
    Last Post: May 4th, 10:02 PM
  3. Translating individual vertices
    By findoutstuff webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 0
    Last Post: February 5th, 11:42 AM
  4. Replies: 0
    Last Post: August 20th, 01:39 AM
  5. Help translating PHP to ASP
    By Jules in forum ASP
    Replies: 3
    Last Post: July 29th, 12:58 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139