0

i am making a website with phalcon framework. i want to make multilanguage. i did it but i don't do it like above :

-app/
     controllers/
     models/
     forms/
     views/
     langs/
           en/
              login/
                    sign.php
                    register.php
           ru/
              login/
                    sign.php
                    register.php
           de/
              login/
                    sign.php
                    register.php
           fr/
              login/
                    sign.php
                    register.php

i want to set up language system like that. how can i do that ?

Hanik
  • 317
  • 2
  • 6
  • 25
  • Are you going to make a folder with subfolders for each language? That seems like a whole lot of work, in the long run. Check the [Phalcon translator](https://docs.phalconphp.com/en/latest/reference/translate.html) or the [Incubator](https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Translate/Adapter) for examples of implementations – Timothy Aug 05 '16 at 08:05
  • @Timothy thanks bro . i will chek all ... – Hanik Aug 05 '16 at 08:08
  • @Timothy i checked all before but i don't want like that . i want set up 1 language folder which is main and multiple subfolder . – Hanik Aug 05 '16 at 08:09
  • Well, you can create a path to your subfolder files to load your translations with something like `your-active-language + $this->dispatcher->getControllerName() + $this->dispatcher->getActionName()`. – Timothy Aug 05 '16 at 08:16
  • @Timothy, assuming that i did make a base controller and write a function for getting value of choosen lang. i want to use this lang php file in forms . how can i do that . should i make a base form like base controller ... how ? – Hanik Aug 05 '16 at 16:54
  • You should create a separate Translation class and inject it into your DI, this way you can access it from everywhere – Timothy Aug 05 '16 at 19:21
  • Do you still need help with this? – Timothy Aug 12 '16 at 07:29

0 Answers0