Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

whats new with locales

Asked Modified Viewed 1,841 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

Hi i was some month out of PHP Fusion and saw, that some changes makes in new PHP Fuison. In my own infusion dosent work all locale anymore. Guess here was some changes of global basis.

Can anyone tell me with some words what i have to do that my locals work again?
thank you
0 replies

6 posts

R
Anonymous User
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
answered
Veteran Member

Add $locale = fusion_get_locale();
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

thank you for your repley. hmnn dosent work ... damn

must i have this Register local somewere for working?

this was my old:
// Locale
// Check if a locale file is available that match the selected locale.
if (file_exists(INFUSIONS."figurelib/locale/".LANGUAGE.".php"wink) {
// Load the locale file matching selection.
include INFUSIONS."figurelib/locale/".LANGUAGE.".php";
} else {
// Load the default locale file.
include INFUSIONS."figurelib/locale/English/locale_figurelib.php";
}
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Locale class was added so it will not load globally unless you intentionally do so - See method 1.

Through global method, the security concern was that your locale may not be protected from variable injection or mutation. But the latest locale class clearly eliminate this problem while retaining the original purpose. See method 2.

Both method work and depends what you need it to do, can work.


 /*
         * Method one: additional push
         */
        $locale = array();
        // Check if a locale file is available that match the selected locale.
        if (file_exists(INFUSIONS."figurelib/locale/".LANGUAGE."/locale_figurelib.php" )) {
            // Load the locale file matching selection.
            include INFUSIONS."figurelib/locale/".LANGUAGE."/locale_figurelib.php"
        } else {
            // Load the default locale file.
            include INFUSIONS."figurelib/locale/English/locale_figurelib.php";
        }
        $locale += fusion_get_locale();
       print_p($locale); // Here, $locale is a string, and accessible globally.


        /**
         * Method two: load into library on refresh.
         * File: your_infusion/infusion_db.php*
         *
         * Add the lines:
         */
        $locale = \PHPFusion\Locale::__getInstance('Default');
        $locale::setLocale(file_exists(INFUSIONS."figurelib/locale/".LANGUAGE.".php") ? INFUSIONS."figurelib/locale/".LANGUAGE."/locale_figurelib.php" : INFUSIONS."figurelib/locale/English/locale_figurelib.php");

// This method will set the locale values into the instance of locale.
// All your files can access the newly added library locale values ....

// In any file...
$my_total_locale = fusion_get_locale(); // will print figurelib locale as well because it was added.
print_p($my_total_locale);

Edited by Chan on 01-11-2017 07:52,
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

thank you very much for your answer .... but both method dosent work .. somethink i make wrong

what i have do:

i have add this lines in my figurelib/infusion_db.php ->
$locale = \PHPFusion\Locale::__getInstance('Default'wink;
$locale::setLocale(file_exists(INFUSIONS."figurelib/locale/".LANGUAGE.".php"wink ? INFUSIONS."figurelib/locale/".LANGUAGE."/locale_figurelib.php" : INFUSIONS."figurelib/locale/English/locale_figurelib.php"wink;

i have add this file: -> $my_total_locale = fusion_get_locale();

and get this: Fatal error: Cannot use object of type PHPFusion\Locale as array in /var/www/vhosts/aliencollectors.com/httpdocs/site/infusions/figurelib/locale/English/locale_figurelib.php on line 2

what im doing wrong?
Edited by Catzenjaeger on 02-11-2017 11:42,
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

You put it in infusion_db.php to load to the whole system, not in your locale file.

PF9 loads everyone's infusion_db.php and makes it part of the entire system.
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

Thanks for repley Chan .. but i dont understsand

you wrote:

/**
19. * Method two: load into library on refresh.
20. * File: your_infusion/infusion_db.php*21. * ---> = /infusions/figurelib/infusion_db.php or????
22. * Add the lines:
23. */
24. $locale = \PHPFusion\Locale::__getInstance('Default'wink;
25. $locale::setLocale(file_exists(INFUSIONS."figurelib/locale/".LANGUAGE.".php"wink ? INFUSIONS."figurelib/locale/".LANGUAGE."/locale_figurelib.php" : INFUSIONS."figurelib/locale/English/locale_figurelib.php"wink;
26.
27.// This method will set the locale values into the instance of locale.
28.// All your files can access the newly added library locale values ....
29.
30.// In any file...
31.$my_total_locale = fusion_get_locale(); // will print figurelib locale as well because it was added.
32.print_p($my_total_locale);

i have add your line in my infusns_db file
and in my other filres in my figurelib = $my_total_locale = fusion_get_locale();
so whats wrong?
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 6 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
R
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet