javascript - How to read AngularJs locale file? -
i using angular bootstrap datepicker popup , want set date format of textbox according locale, idea reading property "shortdate" locale file , set in format property.
so question is, how can read locale file? file present, localization working , can see file in network tab of browser's developer tools
i once had same requirement , end using 'tmh.dynamiclocale' module (see here.
using module, you'll first have configure locale provider. in angular config function, inject 'tmhdynamiclocaleprovider' , call localelocationpattern( ) function define pattern use access locale files.
for instance:
tmhdynamiclocaleprovider.localelocationpattern('vendor/angular/locale/angular-locale_{{locale}}-{{locale}}.js');
then, whenever locale supposed changed, have inject 'tmhdynamiclocale' in service/controller/... , call set( ) function on in, passing argument, locale want switch to.
hope that'll you.
Comments
Post a Comment