Comments (7)
Hey @uvworkspace actually that is perfect. Years ago I did an i18n library for JS - at https://github.com/deitch/jsorm-i18n now a little dated - but the structure was the same. The concept is exactly that, you should be able to use files that end in en_US
, else en
else just the name. It was the inspiration for this part.
The only place in activator that the default language is used explicitly is those two lines in activator.js where it calls "en_US"
. It makes a lot of sense to do what you did - take it out to a config var, defaulting to "en_US"
(which, I will admit, is a little America-centric, and I speak 3 languages and a smattering of a few others, but it is where most of the market is nowadays; just being practical).
The only question I have is whether or not req.lang
is the right place to put it. It seems to have some common accepted practice, though, so we can live with it.
We definitely do not want to start parsing the Accept-Language
header; that is something that should happen at earlier middleware, select the preferred language, and pass it on to activator
.
Thanks for the great suggestions; we'll set up some tests and implement!
from activator.
Done. v0.4.4. Git push and npm publish complete. Enjoy!
from activator.
Well thanks a lot. I proposed so I don't have to clone it and modify just several lines. :).
from activator.
Actually was harder than I expected. The tests took some time to get just right, and although the req.lang || 'en_US
was easy, there was a nasty little bug with the template caching. But all is great now.
from activator.
Yes I can see it now. I need to control the locale used for different user based on url query and/or session, so the locale assignment is done earlier, and using Accept-Language header is not enough for me.
Now I guess later someone who want to use it may ask to use a different property name, then allowing user to configure it in init() may be good enough for a longer while, I guess. Thanks for the hard work.
from activator.
So? Go ahead and put in middleware to set req.lang
based on however you want. A different user can use different middleware.
Look in the README
; I put in a very basic example of where and how to put it.
from activator.
And you are quite welcome! Use it well.
from activator.
Related Issues (20)
- EJSONPARSE on Package json file HOT 3
- unit tests HOT 5
- How does it knows what I want (what user to look for) HOT 5
- Issue while sending activation link HOT 14
- Html links tags not working HOT 6
- Feature to resend the activation link HOT 1
- PasswordReset Completion issue HOT 3
- JWT Password Reset Codes HOT 15
- Support for password generation, strength enforcement and change notification. HOT 25
- completePasswordReset give me 'jwt must be provided' HOT 11
- cb is not a function when successful completPasswordReset HOT 6
- Function for templates HOT 5
- Custom content of activator template HOT 2
- authentication vs authorization HOT 3
- Using Activator broke native ES6 functions HOT 15
- Bug in resetPassword in example HOT 4
- 2 high vulnerabilities HOT 1
- Feature Request: Deactivate HOT 1
- Concepts explanation HOT 5
- With JWT password reset token can be used more than once 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 activator.