Comments (7)
Alright, added in latest releases:
The function is named i18nMark
after all. See the docs for more info.
from js-lingui.
IMHO the method should be named most closely to what it actually does, which in this case is something like 'markForTranslation/Extraction', 'addTranslation', 'linguiString', or even 'internationalize', rather than 'noop'... Looking at this example code I would have no idea what it does. Just an opinion.
from js-lingui.
Yeah I have similar concern. I know this naming from Django, but there is ugettext_noop
so you at least know that it's related to gettext.
It's basically i18n.t
without the translation, so maybe i18n_noop
, i18n_mark
, i18n_add
, i18n_dummy
, i18n_future
, i18n_lazy
(it could be also considered as "lazy" translation).
From your examples I'm considering markForTranslation
🤔
from js-lingui.
May I ask, how is this feature looking? I am really looking forward to it 👍 😊
from js-lingui.
I was a bit busy in last few weeks, so I was happy to find at least some time to refactor cli.
However, this should be very easy, I'll take a look this week.
If you want to work on this, it's basically just:
- Add another node matcher, similar to this: https://github.com/lingui/js-lingui/blob/master/packages/babel-plugin-lingui-transform-js/src/index.js#L7
- Make sure, we replace node with source string, not
i18n.t
call here: https://github.com/lingui/js-lingui/blob/master/packages/babel-plugin-lingui-transform-js/src/index.js#L218
I would go with following syntax:
import { i18n_noop } from 'lingui-i18n'
const languages = {
en: i18n_noop('English'),
cs: i18n_noop('Czech')
}
which would be transformed to
const languages = {
en: 'English',
cs: 'Czech'
}
Question is, how to handle translations with variables? 🤔 Should i18n_noop
support only static translations?
from js-lingui.
Thats ok, its still cool, you have time to improve this lib and push it further 👍 Doesnt have to be all at once..
Should
i18n_noop
support only static translations?
Given the typical usage of such function, I guess it should not be a problem. I would make it static and create an enhancement issue with a very low priority on it supporting even variables and tags. Just to keep all functions consistent, because I can imagine (in the future) people misusing this function and wondering why it doesnt work with variables.
from js-lingui.
Awesome!
from js-lingui.
Related Issues (20)
- lingui-extract-experimental.ts `extractFromFiles` concurrently? HOT 8
- inconsistent message from extract and macro with multiple consecutive newlines / trailing spaces HOT 4
- File location can affect extract results with defineMessage HOT 2
- Extract is not working with pnpm workspace with hoist disabled HOT 1
- Not extracted messages get replaced with generated ids in the production build HOT 2
- Update @lingui/vite-plugin to support Vite 5 HOT 10
- Usage with vue & vite with vite plugin HOT 1
- Broken build on CI HOT 6
- Double Render caused by wrong assertion HOT 1
- [Vite] Parentheses in catalog pathnames causes them to be unrecognized HOT 1
- Double render due to wrong assertion on nextjs-babel example HOT 1
- Using Trans inside a Plural macro unexpectedly replaces "#" found in variables HOT 5
- Webpack warning lingui-loader with pnpm HOT 2
- Examples show useEffect deps warning HOT 1
- Cannot kill git pre-commit hook while lingui command is running HOT 4
- Provide some way to turn off newline collapsing HOT 2
- `unraw` default export resolution error in React Native 0.73.2 HOT 1
- Dynamic loading not working with Expo HOT 1
- Support check the translated `msgstr` as expected HOT 2
- Lingui doesn't extract msg within a msg HOT 2
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 js-lingui.