Fix incorrect cache key for layout

The cache key of layout is generated before the call of setLocale(), so the cache key is invalid