Comments (9)
Hi, I wrote an example showing my usage, wasn't sure how to provide it, so I forked and added it here in examples folder #10
And there is a branch on that fork, that shows a problem I mentioned in this issue
to reproduce you can,
- switch to that branch, npm i
- npm run extract-intl (that will add an gb.json to locales folder with empty strings as there is no translation yet)
- npm run start
now when you choose gb as locale, the messages with variables remain as they are in file, despite that we have all it needs to place the variables
Hope that helps, best of luck!
from react-intl-universal.
Could you show the detail of this case? How do you use defaultMessage
method?
from react-intl-universal.
Actually, variables are ignored in the case of using intl.get('something', {foo}).d('something {foo} bar')
, so this seems like a bug, as this call results in 'something {foo} bar'. Kind of meaningless to have defaults if this is the case.
from react-intl-universal.
@Panoplos
It should be intl.get('something', {foo}).d(`something ${foo} bar`)
from react-intl-universal.
The documentation doesn't mention this.
from react-intl-universal.
Or rather, it does in the API section, but why is the default variable tag spec different from the locale data?
We have a script that automatically scrapes out defaults to build the base locale, having these be different requires us to remove the $
.
from react-intl-universal.
@Panoplos
The defaultMesssage is now ES6 Template literals format. And the locale file is ICU format.
I will make this intl.get('something', {foo}).d('something {foo} bar')
work, too, in next release.
Thanks for the suggestion.
from react-intl-universal.
@cwtuan Hi, is there any progress.
from react-intl-universal.
@liuyiliuyi
After reconsideration, I'd like to remain the current behavior for this API, because this proposal may make break changes.
And you could use react-intl-universal-extract
to extract the text in source code to locale files. It will remove the $
automatically.
from react-intl-universal.
Related Issues (20)
- [Template] Pull Request Template HOT 1
- {days, plural, zero {# يوم} one {# يوم} two {# أيام} few {# أيام} many {# يوم} other {# يوم}} 这种应该怎么写 HOT 1
- 请问最新版本能完全兼容1.3.4版本吗? HOT 1
- getHTML实际返回 React.Element 类型 但是typings 中定义的返回string类型
- intl.getHTML不兼容ts
- Is there any examples with Nextjs HOT 3
- Performance problems of get method HOT 2
- intl type hints
- [object Object] react value HOT 2
- 在使用 react-intl-universal-extract 时遇到 has no default message HOT 1
- The problems in the example
- cache HOT 1
- Typescript moduleResolution Bundler does not work properly in combination with strict true HOT 1
- Need for output locale key to UI
- Nextjs: Overusing intl.init() function HOT 5
- 关于如何动态加载多语言文件
- The options.locale may be readonly Module
- 请问 nexjs 怎么实现? 急急急!
- 请问在taro中怎么使用 HOT 2
- Dependencies update HOT 1
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 react-intl-universal.