How do I configure a language pack?

How do I configure a language pack?

by Myrrh Lynn -
Number of replies: 17
I recently installed a block pcard that seems to be missing its language. The names and labels all look like this name.

The README file said to:

4. Configure your language including lang/pcard.php and lang/help/pcard into your local installation language folder.

Problem: I don't know how to do this.

I asked for help from the block forum itself over a week ago and have received no response. I'd think this is something that is pretty standard protocol when installing modules or blocks.

Could someone help me with this please?
Average of ratings: -
In reply to Myrrh Lynn

Re: How do I configure a language pack?

by A. T. Wyatt -
Greetings, C!

Usually, you just copy the files to the right lang folder. If you look at the file structure in moodle, you will see a folder called lang. Inside will be the languages you use on your site. Probably you might use en_utf8. Every block you install has a php file that goes here. So, in this case, pcard.php would be copied to moodle/lang/en_utf8. You will also see a folder inside en_utf8 called help. The help files from your block go in this folder.

Because the files for 3rd party blocks should not have the same names as any core blocks, it is usually save to simply copy the files to the right folder. However, it is recommended to do a backup first! All blocks are installed this way--the block files go in the moodle/block folder and the language files go in the lang/en_utf8 and lang/en_utf8/help folders (unless, of course, you are using other languages on your site! in that case you will have other sets of language files that you can place appropriately).

I hope that explanation at least gets you started!

atw

In reply to A. T. Wyatt

Re: How do I configure a language pack?

by Myrrh Lynn -
THANK YOU!! I have struggled with this for over a week! I've got it working!
In reply to A. T. Wyatt

Re: How do I configure a language pack?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
From Moodle 1.8 onwards, you no longer need to do this step. The language files can stay as in a subfolder of the module/block/whatever.
In reply to Tim Hunt

Re: How do I configure a language pack?

by A. T. Wyatt -
That will be great! Much easier!

Thanks for the info!
atw
In reply to A. T. Wyatt

Re: How do I configure a language pack?

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Sorry, but its only great if you don't plan to edit the language files. Such files are not visible in the language administration.
In reply to Ralf Hilgenstock

Re: How do I configure a language pack?

by A. T. Wyatt -
Hmm, I often edited mine with a text editor directly on the server. . . Do you mean, then, that you will no longer be able to edit these files with the web interface? That is going to cause some troubles for people who want to make alterations more easily. You are more protected from making errors (e.g., editing the wrong thing!) by using the web interface.

atw

In reply to Ralf Hilgenstock

Re: How do I configure a language pack?

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi Ralf,

this feature has been already reported as MDL-9361. If one wants to edit the 3rd party add-on's language packs in the current versions, she needs to copy the lang subfolder into proper location as discussed above.

David
In reply to David Mudrák

Re: How do I configure a language pack?

by A. T. Wyatt -
Well, this could possibly be confusing (since it seems to be a change from historical practice). Thanks for the head's up. I will be watching to see what develops by the time 1.8 is released.

atw

In reply to David Mudrák

Re: How do I configure a language pack?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
That is clearly a bug, and it needs to be fixed. When you reported it, did you mean to assign it to yourself? Are you planning to fix it. If not, reassign it to the default person for lang bugs.

The language editor needs to use the places_to_search_for_lang_strings() function from about line 4200 of lib/moodlelib, so it can look for language files in exactly the same place that get_string() and help.php look for them.
In reply to Tim Hunt

Re: How do I configure a language pack?

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
IMHO it is not a bug, it is missing feature. Thus is can not be fixed, but implemented wink Anyway - yes - I really meant to assign the ticket to myself as I was already working on several recently implemented fixes/features in lang.php. I am just finishing my thesis right now, so I do not have much time to work on lang/i18n interface. But is should get better in two or three weeks.

There are some issues connected with places_to_search_for_lang_strings(), I will discuss them in the tracker (e.g. write access rights into non-data area of the moodle site etc.).


In reply to David Mudrák

Re: How do I configure a language pack?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You have my sympathy. I did a thesis once. Never again. (shudder).

I think that the language string editor should copy any files that are changed into the moodledata folder (like it does now, as I understand it). Lang files in moodledata are always searched before the inside-the-module lang folder ones. The only reason you need to use places_to_search_for_lang_strings() is for the language editor to know all the places it might need to copy files from before editing.
In reply to A. T. Wyatt

Re: How do I configure a language pack?

by Sarah McClure -

Hi. Just came across this post while I was searching for the same answer as the gentleman before me.  My Pcard block seems to be missing something. It shows up as name.  The zip file I download, after I unzipped it , did not contain a lang file as many of the others had.  I did however, copy the file block_pcard.php into the en_utf8 folder but no change.   Any additional suggestions? 

Thanks. Sarah

In reply to Sarah McClure

Re: How do I configure a language pack?

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Is the string missing in English?
Then add the line
$string['name'] = 'Name';
in the file that exists in the en_utf8 folder and that also contains a bunch of lines, starting with $string.
In reply to koen roggemans

Re: How do I configure a language pack?

by Sarah McClure -
Which file are you talking about?  I have probably 80 files in my en_utf8 folder.
In reply to koen roggemans

Re: How do I configure a language pack?

by Sarah McClure -

Just on a side note:  All the items in the pcard block show up with these brackets as shown here:

name

Assign rolesHideDeleteMove downMove right
Also, I searched every file in the entire wwwroot file and only found 3 readme files that had $string in them. None of them had anything to do with the pcard or the language files.  Sorry if I sound stupid, but I am definately a Moodle Newbie and some of this stuff is a little over my head.  Thanks in advance to anyone who can assist.
Sarah
In reply to Sarah McClure

Re: How do I configure a language pack?

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
It seems like it misses the language pack completely. It should be in /blocks/pcard/lang/en_utf8

I want to look at it, but can't download the block at the moment sad (server not available)