Comments (7)
The source code should help with this.
from revel.
Yes from what I understand, a second arg can specify lang,
but I still do not understand this , later in code :
lang, _ = Config.String(defaultLanguageOption)
BTW, documentation is missing on this.
from revel.
That only occurs if the language passed in is empty, so it would default to the global configuration value set in the config i18n.default_language
. Which appears to be undocumented configuratuin option :-(
from revel.
Yes I tried to set to "fr" in Config, but instead to have
"about a second ago"
I got
"??? about a second ??? ??? ago ???"
I will try to dig further and propose a documentation if I understand what's going on ...
from revel.
Sounds like you are missing the french translations for about a second
and ago
. the way the function works is the configuration map timeAgoLangs
caches the message translations for everything in the MessageFunc
call
timeAgoLangs[lang] = timeago.Config{
PastPrefix: "",
PastSuffix: " " + MessageFunc(lang, "ago"),
FuturePrefix: MessageFunc(lang, "in") + " ",
FutureSuffix: "",
Periods: []timeago.FormatPeriod{
{time.Second, MessageFunc(lang, "about a second"), MessageFunc(lang, "%d seconds")},
{time.Minute, MessageFunc(lang, "about a minute"), MessageFunc(lang, "%d minutes")},
{time.Hour, MessageFunc(lang, "about an hour"), MessageFunc(lang, "%d hours")},
{timeago.Day, MessageFunc(lang, "one day"), MessageFunc(lang, "%d days")},
{timeago.Month, MessageFunc(lang, "one month"), MessageFunc(lang, "%d months")},
{timeago.Year, MessageFunc(lang, "one year"), MessageFunc(lang, "%d years")},
},
Zero: MessageFunc(lang, "about a second"),
Max: 73 * time.Hour,
DefaultLayout: "2006-01-02",
}
So you need to define in the french translation file what ago
means and about a second
and so on...
from revel.
OK, but by looking at timeago code, there is already a bunch of variables for several languages https://pkg.go.dev/github.com/xeonx/timeago#pkg-variables
So it is a pity having to set it, as code reading is required to list all strings to translate...
What about use those by default and set a config variable to fall back in current behavior?
from revel.
See PR #1564
from revel.
Related Issues (20)
- no required module provides package github.com/bradfitz/gomemcache/memcache; to add it: HOT 3
- Golang Revel config gqlgen
- could not clone the Skeleton source code HOT 2
- Unconditional recursive call
- please help me , I am trying the REVEL for first time
- Failed to import package=github.com/garyburd/redigo/redis HOT 3
- panic in "concurrent map read and map write" HOT 3
- Is the framework still actively being developed? HOT 5
- support video play? HOT 3
- Problem with Go 1.18 HOT 2
- Can't get jobs module to work
- Go Imagick
- revel.AppLog.*f locate line error
- Getting ERR_HTTP2_PROTOCOL_ERROR after updating SSL certifcates. HOT 1
- Getting error in Starting revel application HOT 1
- Vulnerability of dependency "golang.org/x/net, golang.org/x/sys"
- Will this framework continue to be updated in the future HOT 1
- no reachable servers
- Is this project still maintained? 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 revel.