Jump to content

Getting the language words outside the IPS app?


LaCollision

Recommended Posts

Posted

Hi there,

I'm packaging the IPS app in a regular news website.

I've managed to get the Member logged info with:

\IPS\Dispatcher\Front::i();

$member = \IPS\Member::loggedIn();

 

Now, on my website homepage, I'm calling some IPS templates, like the user menu bar:

echo \IPS\Theme::i()->getTemplate('global', 'core', 'front')->userBar();

 

Everything works fine, except the fact I don't manage to get the words translations.

For each word I want to display, I'm using :

echo \IPS\Member::loggedIn()->language()->addToStack('my_word_id');

 

But instead of the words, I only get their key, like, for instance, 959aaed7297a15e5aaaaf4f13d7d1a26.

=> How can I initialize the language words outside the IPS framework ?

I thought it was done with:

\IPS\Member::loggedIn()->language()

… but apparently not.

Thanks for your help :)

Posted

Oh my god, I just saw the output is globally translated with that method:

\IPS\Member::loggedIn()->language()->parseOutputForDisplay( &$output )

 

So, for EACH word I want to translate outside the IPS framework, do I need to use that:

$myWord = \IPS\Member::loggedIn()->language()->addToStack('my_word_key');

\IPS\Member::loggedIn()->language()->parseOutputForDisplay($myWord);

echo $myWord;

… ?

That looks super heavy :(

Can I call this code for each word of my page? Isn't it too heavy for the server, as I may have dozens or hundreds of words in each page?

I must say I'm confused :cry:

Thanks for your help!

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...