Language problem.

gkajtek's Avatar

gkajtek

13 Feb, 2018 12:15 AM

Hi,
thank you for nice tool, but i have problems with language. Could you please give me a tip what are those two lines of code in line 49 in file gallery_class.php?

// TODO - this could be fixed by using ROOT
        T_bindtextdomain('messages', '../language');

  1. 1 Posted by gkajtek on 13 Feb, 2018 04:36 PM

    gkajtek's Avatar

    I can't set default language according to article from knowledge base. I mean: I can, but not on pages which call's gallery class.

  2. Support Staff 2 Posted by Ryan Haudenschi... on 13 Feb, 2018 06:44 PM

    Ryan Haudenschilt's Avatar

    This defines where the language files are located at.

  3. 3 Posted by gkajtek on 13 Feb, 2018 08:58 PM

    gkajtek's Avatar

    If I setup default language in fcms.php in getLanguage language it works for all pages but those with gallery works not. Those pages has english translation.

    The problem is that you call this function within gallery class.
    I.E If I call gallery class from /gallery/index.php I can se website in desired language, because path is correct.
    But when hit some page which is in root directory ie. home.php and which also call gallery class those line is setting up wrong path value so all page is in english :/

  4. Support Staff 4 Posted by Ryan Haudenschi... on 13 Feb, 2018 09:24 PM

    Ryan Haudenschilt's Avatar

    I've created a Github issue for this, thanks for looking into this.

  5. 5 Posted by gkajtek on 14 Feb, 2018 06:19 PM

    gkajtek's Avatar

    My temporary solution:
    1. Added one param to PhotoGallery class constructor in gallery_class.php:
    public function __construct (FCMS_Error $fcmsError, Database $fcmsDatabase, User $fcmsUser, $fcmsImage = null, $lngFilePath=null)
    2. In gallery_class.php near line 40 (definition of class constructor )I've changed value of function param from '.././language' to 'language'
    T_bindtextdomain('messages', 'language');
    3. On each page located within script root directory, which wasn't translated after setting up default language (i.e. home.php, profile.php - those pages calls PhotoGallery class) I've added two parameters at the end:
    $gallery = new PhotoGallery($fcmsError, $fcmsDatabase, $fcmsUser,0,'.././language');

    Unfortunately this method affects T_ngettext(is it right name? don't remember;)) function which is responsible for getting plural forms from po/mo translation files so replaced them and I use T_ only :P

    Regards.

  6. Support Staff 6 Posted by Ryan Haudenschi... on 14 Feb, 2018 06:44 PM

    Ryan Haudenschilt's Avatar

    you tested that and it works?

  7. 7 Posted by gkajtek on 14 Feb, 2018 07:03 PM

    gkajtek's Avatar

    Yep, but can't guarantee that it will works for everybody. I was exploring Your script to fix my issue, could be something more in code whot I've done. At the beginning I was trying to force the script to use just one desired language tweaking get/setLanguage methods it works, but not for pages mentioned above. After that I've decide to modify gallery.

  8. Support Staff 8 Posted by Ryan Haudenschi... on 14 Feb, 2018 07:05 PM

    Ryan Haudenschilt's Avatar

    Thanks. I can do more testing myself, just wanted to know if that solution works for you.

    I've known about this problem for a while but was unable to duplicate it, so this helps a lot. Thanks again.

  9. 9 Posted by gkajtek on 14 Feb, 2018 07:08 PM

    gkajtek's Avatar

    yhmm.. I see now that no matter language I choose I has only my one language xD
    But I don't have international family so it was more important to get one particular language on each page then having possibility to switch between them.

  10. 10 Posted by gkajtek on 14 Feb, 2018 07:16 PM

    gkajtek's Avatar

    You are very welcome. Thank you for joining families :)

    ps. I can't switch language because I've hardcoded mine xD ...so it's possible that presented solution will not affect switching mechanism ;)

  11. Support Staff 11 Posted by Ryan Haudenschi... on 14 Feb, 2018 08:05 PM

    Ryan Haudenschilt's Avatar

    Yep, i got it, I can figure out how to merge your code in without breaking it (I hope).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac