That's a known problem -- the 'internal' name of a language may differ from the one you logically would expect.
Try this: set a paragraph to Spanish and run this one-line script:
I bet it says something like "Spanish: Castilian".
Thanks Jongware, it's working fine, I spent huge time to identify the exact string to Spanish language. You have saved my time.
Can we have list of these differences or can you guide me how I can know these differences, since I found that most of the other languages are working fine.
I'm afraid it's one of those things that simply don't work the way you would suppose, and you only find out why after some time of fruitless debugging.
Perhaps the underlying reason is languages seem to have a dual representation: "Language" and "LanguageWithVendors":
but I don't know nearly enough of the 'insides' of ID to predict when this will be a problem.
not too hard to find by trial and error. But even more embarrassing: you won't get it with the alert script above, nor find it in any Adobe documentation.
Thanks to the team - this cost me quite some time...