Skip to content

How to use the symbols options for localisation? #345

@joshuaM07

Description

@joshuaM07

So the way to use the available options is pretty straightforward in Angular.
Here is a snippet of what I have currently:

return new FileSizePipe().transform(bytes, { locale: 'fr-FR' );

where bytes is the file size I wish to transform using the pipe and fr-FR is the language I wish to use. Locale is cool because it automatically deduces what separator to use, but what it doesn't do is change the symbols. Example: Kb, Mb, etc...
In french, it's Ko, Mo, etc...

How can I use the symbols options to define my own set of symbols to be used?

This is what I tried to do but failed miserably:

return new FileSizePipe().transform(bytes, { locale: 'fr-FR', symbols: { Kb: 'Ko', Mb: 'Mo' } } );

Also

const sij: SiJedec = { KB: 'KO', Kb: 'Ko', Gb: 'Go', GB: 'GO' };

return new FileSizePipe().transform(bytes, { locale: 'fr-FR', symbols: sij } );

Can anyone help me please? Thanks in advance.

@amitdahan @majora2007 @richardlnnr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions