Take several seats for this one, because I think this will be a long post. The locative case has many used in Malayalam and I will try to explain the grammar here, as best I can. It may be a bumpy ride, but think of the bigger picture, how well you will learn this language at the end of all this!!!
1. Spatial and temporal meaning
Probably the most familiar use of this case as covered in my first cases post. Pretty self explanatory means something like at or in in English
അവൾ മുറ്റത്ത് നിന്നു - 'she stood in the courtyard' (notice the ത്ത് ending instead of ഇൽ which are both locative suffixes)
ഒൻപത് മണിക്ക് നാടകം തുടങ്ങും - 'the play will begin at 9 o'clock' (again the ക്ക് ending is locative in this case)
കുട്ടികൾ ബസിൽ കയറുന്നു - 'the children are boarding the bus' (typical ഇൽ ending)
വേദനാജനകമായ സമയങ്ങളിൽ ആശ്വസിക്കുന്നു - 'consoled in painful times'
Fancy word to say that locative is used to denote on, on top of, on the surface of.
തലയിൽ ചുമക്കുന്നു - 'carried on head'
മടിയിൽ ഇരുത്തി - 'placed on lap'
Again another fancy word to describe in, at, inside of.
കുപ്പിയിൽ ഒഴിച്ചു - 'poured in the bottle'
വീട്ടിൽ സൂക്ഷിച്ചു - 'kept in the house'
4. Topical and causative relation
Confusingly some uses of the locative case cannot be explained as a physical locations like how we say 'stand by my beliefs' in English, we say we are standing by them, but they aren't a physical place in the world.
തീരുമാനത്തിൽ ഉറച്ചുനിന്നു - 'stood firm by decision'
പ്രവർത്തനത്തിൽ ലജ്ജിച്ചു - 'was ashamed by the action'
സന്തോഷത്തിൽ സ്വയം മറന്നു - 'forgot himself in happiness'
To describe things how you did something.
ക്രോധത്തിൽ സംസാരിച്ചു - 'spoke in anger'
ആവേശത്തിൽ ചാടി - 'jumped in excitement'
അവിശ്വാസത്തിൽ മുട്ടുകുത്തി - 'knelt in disbelief'
6. Ablative, Allative and Perlative
Ablative in grammar means a source of (from place), allative means a destination (to place), and perlative is path of movement (through place). These uses are often associated with Malayalam postpositions such as -നിന്ന് (from), -േക്ക് (to, towards), and -ൂടെ (through).
Ablative - പുസ്തകം അലമാരയിൽ നിന്ന് എടുക്കുക - 'take the book from the shelf'
Allative - ഞങ്ങൾ റൂമിലേക്ക് പോകുന്നു - 'we are going to the room'
Perlative - പർവ്വതങ്ങളിലൂടെ വെള്ളം ഒഴുകുന്നു - 'water flows through the mountains'
If the ഇൽ suffix is added to an എ then you can use locative case to make sentences like so.
തലയിലെ പുഷ്പം - 'the flower that is on the head'
നെഞ്ചിലെ വേദന - 'pain that is in the chest'
അലമാരയിലെ ഭക്ഷണം - 'food that is in the cupboard'
I just wanted to expand further about the Allative which uses the -േക്ക്, and the Perlative which uses the -ൂടെ constructions. -േക്ക് is used when speaking about a specific direction and the -ൂടെ refers to a general direction.
രവി കുഴിയിലേക്ക് വീണു - 'Ravi fell into the hole'
രവി കുഴിയിലൂടെ വീണു - 'Ravi fell towards the hole'
-േക്ക് also denotes purposive meaning, and a fixed period of time
അതിലേക്ക് പണം കരുതിയിട്ടുണ്ട് - 'money has been set aside for it'
നീ മൂന്നു മാസത്തേക്ക് ഇവിടെ താമസിക്കണം - 'you must stay here for three months'