Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jurien Hamaker
    @jurienhamaker
    anyone know how I can resolve this
    the lazy loaded translations are loaded fine
    (common, default, locale, meta, months & validation_errors are part of the "default" file)
    don't worry about the translation key, they both do the same
    Jurien Hamaker
    @jurienhamaker
    this is my TRANSLOCO_LOADER class:
    @Injectable({ providedIn: 'root' })
    export class TranslocoInlineLoader implements TranslocoLoader {
        getTranslation(lang: string) {
            return import(`../locales/${lang}.json`);
        }
    }
    Shahar Kazaz
    @shaharkazaz
    @jurienhamaker a small reproduction can make it easier to help you :)
    or at least provide a bit more information about your transloco config, webpack config, and an example of you json file.
    Weston
    @ronnyek
    I'd like to achieve somethign like this....
    Weston
    @ronnyek
    vaguely, that I want to have multiple apps in a nx workspace being able to load and lazily load translations from themselves, but have translations defined within the libraries so that each app isnt re-defining the translations that exist in the library
    I wanted to know if this should be possible out of box.
    Dmytro Bardai
    @dm-CaT

    I wanted to know if this should be possible out of box.

    yep.

    it's an implementation in a shared library
    Implementation in lazy loaded module: https://i.imgur.com/0c1tSao.png
    translocoLoader function: https://i.imgur.com/YSiur5w.png
    Weston
    @ronnyek
    I am also using this as a reference
    Weston
    @ronnyek
    ok, so we'd like to be able to provide multiple scopes using scopeloader from multiple modules. I've set multiple modules to provide the TRANSLOCO_SCOPE ensuring that multi:true and this seems to work. Is this something that is bad, or should this be just fine.
    Weston
    @ronnyek
    I just dont want to operate on the assumption this is fine, and then find out down the road it's gonna cause us a bunch of headaches
    Kyle
    @kthomas182
    Is there any documentation on implementing RTL (right to left) functionality?
    Brian
    @seadonk
    @kthomas182 not that i know of. I haven't seen any directionality info in the languages or locales, but you can provide it with a map of languages to directionality. I did this, then created a directionality service that i can subscribe to, and bound the directionality to my host dir attribute:
    @HostBinding('dir') rtl: 'rtl' | 'ltr';
    Kyle
    @kthomas182

    @kthomas182 not that i know of. I haven't seen any directionality info in the languages or locales, but you can provide it with a map of languages to directionality. I did this, then created a directionality service that i can subscribe to, and bound the directionality to my host dir attribute:
    @HostBinding('dir') rtl: 'rtl' | 'ltr';

    Thanks @seadonk, I'll check into that

    Stanislav Galiant
    @stsglnt
    Hello everyone. I'm trying to implement transloco in my new nx workspace. I've tried to use scoped library extractor but it requires package.json in each library and nx cli doesn't create it . If I add it manually with i18n: [] I still see an error "package.json is missing i181n information". Would appriciate any help/hint. I'm probably missing something obvious.
    Jurien Hamaker
    @jurienhamaker

    Hello, I am trying to create a very dynamic translation like so;

    {{ 'scope.information.' + info_key | transloco: { form: form.value } }}

    Where form is an object,

    But when I try to access a subkey of the form I am returned with an empty string (I presume it's trying to find another translation key with the name):
    "scope.information.some_key": "translate {{form.name}}"

    any idea how I can use an object as variable?
    Mauro
    @Tamm_gitlab
    Does transloco locale have any option to disable locale change on langChanges event?
    I have locale implemented as a separate config, i set it with setLocale
    but since language is also initialized on app load, it overwrites it
    Itay Oded
    @itayod
    @Tamm_gitlab I dont think we currently have an option for that... but feel free to create a PR and add that to the configuration
    Itay Oded
    @itayod
    Hi @stsglnt if you library doesn't have package.json file then it is not an npm package and therefor you don't require to use the scoped library extractor...
    see the main issue it resolves is that npm packages do not support dynamic imports due to building problems which makes it hard to work with assets files, but in your case it seems like you don't need it since you don't have a separate building process to you library, so you may just work like it's the same app :)
    1 reply
    Shahar Kazaz
    @shaharkazaz

    @jurienhamaker If I understand correctly, you are trying to access a subkey inside the translation string, that won't work for you, you need to pass the value you want to display:

    {
      "scope.information.some_key": "translate {{value}}"
    }
      {{ 'scope.information.some_key' | transloco: { value: form.value.some_key } }}

    You can make it dynamic if the last part of your key is also the property name, you can also write a custom transpiler which handles objects as values.

    Pappuraj
    @pappuraj02_gitlab
    when giving defaultLang : 'en or 'es ' the particular json http request is not calling in network.
    Shahar Kazaz
    @shaharkazaz
    @pappuraj02_gitlab can you please provide some context or reproduction? :slight_smile:
    Pappuraj
    @pappuraj02_gitlab
    hi @shaharkazaz pls check above screenshots in defaultLang i given 'en' its not loding the json in application. once i select the spanish its showing the json value. likewise i gave defaultLang as 'es' its not loading the application when i select the english its coming . i did not get this issue.please give some idea.
    Shahar Kazaz
    @shaharkazaz
    @pappuraj02_gitlab Seems like a very basic use-case, can you change our sample app according to your project and send it here? as you can see this is a working example with what you need.
    David Fecke
    @leptoquark1
    Can I put HTML into params (like for a[href] in texts)?
    2 replies
    Armin Zia
    @arminzia_gitlab
    Hiya, I need help with a deployment issue. Everything works fine in development but when I deploy the app to local IIS, translations are not applied and I see the key names instead (i.e. NAVBAR.HOME). Even though the translation files are fetched without a problem. Any ideas?
    1 reply
    Ivan
    @ivan1fun
    Hello!
    What is the file for? transloco.config.js
    2 replies
    Denis Ezhov
    @DenisHedgehog
    image.png
    Hello! Is there some method to migrate from old syntax to the new syntax?
    1 reply
    David Fecke
    @leptoquark1

    I have a problem with scoped translations in the component itself. Here's my code:

    module.ts

    @NgModule({
      providers: [{ provide: TRANSLOCO_SCOPE, useValue: 'articles' }],
    [...]

    component.ts
    [...]

      constructor(translocoService: TranslocoService) {
        this.sortItems = [
          // TODO Translation does not seem to work with the scope here
          { id: 'number', label: translocoService.translate('articles.article.number') },
          { id: 'name', label: translocoService.translate('articles.article.name') },
          { id: 'updated_at', label: translocoService.translate('articles.article.updated-at') },
        ];
        this.sortBy = this.sortItems[0];
      }
    [...]

    component.html

    [...]
        <div class="prose">
          <h2 class="headline">{{ 'articles.headline' | transloco }}</h2>
          <!-- No Problems with the scope there-->
          <h3 class="headline">{{ 'articles.article.number' | transloco }}</h3>
        </div>
    <wb-twc-dropdown-select [items]="sortItems" (itemClick)="onSorterItemClick($event)" [active]="sortBy"></wb-twc-dropdown-select>
    [...]

    No problem in the components template using the directives or pipes, but the service does not seems to be scoped in the component itself. Any obvious mistake by me?

    1 reply
    Esteban Luchsinger
    @eluchsinger
    @shaharkazaz the issue is that the xliff lib version 5.x went async.
    1 reply
    Nathaniel Peiffer
    @napei
    Is there a way I can debug the transloco directive nicely? Dealing with a component that refuses to load its content sometimes when it's surrounded by a *transloco container.
    1 reply
    Sune Radich Vestergaard
    @SuneRadich
    Is there a way to debug the language keys (and scopes) that is currently loaded?
    1 reply
    Valentine Zavrak
    @zavrakv
    Hey guys! I have a problem: when setting a scope to a component, transloco loads scoped translation twice (component is used once on the page). Is it some known bug? Can't find something similar in the issues
    Valentine Zavrak
    @zavrakv
    It happens if I set
    missingHandler: {
        useFallbackTranslation: true
    },
    Entire config:
    {
          provide: TRANSLOCO_CONFIG,
          useValue: translocoConfig({
            availableLangs: ['en', 'de'],
            fallbackLang: "en",
            missingHandler: {
              useFallbackTranslation: true
            },
            defaultLang: 'en',
            failedRetries: 2,
            // Remove this option if your application doesn't support changing language in runtime.
            reRenderOnLangChange: true,
            prodMode: environment.production,
          })
        },
    8 replies
    smmarrocco
    @smmarrocco
    hey everyone, came here instead of spinning up an issue in hopes to get a more informal response. Will transloco officially support Angular 11?
    Shahar Kazaz
    @shaharkazaz
    @smmarrocco Of course, we will release the update shortly :slight_smile:
    smmarrocco
    @smmarrocco
    @shaharkazaz fantastic! Thank you