More detailed explanation about how to use

Issue #4 closed
Guilherme Oderdenge created an issue

Hello.

I know that I'm annoying reporting thousands of issues about PhalconLocale, but I'm really interested on it and until now, I couldn't use it.

Everything is going very well by now, but I just don't know how to walk with my own legs, or saying in technician fashion, I don't know how to proceed after installation of the library.

I need to create a controller called EnUs and perform some tasks within? That's something like this?

My application before PhalconLocale carried this routes:

        $router->add(
            "/{language:[a-zA-Z]{2}\-[a-zA-Z]{2}}/:controller(\.volt\/?)?",
            [
                "language"      => 1,
                "controller"    => 2,
                "action"        => "index"
            ]
        );

        $router->add(
            "/{language:[a-zA-Z]{2}\-[a-zA-Z]{2}}/?",
            [
                "controller" => "index",
                "action"     => "index"
            ]
        );

And the $_GET['language'] was sending the user's idiom to the translation library to convert strings into the correctness.

TL;DR

I installed the PhalconLocale with composer successfully and know I don't know how to proceed. How should be the controller's name to work correctly? I already have some controllers and I don't want to delete them - what can I do to put the user in the right way of his idiom?

A little bit more

Two things to consider:

  1. en_US or en-US it's better? There's difference logically/conceptually?

  2. Every time that I access the application, I'm being redirected to /en_US/ and my pattern is /en-US/. There is a specific local where can I change this setting?

Thanks in advance!

Comments (4)

  1. Mark Garrett repo owner

    I set the class up to work with the routing group I included in the docs - so en_US. The underscore is how the locales are nominally written, and how PHP Locale::canonicalize returns is. Honestly, I should probably show the locale in the browser as en-us as that is how the browser Accept Languages header shows the value. The whole capitalization/underscore/dash issue is locale vs browser language thing that's been around for a very long time. I'll see what I can do to accept both _ and -

  2. Log in to comment