If I got it right, the use of locative form of the sitenames is governed by this document: link.
We need to remove the prepositions, because:
- We don't always use one and the same preposition for all the cases. E. g. "Search Wikipedia" in Ukrainian might be "Пошук у Вікіпедії" or "Пошук по Вікіпедії". In some cases we might also need another preposition – "на".
- If we use {{GRAMMAR:locative|{{SITENAME}}}}, we end up having messages with the sitenames like translatewiki.net, meta-wiki, mediawiki.org etc, with no prepositions at all, which is wrong.
That's why the prepositions should be set outside of the "grammar" function. This is also true for be- and be-tarask languages, that don't have prepositions set in the php file mentioned (see prepositional).
The relevant section of the document should look like:
'locative' => array( 'Вікіпедія' => 'Вікіпедії', 'Вікісловник' => 'Вікісловнику', 'Вікіпідручник' => 'Вікіпідручнику', 'Вікіцитати' => 'Вікіцитатах', 'Вікіджерела' => 'Вікіджерелах', 'Вікіновини' => 'Вікіновинах', 'Вікідані' => 'Вікіданих', 'Вікімандри' => 'Вікімандрах', ),