Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Formatter] add language definition for numbers #330

Merged
merged 1 commit into from
Mar 3, 2016

Conversation

TomGallon
Copy link
Contributor

Description

It is now possible to define languages to correctly format number for the current language.

To do so, define a specific initiliazer:

import {language} from 'focus-core/definition/formatter/number';
import frLanguage from 'numeral/languages/fr';

export default () => {
    console.info('|--- NUMERAL');

    // load fr language
    language('fr', frLanguage);
    console.info('   |--- Add language french');

    //define the language
    language('fr');
    console.info('   |--- Numeral correctly initialized. Current language:' + language());
}


const DEFAULT_FORMAT = '0,0';

module.exports = {
//TODO change numeral lib and regroup initializers
export function language(key, conf) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call it setLanguage rather than language

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you.
But we discussed with @pierr. He prefers to expose the same method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then

Bernardstanislas added a commit that referenced this pull request Mar 3, 2016
[Formatter] add language definition for numbers
@Bernardstanislas Bernardstanislas merged commit d403822 into develop Mar 3, 2016
@Bernardstanislas Bernardstanislas deleted the feature-language-numeral branch March 3, 2016 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants