profile
viewpoint
Toon van Strijp ToonvanStrijp Toon van Strijp Eindhoven https://www.toonvanstrijp.com/

ToonvanStrijp/nestjs-i18n 125

Add i18n support inside your nestjs project

ToonvanStrijp/node-tikkie-checkout 3

TypeScript implementation of the Tikkie Fast Checkout API.

ToonvanStrijp/ContainerVervoer 1

School exercise

ToonvanStrijp/hogerlager 1

School android demo

Choem/webcrawler-insta 0

Webcrawler for Instagram with Selenium.

ToonvanStrijp/charts 0

Curated applications for Kubernetes

ToonvanStrijp/fastify 0

Fast and low overhead web framework, for Node.js

ToonvanStrijp/fastify-multipart 0

Multipart support for Fastify

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha e284fa4619e0f3cea986a6944ed1bca293d0c702

fix: package.json & package-lock.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-FLAT-596927

view details

push time in 2 days

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha dcde833dd39278cbf6c772e893adeec76cef8b1b

fix: upgrade flat from 5.0.0 to 5.0.2 Snyk has created this PR to upgrade flat from 5.0.0 to 5.0.2. See this package in npm: https://www.npmjs.com/package/flat See this project in Snyk: https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr

view details

push time in 4 days

issue closedToonvanStrijp/nestjs-i18n

I18nService get current language

Could you add a method to get current language in I18nService class? @ToonvanStrijp

closed time in 13 days

vfa-trungnm

issue commentToonvanStrijp/nestjs-i18n

I18nService get current language

@vfa-trungnm getting the current language in the I18nService is more difficult than it seems. Because we need the current request context for it. You could inject the I18nRequestScopeService but this will have some performance drawbacks, because the I18nRi18nreqequestScopeService will be initiated for each request. For more info you can reach out to this link: https://github.com/ToonvanStrijp/nestjs-i18n#uestscopeservice-within-a-custom-service-using-request-scoped-translation-service

vfa-trungnm

comment created time in 13 days

pull request commentstephenh/ts-proto

enable rest parameter to use decorators in nestjs

@stephenh Ready to release ;) or do I need to change the version number in the package.json?

ToonvanStrijp

comment created time in 20 days

Pull request review commentstephenh/ts-proto

enable rest parameter to use decorators in nestjs

 export function defaultOptions(): Options {     outputClientImpl: true,     returnObservable: false,     addGrpcMetadata: false,+    addRestParameter: false,

Totally agree! Changed it!

ToonvanStrijp

comment created time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha 24fc28bc942ef2b9c7f3b4b46d355731d57d41d9

rename parameter name

view details

push time in 20 days

Pull request review commentstephenh/ts-proto

enable rest parameter to use decorators in nestjs

 function generateNestjsServiceClient(      // Use metadata as last argument for interface only configuration     if (options.addGrpcMetadata) {-      requestFn = requestFn.addParameter('metadata?', 'Metadata@grpc');+      requestFn = requestFn.addParameter(options.addRestParameter ? 'metadata' : 'metadata?', 'Metadata@grpc');+    }+    if (options.addRestParameter) {+      requestFn = requestFn.addParameter('...rest', 'any');

@stephenh I don't think we wanna generate this directly, cause it needs to be dynamic that's why the ...rest: any comes in handy.

ToonvanStrijp

comment created time in 20 days

pull request commentstephenh/ts-proto

enable rest parameter to use decorators in nestjs

@stephenh Could you please take a look at this? It doesn't introduce any type of breaking change but it would be useful for all the nestjs users! :D

ToonvanStrijp

comment created time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha 3edaf2268a6cae8b4af0450eb492ee4191abefef

enable maxWorkers jest

view details

push time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha dc30f59761ac0bbab3026f6997994f387e35d13f

scale up resource_class

view details

push time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha 63ac8048a0f3e508a8ebb833dd8ca9b6953bb6ca

scale up resource_class

view details

push time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha 1f925d0f71e3b36b4c53274c8afa29ef64d03006

format prettier

view details

push time in 20 days

PR opened stephenh/ts-proto

enable rest parameter to use decorators in nestjs

I would like this pull request to be merged soon :) by adding the addRestParameter=true option you can use decorators while still benefiting the strong typed features ts-proto offers.

const CurrentUser = createParamDecorator(
  (data: unknown, ctx: ExecutionContext) => {
    return {id: 1, name: 'test'};
  },
);

@Controller('hero')
@HeroServiceControllerMethods()
export class HeroController implements HeroServiceController {

  findCurrentUser(request: Empty, @CurrentUser() user: User): User | Promise<User> | Observable<User> {
    return user;
  }  
}
+507 -4

0 comment

28 changed files

pr created time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha 0c8c4ab9a1a3856b0b6a655a53e67652d226fe28

add readme

view details

push time in 20 days

push eventdebugged-software/ts-proto

Toon van Strijp

commit sha 3a15079aa4535cafedf19cb61f0b77c8a1198d9d

add rest parameter option to enable decorators

view details

push time in 20 days

issue commentistio/istio

Istio 1.6.3: ingressgateway JWT refused - error “Proto constraint validation failed” using Keycloak

@MirtoBusico if I'm correct you can also use the keycloak-http service as an endpoint like this:

apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
  name: jwt-authentication
spec:
  selector:
    matchLabels:
      sup.security: jwt-authentication
  jwtRules:
  - issuer: "http://keycloak-http/auth/realms/istio"
    jwksUri: "http://keycloak-http.svc.cluster.local/auth/realms/istio/protocol/openid-connect/certs"
    forwardOriginalToken: true
    outputPayloadToHeader: x-jwt-payload

For me this worked! For some reason the .svc.cluster.local is needed in the jwksUri.

MirtoBusico

comment created time in 20 days

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 3c3861bfc9a3f78549813b8109d5da70b29c483c

update dependencies

view details

Toon van Strijp

commit sha 60fe9af86987b0a21999da51de5847c1f2e34746

fix issue #152

view details

push time in 23 days

issue closedToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

Hi guys, First of all thank you for providing this easy to use tool for Nest.js internationalization.

Recently we upgraded all our Nest.js backend app packages (last time I did it about 3 months ago) and after adjustment of deprecated/changed config form to new one I having issue. The property 'i18nLang' having the value undefined in Nest.js request object inside controller, when no explicitly language passed in query string. But when I explicitly passing language param as query string part then the 'i18nLang' takes my passed value normally, so the issue is related only with 'fallbackLanguage' config. Here are my previous and new configurations for module in app.module.ts file:

old and all working config for nestjs-i18n version 4.1.3, before I upgraded my packages:

@Module({
    imports    : [
        I18nModule.forRoot({
            fallbackLanguage: 'de',
            path            : path.join(__dirname, '..', 'i18n'),
            filePattern     : '*.json',
            resolvers       : [
                new QueryResolver(['lang', 'locale', 'l'])
            ],
        }),
....

here is also the new config for nestjs-i18n version 8.0.6 I use now:

@Module({
    imports: [
        I18nModule.forRoot({
            fallbackLanguage: 'de',
            parser: I18nJsonParser,
            resolvers: [
                new QueryResolver(['lang', 'locale', 'l'])
            ],
            parserOptions: {
                path: path.join(__dirname, '/../i18n/'),
            }
        }),
....

NOTE: Our translation .json files are located on same level as src folder, and I have Nest.js standard mode. Also there are no errors when starting the backend Nest.js server.

Now I have changed/hacked codes to something like the following, but I hope the solution will be found and soon I will cleanup such hacks:

const i18nLang =  req.i18nLang || 'de'

Please let me know if you need some additional information related to this issue.

closed time in 23 days

mrdntgrn

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

I did however fix your issue @mrdntgrn in release V8.0.8. I think we'll put this on closed for now and create a new issue for the fallbacks and fallbackLanguage discussion.

mrdntgrn

comment created time in 23 days

created tagToonvanStrijp/nestjs-i18n

tagV8.0.8

Add i18n support inside your nestjs project

created time in 23 days

release ToonvanStrijp/nestjs-i18n

V8.0.8

released time in 23 days

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

@willianfalbo Ohh hmm it's a bit more difficult than I thought. Some help would be useful! I think this is caused by introducing the new fallbacks feature. But we have to think about how to handle different situations.

I take this back. It was caused by me, when I migrated to go for an interceptor instead of middleware

mrdntgrn

comment created time in 23 days

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

@willianfalbo Ohh hmm it's a bit more difficult than I thought. Some help would be useful! I think this is caused by introducing the new fallbacks feature. But we have to think about how to handle different situations.

What if the fallbackLanguage and fallbacks are both set?

Also I think we should clean up the fallbackLanguage and fallbacks and make it more clear. I think it can be a bit simpler?

mrdntgrn

comment created time in 23 days

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

@willianfalbo thanks for you reply! Then we'll got with the solution I provided above. It's not a huge deal so I'll fix this one tonight ;).

Thanks for your input guys @willianfalbo @mrdntgrn 🎉

mrdntgrn

comment created time in 23 days

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha 8aa592c9ff7fec160530c02b45b354719daca365

fix: upgrade chokidar from 3.4.0 to 3.4.1 Snyk has created this PR to upgrade chokidar from 3.4.0 to 3.4.1. See this package in NPM: https://www.npmjs.com/package/chokidar See this project in Snyk: https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr

view details

push time in 25 days

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

@mrdntgrn I was just looking into this but I realize now that I the i18nLang is working as it is meant to work. The i18nLang is indeed undefined, then when using it the i18nService sees that it is undefined and uses the fallbackLanguage. So I don't know if this is a blocking issue for you? We could make it so that the i18nLang is filled in by the fallbackLanguage if it's undefined? @willianfalbo What's your opinion on this matter?

mrdntgrn

comment created time in a month

delete branch ToonvanStrijp/nestjs-i18n

delete branch : snyk-upgrade-b8808506ead032ac1d486fa60e16c802

delete time in a month

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha 0e4dfd43b34b04b55319bd8c20b899c2fc3f4985

fix: upgrade lodash from 4.17.15 to 4.17.19 Snyk has created this PR to upgrade lodash from 4.17.15 to 4.17.19. See this package in NPM: https://www.npmjs.com/package/lodash See this project in Snyk: https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr

view details

Toon van Strijp

commit sha 120cf5dcff70823ffe5be9ff488926705340a5eb

Merge pull request #156 from ToonvanStrijp/snyk-upgrade-b8808506ead032ac1d486fa60e16c802 [Snyk] Upgrade lodash from 4.17.15 to 4.17.19

view details

push time in a month

PR merged ToonvanStrijp/nestjs-i18n

[Snyk] Upgrade lodash from 4.17.15 to 4.17.19

<h3>Snyk has created this PR to upgrade lodash from 4.17.15 to 4.17.19.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/>

  • The recommended version is 4 versions ahead of your current version.
  • The recommended version was released a day ago, on 2020-07-08.

The recommended version fixes:

Severity Issue Exploit Maturity
<img src="https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/m.png" width="20" height="20" title="medium severity"/> Prototype Pollution<br/> SNYK-JS-LODASH-567746 Proof of Concept

<details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>lodash</b></summary> <ul> <li> <b>4.17.19</b> - <a href="https://snyk.io/redirect/github/lodash/lodash/releases/tag/4.17.19">2020-07-08</a></br><p>Bump to v4.17.19</p> </li> <li> <b>4.17.18</b> - 2020-07-08 </li> <li> <b>4.17.17</b> - 2020-07-08 </li> <li> <b>4.17.16</b> - <a href="https://snyk.io/redirect/github/lodash/lodash/releases/tag/4.17.16">2020-07-08</a></br>No content. </li> <li> <b>4.17.15</b> - <a href="https://snyk.io/redirect/github/lodash/lodash/releases/tag/4.17.15">2019-07-19</a></br><p>4.17.15</p> </li> </ul> from <a href="https://snyk.io/redirect/github/lodash/lodash/releases">lodash GitHub release notes</a> </details> </details> <hr/>

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information: <img src="https://app.snyk.io/badges/merge-advice/empty?pr_id=9caaef58-3b59-445e-8871-f8b40898ffef" width="1" height="1"/> <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI5Y2FhZWY1OC0zYjU5LTQ0NWUtODg3MS1mOGI0MDg5OGZmZWYiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjljYWFlZjU4LTNiNTktNDQ1ZS04ODcxLWY4YjQwODk4ZmZlZiJ9fQ==" width="0" height="0"/>

🧐 View latest project report

🛠 Adjust upgrade PR settings

🔕 Ignore this dependency or unsubscribe from future upgrade PRs

<!--- (snyk:metadata:{"prId":"9caaef58-3b59-445e-8871-f8b40898ffef","dependencies":[{"name":"lodash","from":"4.17.15","to":"4.17.19"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr","projectPublicId":"1255c37c-7443-439f-bc4f-1b0c453284dc","env":"prod","prType":"upgrade","vulns":["SNYK-JS-LODASH-567746"],"issuesToFix":[{"issueId":"SNYK-JS-LODASH-567746","severity":"medium","title":"Prototype Pollution","exploitMaturity":"proof-of-concept"}],"upgrade":["SNYK-JS-LODASH-567746"],"upgradeInfo":{"versionsDiff":4,"publishedDate":"2020-07-08T17:14:40.866Z"},"templateVariants":[],"hasFixes":true,"isMajorUpgrade":false,"isBreakingChange":false}) --->

+19 -5

1 comment

2 changed files

snyk-bot

pr closed time in a month

push eventToonvanStrijp/nestjs-i18n

dependabot[bot]

commit sha 9720e9f4a647c9ad7065399e3af3d57f9fbc0d65

Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com>

view details

Toon van Strijp

commit sha e8cbb9e57eb80e85a3b37174b14f59cd62dbb69b

Merge pull request #157 from ToonvanStrijp/dependabot/npm_and_yarn/lodash-4.17.19 Bump lodash from 4.17.15 to 4.17.19

view details

push time in a month

PR merged ToonvanStrijp/nestjs-i18n

Bump lodash from 4.17.15 to 4.17.19 dependencies

Bumps lodash from 4.17.15 to 4.17.19. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/lodash/lodash/releases">lodash's releases</a>.</em></p> <blockquote> <h2>4.17.16</h2> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/lodash/lodash/commit/d7fbc52ee0466a6d248f047b5d5c3e6d1e099056"><code>d7fbc52</code></a> Bump to v4.17.19</li> <li><a href="https://github.com/lodash/lodash/commit/2e1c0f22f425e9c013815b2cd7c2ebd51f49a8d6"><code>2e1c0f2</code></a> Add npm-package</li> <li><a href="https://github.com/lodash/lodash/commit/1b6c282299f4e0271f932b466c67f0f822aa308e"><code>1b6c282</code></a> Bump to v4.17.18</li> <li><a href="https://github.com/lodash/lodash/commit/a370ac81408de2da77a82b3c4b61a01a3b9c2fac"><code>a370ac8</code></a> Bump to v4.17.17</li> <li><a href="https://github.com/lodash/lodash/commit/1144918f3578a84fcc4986da9b806e63a6175cbb"><code>1144918</code></a> Rebuild lodash and docs</li> <li><a href="https://github.com/lodash/lodash/commit/3a3b0fd339c2109563f7e8167dc95265ed82ef3e"><code>3a3b0fd</code></a> Bump to v4.17.16</li> <li><a href="https://github.com/lodash/lodash/commit/c84fe82760fb2d3e03a63379b297a1cc1a2fce12"><code>c84fe82</code></a> fix(zipObjectDeep): prototype pollution (<a href="https://github-redirect.dependabot.com/lodash/lodash/issues/4759">#4759</a>)</li> <li><a href="https://github.com/lodash/lodash/commit/e7b28ea6cb17b4ca021e7c9d66218c8c89782f32"><code>e7b28ea</code></a> Sanitize sourceURL so it cannot affect evaled code (<a href="https://github-redirect.dependabot.com/lodash/lodash/issues/4518">#4518</a>)</li> <li><a href="https://github.com/lodash/lodash/commit/0cec225778d4ac26c2bac95031ecc92a94f08bbb"><code>0cec225</code></a> Fix lodash.isEqual for circular references (<a href="https://github-redirect.dependabot.com/lodash/lodash/issues/4320">#4320</a>) (<a href="https://github-redirect.dependabot.com/lodash/lodash/issues/4515">#4515</a>)</li> <li><a href="https://github.com/lodash/lodash/commit/94c3a8133cb4fcdb50db72b4fd14dd884b195cd5"><code>94c3a81</code></a> Document matches* shorthands for over* methods (<a href="https://github-redirect.dependabot.com/lodash/lodash/issues/4510">#4510</a>) (<a href="https://github-redirect.dependabot.com/lodash/lodash/issues/4514">#4514</a>)</li> <li>Additional commits viewable in <a href="https://github.com/lodash/lodash/compare/4.17.15...4.17.19">compare view</a></li> </ul> </details> <details> <summary>Maintainer changes</summary> <p>This version was pushed to npm by <a href="https://www.npmjs.com/~mathias">mathias</a>, a new releaser for lodash since your current version.</p> </details> <br />

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the Security Alerts page.

</details>

+18 -4

1 comment

1 changed file

dependabot[bot]

pr closed time in a month

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha 0e4dfd43b34b04b55319bd8c20b899c2fc3f4985

fix: upgrade lodash from 4.17.15 to 4.17.19 Snyk has created this PR to upgrade lodash from 4.17.15 to 4.17.19. See this package in NPM: https://www.npmjs.com/package/lodash See this project in Snyk: https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr

view details

push time in a month

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha c118a693ad6ea6796ebb6fbdd3ac02060caf8f87

fix: package.json & package-lock.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-LODASH-567746

view details

push time in a month

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

@willianfalbo help is always welcome ;) today is my day off and I'll be back this evening (in about 6 hours). So if you have time please take a look at it ;)

mrdntgrn

comment created time in a month

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha 3d63f850376ae7fcc48dbf42d225a6d0eecc7938

fix: upgrade rxjs from 6.5.5 to 6.6.0 Snyk has created this PR to upgrade rxjs from 6.5.5 to 6.6.0. See this package in NPM: https://www.npmjs.com/package/rxjs See this project in Snyk: https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr

view details

push time in a month

issue commentToonvanStrijp/nestjs-i18n

The 'fallbackLanguage' did not work after upgrade from 4.1.3 => 8.0.6

@mrdntgrn oehh this sounds indeed like a bug. Could you send me a small project setup so I can easily replicate and test this issue? I think this might be related when we merged #151.

mrdntgrn

comment created time in a month

pull request commentToonvanStrijp/nestjs-i18n

fix: obtaining i18nService and i18nLang directly from graphqlContext, not from header

@wowczarczyk Thanks! Released in v8.0.6! 🎉

wowczarczyk

comment created time in 2 months

created tagToonvanStrijp/nestjs-i18n

tagV8.0.6

Add i18n support inside your nestjs project

created time in 2 months

release ToonvanStrijp/nestjs-i18n

V8.0.6

released time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 9a832fe2106519c2513aa5532dadb610608a4205

update dependencies

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Wojciech Owczarczyk

commit sha 47c4f7eefbe37a98faa1fc41ad83741fce036ac5

fix: obtaining i18nService and i18nLang directly from graphqlContext, not from header

view details

Toon van Strijp

commit sha b4e0d1c4a0732d20a49e3970ed834023319bd547

Merge pull request #152 from wowczarczyk/obtaining-context-graphql fix: obtaining i18nService and i18nLang directly from graphqlContext, not from header

view details

push time in 2 months

issue closedToonvanStrijp/nestjs-i18n

Usage with Bull

Hi,

We have some APIs translated using this project and it works pretty well :)

But now, we want to translate Nest micro services that are using Bull to receive messages.

We looked at custom resolvers but it seems it's http request based. I can't figure out how to get Bull related messages.

Thanks :)

closed time in 2 months

VincentSurelle

issue commentToonvanStrijp/nestjs-i18n

Usage with Bull

@VincentSurelle Closing this issue for now ;) let me know if this needs to be reopened

VincentSurelle

comment created time in 2 months

created tagdebugged-software/kip

tagv0.0.14

Kubernetes project cli

created time in 2 months

push eventdebugged-software/kip

Toon van Strijp

commit sha 207574f65fa5faef6fc90a29b33ddcf4bc9986ea

fix values path

view details

push time in 2 months

issue closedToonvanStrijp/nestjs-i18n

Fallback specific language when receiving multiple ones

At the moment, my app handles pt-BR as the default language. However, I want to fallback en in case of receiving en-US, en-GB, en-CA, en-IE and so on.

Is it possible to fallback a specific language when receiving multiple options?

It would be great if we could setup multiple fallback languages. E.g:

...
export const I18N_CONFIG: I18nOptions = {
  path: path.join(__dirname, '..', 'assets', 'i18n'),
  filePattern: '*.json',
  defaultLanguage: 'pt-BR',
  fallbackLanguages: [{ 'en-*': 'en' }, { 'fr-*': 'fr' }, { 'pt': 'pt-BR' }],
  resolvers: [new HeaderResolver(['xLang'])],
};
...

I appreciate any help.

closed time in 2 months

willianfalbo

issue commentToonvanStrijp/nestjs-i18n

Fallback specific language when receiving multiple ones

@willianfalbo release V8.0.5 is out! 🚀 Great work @willianfalbo!

willianfalbo

comment created time in 2 months

created tagToonvanStrijp/nestjs-i18n

tagV8.0.5

Add i18n support inside your nestjs project

created time in 2 months

release ToonvanStrijp/nestjs-i18n

V8.0.5

released time in 2 months

PR closed ToonvanStrijp/nestjs-i18n

[Snyk] Upgrade chalk from 4.0.0 to 4.1.0

<h3>Snyk has created this PR to upgrade chalk from 4.0.0 to 4.1.0.</h3>

merge advice

<details> <summary>✨What is Merge Advice?</summary> We check thousands of dependency upgrade pull requests and CI tests every day to see which upgrades were successfully merged. After crunching this data, we give a recommendation on how safe we think the change is for you to merge without causing issues.<a href="https://support.snyk.io/hc/en-us/articles/360007389537" target="_blank"> Learn more</a>, and <a href="https://forms.gle/gg4TXpp5pukJxC23A" target="_blank">share your feedback</a> to help improve this feature. 🙏 </details> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/>

  • The recommended version is 1 version ahead of your current version.
  • The recommended version was released 2 days ago, on 2020-06-09.

<details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>chalk</b></summary> <ul> <li> <b>4.1.0</b> - <a href="https://snyk.io/redirect/github/chalk/chalk/releases/tag/v4.1.0">2020-06-09</a></br><ul> <li>Support template literals for nested calls (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="590182601" data-permission-text="Title is private" data-url="https://github.com/chalk/chalk/issues/392" data-hovercard-type="pull_request" data-hovercard-url="/chalk/chalk/pull/392/hovercard" href="https://snyk.io/redirect/github/chalk/chalk/pull/392">#392</a>) <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/chalk/chalk/commit/09ddbadcb5569f6d6ace11f54242c339d727d546/hovercard" href="https://snyk.io/redirect/github/chalk/chalk/commit/09ddbadcb5569f6d6ace11f54242c339d727d546"><tt>09ddbad</tt></a></li> </ul> <p><a class="commit-link" href="https://snyk.io/redirect/github/chalk/chalk/compare/v4.0.0...v4.1.0"><tt>v4.0.0...v4.1.0</tt></a></p> </li> <li> <b>4.0.0</b> - <a href="https://snyk.io/redirect/github/chalk/chalk/releases/tag/v4.0.0">2020-04-02</a></br><h3>Breaking</h3> <ul> <li>Require Node.js 10 <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/chalk/chalk/commit/61999a4e77f7d4ca0631f6c833b9ad5d76d925d5/hovercard" href="https://snyk.io/redirect/github/chalk/chalk/commit/61999a4e77f7d4ca0631f6c833b9ad5d76d925d5"><tt>61999a4</tt></a></li> <li>Change the <code>Level</code> TypeScript type to be a union instead of enum <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/chalk/chalk/commit/f0f4638a92890ba3a329209836d5f904cfeb581a/hovercard" href="https://snyk.io/redirect/github/chalk/chalk/commit/f0f4638a92890ba3a329209836d5f904cfeb581a"><tt>f0f4638</tt></a></li> </ul> <div class="highlight highlight-source-diff"><pre><span class="pl-md"><span class="pl-md">-</span>if (chalk.level > Level.None) {}</span> <span class="pl-mi1"><span class="pl-mi1">+</span>if (chalk.level > 0) {}</span></pre></div> <h3>Improvements</h3> <ul> <li>Use <code>Object.setPrototypeOf</code> as <code>proto</code> could potentially be disabled (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="578675018" data-permission-text="Title is private" data-url="https://github.com/chalk/chalk/issues/387" data-hovercard-type="pull_request" data-hovercard-url="/chalk/chalk/pull/387/hovercard" href="https://snyk.io/redirect/github/chalk/chalk/pull/387">#387</a>) <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/chalk/chalk/commit/63469d30e4514136651ae0bbe08e2d3046b02024/hovercard" href="https://snyk.io/redirect/github/chalk/chalk/commit/63469d30e4514136651ae0bbe08e2d3046b02024"><tt>63469d3</tt></a></li> </ul> <p><a class="commit-link" href="https://snyk.io/redirect/github/chalk/chalk/compare/v3.0.0...v4.0.0"><tt>v3.0.0...v4.0.0</tt></a></p> </li> </ul> from <a href="https://snyk.io/redirect/github/chalk/chalk/releases">chalk GitHub release notes</a> </details> </details>

<details> <summary><b>Commit messages</b></summary> </br> <details> <summary>Package name: <b>chalk</b></summary> <ul> <li><a href="https://snyk.io/redirect/github/chalk/chalk/commit/4c3df8847256f9f2471f0af74100b21afc12949f">4c3df88</a> 4.1.0</li> <li><a href="https://snyk.io/redirect/github/chalk/chalk/commit/09ddbadcb5569f6d6ace11f54242c339d727d546">09ddbad</a> Support template literals for nested calls (#392)</li> <li><a href="https://snyk.io/redirect/github/chalk/chalk/commit/55816cdd4d25a86cc35b18e1e578a5b164f71aee">55816cd</a> Update readme links to use https (#396)</li> </ul>

<a href="https://snyk.io/redirect/github/chalk/chalk/compare/31fa94208034cb7581a81b06045ff2cf51057b40...4c3df8847256f9f2471f0af74100b21afc12949f">Compare</a> </details> </details> <hr/>

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information: <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJhNWM4ZDgzZC0wMDVlLTRhZTMtYmI2Yy0wM2M0NzlhZDIzNzUiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImE1YzhkODNkLTAwNWUtNGFlMy1iYjZjLTAzYzQ3OWFkMjM3NSJ9fQ==" width="0" height="0"/>

🧐 View latest project report

🛠 Adjust upgrade PR settings

🔕 Ignore this dependency or unsubscribe from future upgrade PRs

<!--- (snyk:metadata:{"prId":"a5c8d83d-005e-4ae3-bb6c-03c479ad2375","dependencies":[{"name":"chalk","from":"4.0.0","to":"4.1.0"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr","projectPublicId":"1255c37c-7443-439f-bc4f-1b0c453284dc","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2020-06-09T07:43:42.525Z"},"templateVariants":["merge-advice-badge-shown"],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false}) --->

+4 -4

1 comment

2 changed files

snyk-bot

pr closed time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha cb268536a44a522eef75d1416d4fd9a0cbdeac22

update package version

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 43e62b9d3a1fa04852a30150725f6254544eda03

update dependencies

view details

push time in 2 months

pull request commentToonvanStrijp/nestjs-i18n

added fallbacks

I'll do some dependency updates and after I'll create a new release with this new feature in it! Great work @willianfalbo! Thanks again!

willianfalbo

comment created time in 2 months

push eventToonvanStrijp/nestjs-i18n

willianfalbo

commit sha e7440a3187a4848b8b224e680a30c0ffb6c86102

added fallbacks #138

view details

Willian Falbo

commit sha 407cbf37aac5283b4091410e5b0a1792b01d1900

Update README.md

view details

Toon van Strijp

commit sha 0b1920bc458184e715889e056a384b310b9880eb

Merge pull request #151 from willianfalbo/fallbacks add multiple fallbacks

view details

push time in 2 months

PR merged ToonvanStrijp/nestjs-i18n

added fallbacks

To configure multiple fallbacks. #138 :metal:

Hey mate @ToonvanStrijp ! I hope I've made the proper changes to this PR. Btw, feel free to suggest any changes or correct my mistakes if needed =)

Cheers

+929 -3

1 comment

10 changed files

willianfalbo

pr closed time in 2 months

Pull request review commentToonvanStrijp/nestjs-i18n

added fallbacks

 I18nModule.forRootAsync({ }); ``` +#### Using Fallbacks++To configure multiple fallbacks use `fallbacks` option. You could handle a single language or multiple ones.++```typescript+I18nModule.forRoot({+  fallbackLanguage: 'en',+  fallbacks: {+    'en-CA': 'fr',+    'en-*': 'en',+    'fr-*': 'fr',+    'pt': 'pt-BR',+  },+  parser: I18nJsonParser,+  parserOptions: {+    path: path.join(__dirname, '/i18n/'),+  },+});+```+

Thanks mate!

willianfalbo

comment created time in 2 months

Pull request review commentToonvanStrijp/nestjs-i18n

added fallbacks

 I18nModule.forRootAsync({ }); ``` +#### Using Fallbacks++To configure multiple fallbacks use `fallbacks` option. You could handle a single language or multiple ones.++```typescript+I18nModule.forRoot({+  fallbackLanguage: 'en',+  fallbacks: {+    'en-CA': 'fr',+    'en-*': 'en',+    'fr-*': 'fr',+    'pt': 'pt-BR',+  },+  parser: I18nJsonParser,+  parserOptions: {+    path: path.join(__dirname, '/i18n/'),+  },+});+```+

Sample looks good 👍 😄 , but I would add something to tell the developer that en and fr translations are needed in order for this to work correctly.

willianfalbo

comment created time in 2 months

push eventToonvanStrijp/nestjs-i18n

snyk-bot

commit sha f335d9fc43ae567ac5cb0d3a1893c39964bda6fc

fix: upgrade chalk from 4.0.0 to 4.1.0 Snyk has created this PR to upgrade chalk from 4.0.0 to 4.1.0. See this package in NPM: https://www.npmjs.com/package/chalk See this project in Snyk: https://app.snyk.io/org/toonvanstrijp/project/1255c37c-7443-439f-bc4f-1b0c453284dc?utm_source=github&utm_medium=upgrade-pr

view details

push time in 2 months

issue commentToonvanStrijp/nestjs-i18n

Fallback specific language when receiving multiple ones

@willianfalbo thanks for the update! If you need any help, let me know ;)

willianfalbo

comment created time in 2 months

issue commentToonvanStrijp/nestjs-i18n

How to get it to work?

@kkoomen thanks for you feedback! I hope you enjoy using this package! With the input from people like you this package improves by the day!

kkoomen

comment created time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 714ea4bdafa526bc863a80e851b91722e1752e65

Update README.md

view details

push time in 2 months

issue closedToonvanStrijp/nestjs-i18n

How to get it to work?

I don't know if it's me or lack of clarity in documentation but I've read everything and can't get this plugin to work.

I have my project inside ~/project and inside there I have this tree

~/project
├── README.md
├── dist
├── i18n
├── nest-cli.json
├── node_modules
├── package.json
├── src
├── template
├── test
├── tsconfig.build.json
├── tsconfig.json
├── yarn-error.log
└── yarn.lock

and the i18n looks like this:

~/project/i18n
├── en
│   └── test.json
└── zh
    └── test.json

and inside them I have this:

~/project/i18n/en/test.json

{
  "validation": {
    "isString": "{property} must be a string"
  },
  "exceptions": {
    "unprocessableEntity": "Unprocessable Entity"
  }
}

~/project/i18n/zh/test.json

{
  "validation": {
    "isString": "{property}应该是字符类型"
  },
  "exceptions": {
    "unprocessableEntity": "Unprocessable Entity"
  }
}

then I added a custom validation pipe and inside there I have this:

import { ArgumentMetadata, Injectable, PipeTransform, UnprocessableEntityException } from '@nestjs/common';
import { plainToClass } from 'class-transformer';
import { validate, ValidationError } from 'class-validator';
import { I18nService } from 'nestjs-i18n';

@Injectable()
export class I18nValidationPipe implements PipeTransform<any> {
  constructor(private readonly i18n: I18nService) { }

  async transform(value: any, { metatype }: ArgumentMetadata) {
    if (!metatype || !this.toValidate(metatype)) {
      return value;
    }
    const object = plainToClass(metatype, value);
    const errors = await validate(object);
    if (errors.length > 0) {
      throw new UnprocessableEntityException(
        await this.translateErrors(errors),
        await this.i18n.translate('exceptions.unprocessableEntity'),
      );
    }
    return value;
  }

  private toValidate(metatype: Function): boolean {
    const types: Function[] = [String, Boolean, Number, Array, Object];
    return !types.includes(metatype);
  }

  async translateErrors(errors: ValidationError[]) {
    const data = [];
    errors.forEach(async (error) => {
      const message = await Promise.all(
        Object
          .keys(error.constraints)
          .map(async (key: string) => this.i18n.translate(`validation.${key}`, {
            args: {
              property: error.property,
            },
          })),
      );
      data.push({ field: error.property, message });
    });
    return data;
  }
}

and the response is

{
    "statusCode": 422,
    "message": [
        {
            "field": "type",
            "message": [
                "validation.isString"
            ]
        }
    ],
    "error": "exceptions.unprocessableEntity"
}

This is my app.module.ts

@Module({
  imports: [
    I18nModule.forRoot({
      fallbackLanguage: 'en',
      parser: I18nJsonParser,
      parserOptions: {
        path: path.join(__dirname, '/i18n/'),
        watch: true,
      },
      resolvers: [new HeaderResolver(['language'])],
    }),
  ],
  providers: [
    { provide: APP_PIPE, useClass: I18nValidationPipe },
  ],
})
export class AppModule {}

<hr />

As you see, it returns validation.isString. It doens't resolve this to any translation string. What do I need in order to make this work?

I also tried the basic example json you provided in the README and even used user.HELLO_MESSAGE or just HELLO_MESSAGE but nothing seems to work.

I also added watch: true which also doesn't work. I change my i18n/en/test.json file and doesn't get compiled. The dist/i18n/en/test.json is not being updated.

closed time in 2 months

kkoomen

issue commentToonvanStrijp/nestjs-i18n

How to get it to work?

@kkoomen The documentation isn't wrong. Cause when you follow the documentation the i18n folder should be in your src folder. And not in the root folder.

Then you'll also need to add this: https://github.com/ToonvanStrijp/nestjs-i18n#nest-clijson-copy-i18n to copy your translation files to your dist folder.

kkoomen

comment created time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 3bd075361f98de37a6c7834050b0d7bef7715476

update chokidar

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 712eca31fad4db91c1fc5d4f6448f627603a53ef

update test

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 47f6ec428abc250adc08354b9063f50dc4246f7d

revert chokidar version

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 5c1d40c910095b1a165957231297b9b308df81df

improve test cleanup

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 72e585cf518ce9f545f9385144e817bdc5108ba9

add timeout for manual refresh in tests

view details

push time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha 7078b3bbb4df93cd389774c71d91f6a74d57f53b

load translations & languages before module init

view details

Toon van Strijp

commit sha 7a58ceb664b6d2a4303ed4ae4e4da4a589d02811

cleanup code

view details

Toon van Strijp

commit sha 6158b1b3d9eecf70aabd66d5ebc0f2f32b71d019

update packages

view details

push time in 2 months

issue commentToonvanStrijp/nestjs-i18n

How to get it to work?

@kkoomen

I think your path property is wrong. It should be: path: path.join(__dirname, '../i18n/'),

Let me know if this solved your issue.

kkoomen

comment created time in 2 months

issue commentToonvanStrijp/nestjs-i18n

How to get it to work?

Alrighty will do, (thought maybe it's faster to share)

kkoomen

comment created time in 2 months

issue commentToonvanStrijp/nestjs-i18n

Fallback specific language when receiving multiple ones

@willianfalbo heey man :) any progress on this issue? :)

willianfalbo

comment created time in 2 months

issue commentToonvanStrijp/nestjs-i18n

How to get it to work?

@kkoomen could you send me a zip with the whole project, so I can easily test it :)

kkoomen

comment created time in 2 months

issue commentToonvanStrijp/nestjs-i18n

add support for DTO validation message

@Kannas24 I'm not sure how to design this in a good way yet... So if you have suggestions please let me know :)

If the design is clean I can easily build it and create a new release! 🎉

sanjitbauli

comment created time in 2 months

issue commenti18next/i18next-express-middleware

NestJS and I18Next

@adrai @kkoomen nestjs-i18n replaces the need for i18next inside a nestjs project. So the packages aren't compatible with each other.

johannesschobel

comment created time in 2 months

issue closedToonvanStrijp/nestjs-i18n

Use i18nService.t() as an alias to i18nService.translate()

A common thing in i18n projects is to make an alias method named t which is an alias of translate. It'd be something like this:

export class I18nService {
  public async translate() { ... }

  public async t(...args: []) {
    this.translate(...args);
  }
}

closed time in 2 months

kkoomen

issue commentToonvanStrijp/nestjs-i18n

Use i18nService.t() as an alias to i18nService.translate()

@kkoomen fixed and released in version V8.0.4! 🎉 🌮 🦖

kkoomen

comment created time in 2 months

created tagToonvanStrijp/nestjs-i18n

tagV8.0.4

Add i18n support inside your nestjs project

created time in 2 months

release ToonvanStrijp/nestjs-i18n

V8.0.4

released time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha fdcd90d8addf58b6a7bb378b9607a894af980010

add shorthand for translate (t)

view details

Toon van Strijp

commit sha 5c446a2fd838969700498c85ff49b5534f5d3483

update dependencies

view details

Toon van Strijp

commit sha c3f790581547187d18aacd202ed3380783e4c81c

update package version

view details

push time in 2 months

delete branch ToonvanStrijp/nestjs-i18n

delete branch : goodbye-greenkeeper

delete time in 2 months

push eventToonvanStrijp/nestjs-i18n

greenkeeper[bot]

commit sha 16e86402890c9d01433613de0150d71a99bb1f99

chore(readme): remove Greenkeeper badge

view details

Toon van Strijp

commit sha 8a7d3e34a53478ea18ce630506a630fa3a97af9d

Merge pull request #147 from ToonvanStrijp/goodbye-greenkeeper Goodbye Greenkeeper 👋

view details

push time in 2 months

PR merged ToonvanStrijp/nestjs-i18n

Goodbye Greenkeeper 👋

Greenkeeper says goodbye!

As you know, Greenkeeper is coming to an end in June!

We're sad to say goodbye, but we're glad you've opted to migrate to Snyk. Not only do they offer similar dependency upgrade functionality but also awesome open source security fixes - all with the same love for the community that made Greenkeeper a success. Find out more about the partnership with Snyk.

What's this PR?

This PR is just to remove the Greenkeeper badge and tidy up this repo as Greenkeeper says goodbye! 👋


Farewell from your Greenkeeper bot 🌴

+1 -1

1 comment

1 changed file

greenkeeper[bot]

pr closed time in 2 months

issue commentToonvanStrijp/nestjs-i18n

Use i18nService.t() as an alias to i18nService.translate()

@kkoomen ow cool never thought of that before! But sure, if you make a pull request for this I'll approve it!

kkoomen

comment created time in 2 months

push eventToonvanStrijp/nestjs-i18n

Toon van Strijp

commit sha fd893547d7df6726d71fb6d6749328a926abdfad

Update README.md

view details

push time in 2 months

startedjuicycleff/ultimate-backend

started time in 2 months

issue closedToonvanStrijp/nestjs-i18n

Request and transient-scoped providers can't be used in combination with "get()" method. Please, use "resolve()" instead.

A new NestJS update causes the following error:

QueryResolver is marked as a scoped provider. Request and transient-scoped providers can't be used in combination with "get()" method. Please, use "resolve()" instead.

closed time in 2 months

ToonvanStrijp

issue closedToonvanStrijp/nestjs-i18n

Console Error

I have integrated into nest 7.0.0. Language translation is working as expected but getting the error on console on each translation Translation "message.HELLO_MESSAGE" in "undefined" does not exist..

image

I appreciate any help.

closed time in 2 months

ompandey13

issue commentToonvanStrijp/nestjs-i18n

Console Error

This issue is fixed in release: V8.0.3! 🎉

ompandey13

comment created time in 2 months

more