Comments (3)
I think this is by design. But you'd have to show your code.
The goal is to end up with a 'full' locale (language-REGION).
The map
parameter is important in this respect. Should you not care about the region, then supply a default one for each language you don't care about (e.g. map: {pt: pt-BR, en: en-US}
). Be sure to give this a try.
from express-locale.
I guess you mean this. So, I'll map a locale only to a locale-region pair? Or does it define the preferred variant if only the locale is provided?
from express-locale.
Sorry about the late response.
You indeed have to supply your own mapping. There is no default (see readme).
As in my example above, the mapping turns language-only values into full locales.
If you only care about the language, you can then get it by using req.locale.language
in your script. So even if someone visits with pt-PT, you'll never care, You just don't use req.locale.region
.
from express-locale.
Related Issues (16)
- Parse short codes HOT 2
- Add support for debug HOT 2
- Add option to limit accepted locales HOT 2
- It becomes default value when receiving accept-language without Locale HOT 5
- Setting allowed breaks to undefined HOT 2
- add config sanity checks HOT 1
- Date.toLocaleString (native) - RangeError: Invalid language tag: en_US HOT 3
- Invalid locale hard coded 'en_UK'; HOT 1
- Unclear interaction between `map` and `allowed` HOT 3
- The map parameter shows no effect HOT 1
- Always defaults HOT 3
- figure out missing region information HOT 5
- 1.0.0 roadmap HOT 2
- Query lookup doesnโt appear to be bundled HOT 10
- Error: Cannot find module 'babel-polyfill' HOT 5
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 express-locale.