Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Language file loaded merged
  • Hi,

    I've a problem using the Lang Class.

    I've different language files in different folders : "lang/en/main.yml", "lang/fr/main.yml"

    If I'm in the default language (en), all works fine. But, if I'm in "fr", it works partially. All strings are correctly translated except one group of strings (dates). Here my files and lines which doesn't work :

    EN :
    "
    dates:
        months:
            1: "January"
            2: "February"
            3: "March"
            4: "April"
            5: "May"
            6: "June"
            7: "July"
            8: "August"
            9: "September"
            10: "October"
            11: "November"
            12: "December"
    "

    FR :
    "
    dates:
        months:
            1: "Janvier"
            2: "Février"
            3: "Mars"
            4: "Avril"
            5: "Mai"
            6: "Juin"
            7: "Juillet"
            8: "Août"
            9: "Septembre"
            10: "Octobre"
            11: "Novembre"
            12: "Décembre"
    "

    When I see "Debug::dump(Lang::$lines);" in "en", all is ok. But in "fr", I see a merged array of english values first and then french values.
    But this is only with this group of strings, the rest works fine. I don't understand why.

    Thank you in advance for your help.
  • HarroHarro
    Accepted Answer
    There is currently no support for multiple concurrent languages, there is only one Lang object, containing a single multi-dimensional array to store the strings.

    Secondly, numeric keys are not supported in Lang and Config. Arr::merge() will not overwrite then, so you'll see the entries double. Lang arrays MUST be associative.
  • Ok, I've renamed like this :

    dates:
        months:
            m1: "January"
            m2: "February"
            m3: "March"
            m4: "April"
            m5: "May"
            m6: "June"
            m7: "July"
            m8: "August"
            m9: "September"
            m10: "October"
            m11: "November"
            m12: "December"

    And now all works fine.

    Thank you !
  • For your info, Fuel v2 will support multiple languages concurrently, so it doesn't have this merge issue.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion