Closed luca-peruzzo closed 1 year ago
@Romanchuk - do you think we'll get this Merged anytime soon. It's currently blocking our upgrade to the latest Angular
Looking at his recent activity on Github (last update in June), I would suggest we create a fork from this and use that instead. He might even been drafted to the war...
@MathiasWasAlreadyTaken Do you think i can't merge it while in a frontline?
The change in the file libs/angular-i18next/src/lib/models.ts made it worse for us.
https://github.com/Romanchuk/angular-i18next/blob/82b33a833af6dd038064ff60975653308a878d88/libs/angular-i18next/src/lib/models.ts#L8
It can't transform with a string array anymore.
If a string to be transformed look like this "Send from {{0}} to {{1}}."
, you could transform with a string array of two items.
const values[];
values.push("Earth");
values.push("Moon");
this.i18NextPipe.transform('string-key', values);
Now it only takes a dictionary as parameter.
"Send from {{0}} to {{1}}."
@Romanchuk
maybe we could typing TOptions like that:
I read about the breaking change in the latest i18next migration guide. I try and get some time over during the day to test your change, and post the result here.
Renaming StringMap to $Dictionary, and we'll no longer export it. $Dictionary is an internal helper, and there is no reason to expose it. If needed, you can create a copy and reuse it in your project.
export type $Dictionary<T = unknown> = { [key: string]: T };
I did fix types that changed in i18next.
https://github.com/Romanchuk/angular-i18next/releases/tag/v17.0.0-1
https://www.npmjs.com/package/angular-i18next/v/17.0.0-1
@MathiasWasAlreadyTaken
const values[];
values.push("Earth");
values.push("Moon");
this.i18NextPipe.transform('string-key', values);
It won't fix your problem. With previous types PipeOptions actualy detected by typescript as 'any' (it was incorrect). But it meant to be an object (by i18next). i18next can interpolate any key in options object. It did work because array also has access by a key. But i18next doesn't really expect an array to be passed as options. We have to stick to an i18next typings
If you want numbers this should work for you:
{
"1": "Earth",
"2": "Moon"
}
or
const values = {};
values[0]="Earth";
values[1]="Moon";
Awesome!
@luca-peruzzo Plz, let me know if 17.0.0-1 is OK for you
@luca-peruzzo Plz, let me know if 17.0.0-1 is OK for you
Yep, in my project I always use object interpolation when needed, so no issues for me
I'll release stable version tomorrow
closes #113