General developer forum

"Site announcements" [sitenews] never display localized string

 
Picture of Wenbin Xu
"Site announcements" [sitenews] never display localized string
 

Moodle version: 3.2.3

OS: Linux 16.04

Language packs installed: English and Simplified Chinese (under moodledata/lang/zh_cn)

String: [sitenews]

Symptom: Switch language through lang menu (regardless logged in or not). On frontpage, it always display "Site announcements" string in English; while, other strings on the frontpage are correctly displayed with Simplified Chinese.


Regards,


 
Average of ratings: -
Picture of Richard Oelmann
Re: "Site announcements" [sitenews] never display localized string
Core developersParticularly helpful MoodlersPlugin developersTesters

Is that particular string translated within the language pack being used ?

If it is and is failing to display, then there is an issue with the code that needs to be investigated.

If, as is more likely, it is not a translated string in that language pack, you can add the string through the language customisation settings in the site admin menu - it would then be helpful to submit that to the relevant language pack maintainer to share with other users smile

 
Average of ratings: -
Picture of Wenbin Xu
Re: "Site announcements" [sitenews] never display localized string
 

@Richard Yes, that string is included in language pack (moodle.php).

The translated string in /.../moodledata/lang/zh_cn/moodle.php is present and correct.

1. String defined in English moodle.php

$string['sitenews'] = 'Site announcements';

2. String defined in Chinese moodle.php

 $string['sitenews'] = '本站新闻';

 
Average of ratings: -
Picture of Wenbin Xu
Re: "Site announcements" [sitenews] never display localized string
 
Dig deep into this issue, and did things below


1. Site announcements section was created as a course forum internally

2. A row in DB was created, by installer, with ID = 1 (means SITEID) and Type = news (means announcements)

3. Text in that row is all in English

4. In /mod/forum/lib.php (line 2998), forum entries in DB is fetched and processed before displaying on front page

5. I tried to refetch localized string for forum name (get_string("sitenews")), but it doesn't work.

6. I tried to hard-coded the forum name as "test test test" on the same line, it doesn't work.

7. I purged all caches and tried step #5 & #6 again, it doesn't work.

I'm totally out of options now, and highly appreciate if anyone could provide me with more hints.

 
Average of ratings: -
Picture of Fernando Marques
Re: "Site announcements" [sitenews] never display localized string
 

Hi Wenbin Xu,

Found any solutions for this problem? I'm facing the same situation...

 
Average of ratings: -
Picture of Neill Magill
Re: "Site announcements" [sitenews] never display localized string
Core developersParticularly helpful MoodlersPlugin developers

Site announcements is a Forum activity.

If you go into it as a Moodle administrator you should be able to edit the title to the language of your choice (in the same way you would any forum).

I hope this helps.

 
Average of ratings: -
Picture of Daniel Pons
Re: "Site announcements" [sitenews] never display localized string
 

Hello.

I had the same issue trying to change it in the language pack. I haven't found where to change the name of the "Forum activity" entitled "Site announcements" accessing as a Moodle administrator.

Finally, I solved it modifying the registry directly in the data base:

  1. Access to phpMyAdmin through CPanel of my hosting provider
  2. Show contents of table mdl_forum
  3. Find the affected row identified with id=15 and course=1 whose field name="Site announcements"
  4. Changed the content of field "name" of this row with the desired translation.

Regards


 
Average of ratings: -
Picture of Richard Jones
Re: "Site announcements" [sitenews] never display localized string
 

Hi Daniel

It's there in the Moodle core language strings, (site admin|language|language customisation).  Load moodle.php and search for "announcements" and it's in the list.  Just changed it and it worked fine.  Better than going to the database which may be overwritten when you upgrade.



Moodle 3.3.2+

 
Average of ratings: -