Skip to content

Feature(config): scopePathMap - put value as array of strings (string[]) #845

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

Open
1 task done
swierzbicki opened this issue Mar 25, 2025 · 0 comments
Open
1 task done

Comments

@swierzbicki
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Which Transloco package(s) will this feature affect?

Transloco

Is your feature request related to a problem? Please describe

Currently scopePathMap allows only string values. Is it possible to make it an array of strings?

Current:

  scopePathMap: {
    dialogs: 'apps/nx-with-transloco/src/assets/i18n/dialogs'
  }

From my perspective the most common use case with NX mono repo is having multiple apps and some common nx libraries

Most of the time of course i put translation definitions within specific apps but sometimes are the cases where you want for example default texts in common components.

Let's say we have a alert dialog component. Usually we pass the translated text directly to .open(..)function. But sometimes we just want to have a default behavior for all apps. For example button with Confirm text inside alert dialog component.

Thanks by inline loaders and scopes i use this:

@NgModule({
  declarations: [LibWithTranslocoComponent],
  imports: [CommonModule, TranslocoPipe],
  providers: [ provideTranslocoScope({
    scope: 'dialogs',
    loader
  })],
  exports: [LibWithTranslocoComponent],
})
export class LibWithTranslocoModule {}

But in the end i need translations realted with this nx library "inside" i18n for specific app:

  • first app
  • second app
  • etc.

Describe the solution you'd like

Expected:

  scopePathMap: {
    dialogs: ['apps/first-app/src/i18n/dialogs', 'apps/second-app/src/i18n/dialogs']
  }

This should "copy" translation to both directories.

Describe alternatives you've considered

I'm not aware od other alternatives to solve this issue.

Additional context

No response

I would like to make a pull request for this feature

No

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