Setting RequireJS i18n locale dynamically

后端 未结 2 2096
庸人自扰
庸人自扰 2021-02-06 09:45

I am using the RequireJS i18n plugin to load translations into my application. I\'m struggling with the concept of runtime determination of a user\'s preferred language<

2条回答
  •  遇见更好的自我
    2021-02-06 09:50

    Another option, if your page is dynamically generated with a template system, is to have the require.config({config {..} }) inlined into the generated HTML... say like this:

    
    
    
    
    
    
    

    require.config(..) can be called multiple times, but should be done before your app is loaded.

提交回复
热议问题