I'm working a website with Laravel 4 with 3 languages supported (en, fr, es) ,

I need to make the localization file easily editable by users who don't have PHP skills but know XML.

My XML file looks like this :

<data>
    <menu>
        <home>Home</home>
        <contact>Contact</contact>
    </menu>
</data>

I would like to automatically parse this XML file and use it as source for localization. As it is my first project with Laravel, any suggestions? I know how to parse the XML but don't know how to tell Laravel to use this as localization source.

没有正确的解决方案

其他提示

  1. Create a loader that implement Illuminate\Translation\LoaderInterface,which load your xml as translation source

  2. Open app.php,and change Illuminate\Translation\TranslationServiceProvider to your own loader

3.You should be able to check it by calling trans("yourXmlFile.yourTerms");

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top