×
Kunena is Joomla 3.8 compatible (20 Sep 2017)

Kunena 5.0.11 is compatible with the release of Joomla 3.8.
There are no know issues with the current version on Joomla 3.8. We advice to update if your other 3rt extensions are also compatible with the latest version.

Solved [SOLVED] How to force the notification language?

More
1 year 1 month ago - 1 year 1 month ago #1 by Mezzo
Mezzo created the topic: [SOLVED] How to force the notification language?
Hello,

I am setting a new forum on a multilingual site. The particularity is that while the site can be translated into several languages, I want the forum to stay in English. A message appears asking everyone to write their messages in English even if the interface is in French for instance.

The problem is that when someone writes a reply, the notification emails sent to all subscribers are in the current language of the user that is writing the message, not in the language of the subscribers. Is it possible to sent notifications with the appropriate language of each subscriber? If no, is it possible to force the notifications (and the links inside) to be in English?

Regards,
Davy
Last Edit: 1 year 1 month ago by Mezzo.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #2 by xillibit
xillibit replied the topic: How to force the notification language?
Hello,

This is a feature that we have a mind, but it's something not easy to do, i can't say for now in which Kunena version it will be set.

I don't provide support by PM, because this can be useful for someone else.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #3 by Mezzo
Mezzo replied the topic: How to force the notification language?
Thank you for the reply.

Is there a way to remove the translation process? (with hard-coded strings in the code for instance). Even if it is an ugly fix I would find this acceptable. What file could I modify?

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #4 by Mortti
Mortti replied the topic: How to force the notification language?
One possibility could be that you overrides every languages(notifications) to english which you are installed.
I think you mean these lines of notifications?:
COM_KUNENA_POST_EMAIL_MOD1="A new post has been made to a category to which you have assigned as moderator on the"
COM_KUNENA_POST_EMAIL_MOD2="Please have a look at it after you have logged in on the site."
COM_KUNENA_POST_EMAIL_NOTIFICATION1="A new reply has been posted on the"
COM_KUNENA_POST_EMAIL_NOTIFICATION1_CAT="A new topic has been created on the"
COM_KUNENA_POST_EMAIL_NOTIFICATION2="You can unsubscribe from this topic by visiting it and clicking the Unsubscribe button near the top or bottom of the page."
COM_KUNENA_POST_EMAIL_NOTIFICATION2_CAT="You are getting this notification because of you have subscribed into category. Please visit the category to unsubscribe."
COM_KUNENA_POST_EMAIL_NOTIFICATION3="Do not answer to this e-mail notification as it is a generated e-mail."
COM_KUNENA_POST_EMAIL_NOTIFICATION_MORE_READ="Please note that you will not receive any further email notifications for this topic until you log in and read it."
COM_KUNENA_POST_EMAIL_NOTIFICATION_MORE_SUBSCRIBE="Please note that you will not receive any further email notifications for this topic unless you subscribe into it."

You can find those lines from the administration language file xx-XX.com_kunena.libraries.ini
You can do overrides from the Joomla backend: Extensions -- Language(s) -- Overrides or direct to language files...
I haven't tested this but it should be work... then user with a language other than English, should get the notifications emails in English. Inform if you test this.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago - 1 year 1 month ago #5 by Mezzo
Mezzo replied the topic: How to force the notification language?
Yes that's it :-)

I have another question before doing a test and posting a solution.

I found the file libraries/kunena/forum/message/message.php which creates the email with the last function "attachEmailBody". It could be possible to patch it so that I don't need to change the translations anymore, though I understand that it's a bad fix (I would need to patch it after each update of Kunena).

What is still bothering me is that a url is attached to the email so that we can go to the message that has been posted, and this url is also linked to the current language of the user that wrote the message on the forum. For example here is the url that I could receive:
http://mysite.com/fr/forum/category_name/topic_name#12
But I want this, always in english ("fr" becomes "en"):
http://mysite.com/en/forum/category_name/topic_name#12
I can of course add a function to replace "/XX/forum/" into "/en/forum/", but I was wandering if there is no other solutions, for example by slightly modifying the function "getPermaUrl" or "getPermaUri".
Last Edit: 1 year 1 month ago by Mezzo.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago - 1 year 1 month ago #6 by Mortti
Mortti replied the topic: How to force the notification language?

Mezzo wrote: Yes that's it :-)

It could be possible to patch it so that I don't need to change the translations anymore, though I understand that it's a bad fix (I would need to patch it after each update of Kunena).

If you do overrides from Joomla backend Extensions -- Language(s) -- Overrides for those lines to each languages, you don't need to do that again when new language packages are available and you install it... Overwrite will always remain for those lines.

EDIT: a little bit old Joomla! Documentation of J! overrides but its almost same in J! 3.6.2
docs.joomla.org/J3.x:Language_Overrides_in_Joomla
Last Edit: 1 year 1 month ago by Mortti.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #7 by xillibit
xillibit replied the topic: How to force the notification language?

Mezzo wrote: Yes that's it :-)

I have another question before doing a test and posting a solution.

I found the file libraries/kunena/forum/message/message.php which creates the email with the last function "attachEmailBody". It could be possible to patch it so that I don't need to change the translations anymore, though I understand that it's a bad fix (I would need to patch it after each update of Kunena).

What is still bothering me is that a url is attached to the email so that we can go to the message that has been posted, and this url is also linked to the current language of the user that wrote the message on the forum. For example here is the url that I could receive:

http://mysite.com/fr/forum/category_name/topic_name#12
But I want this, always in english ("fr" becomes "en"):
http://mysite.com/en/forum/category_name/topic_name#12
I can of course add a function to replace "/XX/forum/" into "/en/forum/", but I was wandering if there is no other solutions, for example by slightly modifying the function "getPermaUrl" or "getPermaUri".

The methods getPermaUrl or getPermaUri doesn't handle multi-language, i need to check if these methods can be changed to do that

I don't provide support by PM, because this can be useful for someone else.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago - 1 year 1 month ago #8 by Mezzo
Mezzo replied the topic: How to force the notification language?
Hello,

I understand that using overrides prevents an update to reinitialize the translations but there is still the problem with the url that can point to the site with a language other than English. I need to patch anyway.
I edited the file "components/com_kunena/template/system/layouts/email/subscription/default.php" (and not "libraries/kunena/forum/message/message.php" as I mentioned) and it worked.
I set manually the text (no translations anymore) and I modified the url with:
preg_replace('#http://([a-z\.-]+)/[a-z]+/[a-z]+/(.*)#', 'http://$1/en/forum/$2', $this->messageUrl)
This way
http://mysite.com/XX/YYYY/...
is changed to a url always pointing to the forum with the English interface
http://mysite.com/en/forum/...

I'll keep a track of these changes so that if Kunena is updated, I can patch again.

Regards,
Davy
Last Edit: 1 year 1 month ago by Mezzo.

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.185 seconds