Comments (6)
Hi, it is possible, in your case it would be:
<Text
id='some.id'
defaultMessage='Some message with {link} in the middle.'
link={<CustomLink to='...'>link text</CustomLink>}
/>
I will check, why it does not work, when we pass function as param.
from eo-locale.
Thanks, but as I understand it requires two templates: Some message with {link} in the middle.
& link text
. But I'm talking about single template: Some message with <link>link text</link> in the middle.
. It's more useful and some localise platforms has free/paid limitations based on strings count.
from eo-locale.
Yes, it make sense. For now, you can do it with html tags, like:
<Text
html
id='some.id'
defaultMessage='Some message with <a class="%css_class%" href="{url}">link text</a> in the middle.'
url='%url%'
/>
Therefore you can use any html syntax inside message, but jsx syntax inside message does not supported.
from eo-locale.
but jsx syntax inside message does not supported.
That's the case. I suppose, it might be a good feature.
from eo-locale.
Yeah, thank you for the idea! I will research, how it can be implemented nicely, but in general I would strongly recommend avoid using any code inside translations. It creates hard connection between translations and implementation of view.
from eo-locale.
Just curious any update on this ? ;) it would be great if we can support something similar to Trans
from react-i18next
. I think the benefit is that the translator will get the full context, and that can be very helpful to have accurate translations
from eo-locale.
Related Issues (20)
- React 18 HOT 5
- Usage of renderToStaticMarkup from react-dom/server in react Text component bloats client filesize HOT 7
- Does not seem to parse complex nested strings
- Validate and improve documentation HOT 8
- Can not format date, number, and plural in React Native HOT 3
- Differences in Preact API HOT 6
- Implement unit tests for @eo-locale/preact
- Implement integration with Svelte
- Implement integration with Vue
- Cannot read property 'getMessageById' of undefined HOT 4
- Wrongly raise `id missing` error when translation === id HOT 2
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module HOT 6
- Messages extration for translation HOT 6
- React v17 HOT 5
- Does not handle ICU offset HOT 2
- Refactor tests to React Testing library
- `select` role don't support `other` case HOT 2
- Need to use 'fullySpecified' Webpack 5 config to use this library
- No Error on missing Translation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eo-locale.