Skip to content

Commit 7ce1ae3

Browse files
added angular-dynamic-locale
1 parent 8e67664 commit 7ce1ae3

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// <reference path='../angularjs/angular.d.ts' />
2+
/// <reference path='angular-dynamic-locale.d.ts' />
3+
4+
var app = angular.module('testModule', ['tmh.dynamicLocale']);
5+
app.config((localStorageServiceProvider: angular.dynamicLocale.tmhDynamicLocaleProvider) => {
6+
localStorageServiceProvider
7+
.localeLocationPattern("app/config/locales/")
8+
.useCookieStorage();
9+
});
10+
11+
class LocaleTestController {
12+
13+
constructor(tmhDynamicLocaleService: angular.dynamicLocale.tmhDynamicLocaleService) {
14+
15+
var locale = tmhDynamicLocaleService.get();
16+
17+
var newLocale = "mt"
18+
tmhDynamicLocaleService.set(newLocale);
19+
}
20+
21+
}
22+
23+
app.controller('TestController', LocaleTestController);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Type definitions for angular-dynamic-locale v0.1.27
2+
// Project: https://github.com/lgalfaso/angular-dynamic-locale
3+
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
/// <reference path="../angularjs/angular.d.ts" />
7+
8+
declare module angular.dynamicLocale {
9+
10+
interface tmhDynamicLocaleService {
11+
set(locale: string): void;
12+
get(): string;
13+
}
14+
15+
interface tmhDynamicLocaleProvider extends angular.IServiceProvider {
16+
localeLocationPattern(location: string): tmhDynamicLocaleProvider;
17+
localeLocationPattern(): string;
18+
useStorage(storageName: string): void;
19+
useCookieStorage(): void;
20+
}
21+
}

0 commit comments

Comments
 (0)