Git Product home page Git Product logo

Comments (9)

PeterKottas avatar PeterKottas commented on June 13, 2024

Just to clarify, this is how I am using the trans component:

<Trans i18nKey="key">
  Special{' '}
  <span className="font-weight-light">
    (e.g. bank holidays, events ...)
  </span>
</Trans>

where the translation would be:

{
  ...,
  key: 'Special <2>(e.g. bank holidays, events ...)</2>',
  ...
}

from i18next-emoji-postprocessor.

adrai avatar adrai commented on June 13, 2024

Can you try to add the postProcess: 'emoji' option?

I suspect postProcess is not the working without that option for Trans component...
Need to ask @jamuhl if he knows more... I also suspect the tOption for Trans component is completely ignored...

This is probably because the overloadTranslationOptionHandler option is only executed, if no t options are passed...

This change in Translator.js fixes it, but breaks an older compatibility test:
image

from i18next-emoji-postprocessor.

jamuhl avatar jamuhl commented on June 13, 2024

https://github.com/i18next/react-i18next/blob/master/src/Trans.js#L259 you can pass in options via prop tOptions

from i18next-emoji-postprocessor.

adrai avatar adrai commented on June 13, 2024

Yes, setting tOptions individually works:
image

from i18next-emoji-postprocessor.

PeterKottas avatar PeterKottas commented on June 13, 2024

Thanks guys, I can confirm that adding:

postProcess: 'emoji'

to i18next options fixes this issue. Apparently there is no need to add this for every Trans component when that option is provided.

from i18next-emoji-postprocessor.

adrai avatar adrai commented on June 13, 2024

@PeterKottas Yes, that works, but it’s not an official api option... I’ve added a PR to react-i18next for further investigation next week...

from i18next-emoji-postprocessor.

jamuhl avatar jamuhl commented on June 13, 2024

@adrai it is official API -> it defines which postprocessors to run in each case: https://www.i18next.com/overview/configuration-options#translation-defaults

from i18next-emoji-postprocessor.

adrai avatar adrai commented on June 13, 2024

All ok, updated the readme

from i18next-emoji-postprocessor.

PeterKottas avatar PeterKottas commented on June 13, 2024

Lovely, thanks for your help gents!

from i18next-emoji-postprocessor.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.