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

How to use the symbols options for localisation? #345

Open
joshuaM07 opened this issue Aug 21, 2021 · 0 comments
Open

How to use the symbols options for localisation? #345

joshuaM07 opened this issue Aug 21, 2021 · 0 comments

Comments

@joshuaM07
Copy link

joshuaM07 commented Aug 21, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant