### File

`projects/angular-l10n/src/lib/services/l10n-storage.ts`

### Description

Implement this class-interface to create a storage for the locale.

### Index

###### Methods

- Public Abstract Async read
- Public Abstract Async write

### Methods

Public Abstract Async read
`read()`
Defined in projects/angular-l10n/src/lib/services/l10n-storage.ts:14
This method must contain the logic to read the storage. Returns : `Promise<L10nLocale | null>` A promise with the value of the locale

Public Abstract Async write
`write(locale: L10nLocale)`
Defined in projects/angular-l10n/src/lib/services/l10n-storage.ts:20

This method must contain the logic to write the storage.

Parameters :

Name | Type | Optional | Description
locale | `L10nLocale` | No | The current locale

Returns : `Promise<void>`

    import { Injectable } from '@angular/core';

    import { L10nLocale } from '../models/types';

    /**
     * Implement this class-interface to create a storage for the locale.
     */
    @Injectable() export abstract class L10nStorage {

        /**
         * This method must contain the logic to read the storage.
         * @return A promise with the value of the locale
         */
        public abstract async read(): Promise<L10nLocale | null>;

        /**
         * This method must contain the logic to write the storage.
         * @param locale The current locale
         */
        public abstract async write(locale: L10nLocale): Promise<void>;

    }

    @Injectable() export class L10nDefaultStorage implements L10nStorage {

        public async read(): Promise<L10nLocale | null> {
            return Promise.resolve(null);
        }

        public async write(locale: L10nLocale): Promise<void> { }

    }

# result-matching ""

# No results matching ""