0

I'am developping a discussion forum component, in this i need for user subscription when answer is added in a topic by sending a mail to the user language configured in his profile parameters. The language set by user in his profile is different than the language configured by default for the entire site.

By example the Joomla! default language is english, if the user has defined his language on italian, i need to parse the mail in order to use italian.

After that i'am done that i can send the mail.

Do-you have an idea to parse the mail to use the language defined by user ?

Thanks

2

Here is a general idea.

You need to maintain a table which holds the templates for the emails you need to send and additionally to store the language name as well:

type         email_text     lang
-------------------------------
register    Hello world!    en-GB
register    Ciao mondo      it-IT

Detect user language.

$user = JFactory::getUser();
$language = $user->getParam('language', 'en-GB');

Send the email

  • Do a query in your email templates to identify the one needed based on user language and the type of the email you want to send.
  • Send the email using JMail.
  • I don't like to store into database, if you have 500 mails or more to send it won't be efficient , my idea was to fetch the languages of the users who will receive the notification then load the language file, parse the mail and send it. Is-it not possible to do like that ? – user3533235 Aug 27 '14 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.