update i18n stuff
This commit is contained in:
parent
e25b84c686
commit
0848412aa0
@ -18,7 +18,7 @@ type I18N struct {
|
||||
// root directory for translations
|
||||
translation_dir string
|
||||
// name of locale
|
||||
name string
|
||||
Name string
|
||||
}
|
||||
|
||||
var I18nProvider *I18N = nil
|
||||
@ -71,7 +71,7 @@ func NewI18n(locale, dir string) (*I18N, error) {
|
||||
}
|
||||
|
||||
return &I18N{
|
||||
name: locale,
|
||||
Name: locale,
|
||||
translation_dir: dir,
|
||||
Formats: formats.Options(),
|
||||
Translations: translations.Options(),
|
||||
|
@ -486,7 +486,11 @@ func (self *post) Attachments() []AttachmentModel {
|
||||
}
|
||||
|
||||
func (self *post) PostURL() string {
|
||||
return fmt.Sprintf("%st/%s/#%s", self.Prefix(), HashMessageID(self.Parent), self.PostHash())
|
||||
i18n := self._i18n
|
||||
if i18n == nil {
|
||||
i18n = I18nProvider
|
||||
}
|
||||
return fmt.Sprintf("%st/%s/?lang=%s#%s", self.Prefix(), HashMessageID(self.Parent), i18n.Name, self.PostHash())
|
||||
}
|
||||
|
||||
func (self *post) Prefix() string {
|
||||
|
@ -29,7 +29,7 @@ type nullHandler struct {
|
||||
func (self *nullHandler) GetI18N(r *http.Request) *I18N {
|
||||
lang := r.URL.Query().Get("lang")
|
||||
if lang == "" {
|
||||
lang = I18nProvider.name
|
||||
lang = I18nProvider.Name
|
||||
}
|
||||
self.access.Lock()
|
||||
i, ok := self.i18n[lang]
|
||||
|
@ -24,7 +24,7 @@
|
||||
<meta property="og:site_name" content="changolia" />
|
||||
<meta property="og:type" content="website"/>
|
||||
<meta property="og:title" content="{{board.Board}}"/>
|
||||
<meta property="og:url" content="{{board.Prefix}}b/{{board.Board}}/"/>
|
||||
<meta property="og:url" content="{{board.Prefix}}b/{{board.Board}}/?lang={{i18n.Name}}"/>
|
||||
<meta property="og:description" content="{{board.Board}} on changolia"/>
|
||||
|
||||
<meta property="og:image"
|
||||
|
@ -13,15 +13,15 @@
|
||||
<input type="hidden" name="reference" value="{{reference}}" id="postform_reference"/>
|
||||
<table cellspacing="1" cellpadding="0">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>{{#i18n.Translations}}{{name}}{{/i18n.Translations}}</th>
|
||||
<td><input type="text" name="name" class="posttext" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Subject</th>
|
||||
<th>{{#i18n.Translations}}{{subject}}{{/i18n.Translations}}</th>
|
||||
<td><input type="text" name="subject" class="posttext" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Comment</th>
|
||||
<th>{{#i18n.Translations}}{{comment}}{{/i18n.Translations}}</th>
|
||||
<td><textarea id="comment" name="message" class="postarea"></textarea></td>
|
||||
</tr>
|
||||
{{^DisableCaptcha}}
|
||||
@ -45,7 +45,7 @@
|
||||
{{/DisableCaptcha}}
|
||||
{{#files}}
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>{{#i18n.Translations}}{{file}}{{/i18n.Translations}}</th>
|
||||
<td>
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<meta property="og:type" content="website"/>
|
||||
<meta property="og:title" content="{{board.Board}}"/>
|
||||
<meta property="og:description" content="thread no. {{thread.OP.PostHash}} on changolia"/>
|
||||
<meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/"/>
|
||||
<meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/?lang={{i18n.Name}}"/>
|
||||
<meta property="og:image"
|
||||
content="{{prefix}}static/changolia-logo.png"/>
|
||||
</head>
|
||||
@ -32,10 +32,10 @@
|
||||
{{{thread.Navbar}}}
|
||||
<hr />
|
||||
<div class="sitetitle">
|
||||
<h2><a href="{{thread.Prefix}}">CHANGOLIA</a></h2>
|
||||
<h2><a href="{{thread.Prefix}}?lang={{i18n.Name}}">CHANGOLIA</a></h2>
|
||||
<b>Most of the rest of the wild west.</b>
|
||||
</div>
|
||||
<center><b><a href="{{thread.BoardURL}}">{{thread.Board}}</a></b></center>
|
||||
<center><b><a href="{{thread.BoardURL}}?lang={{i18n.Name}}">{{thread.Board}}</a></b></center>
|
||||
<br />
|
||||
{{{form}}}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
<meta property="og:type" content="website"/>
|
||||
<meta property="og:title" content="overboard"/>
|
||||
<meta property="og:description" content="changolia overboard"/>
|
||||
<meta property="og:url" content="{{prefix}}o/"/>
|
||||
<meta property="og:url" content="{{prefix}}o/?lang={{i18n.Name}}"/>
|
||||
<meta property="og:image"
|
||||
content="{{prefix}}static/changolia-logo.png"/>
|
||||
</head>
|
||||
@ -34,19 +34,19 @@
|
||||
<div id="paginator">
|
||||
{{#prev}}
|
||||
<span id="prev">
|
||||
<a href="{{prefix}}o/{{no}}/">previous</a>
|
||||
<a href="{{prefix}}o/{{no}}/?lang={{i18n.Name}}">previous</a>
|
||||
</span>
|
||||
{{/prev}}
|
||||
{{#next}}
|
||||
<span id="next">
|
||||
<a href="{{prefix}}o/{{no}}/">next</a>
|
||||
<a href="{{prefix}}o/{{no}}/?lang={{i18n.Name}}">next</a>
|
||||
</span>
|
||||
{{/next}}
|
||||
</div>
|
||||
{{#threads}}
|
||||
{{#Truncate}}
|
||||
<div class="thread" id="thread_{{OP.PostHash}}">
|
||||
Posted on <a href="{{BoardURL}}">{{Board}}</a>
|
||||
Posted on <a href="{{BoardURL}}?lang={{i18n.Name}}">{{Board}}</a>
|
||||
<br />
|
||||
{{{OP.RenderTruncatedPost}}}
|
||||
<div class="excluded">{{MissingPostCount}} posts excluded</div>
|
||||
@ -60,12 +60,12 @@
|
||||
<div id="paginator">
|
||||
{{#prev}}
|
||||
<span id="prev">
|
||||
<a href="{{prefix}}o/{{no}}/">previous</a>
|
||||
<a href="{{prefix}}o/{{no}}/?lang={{i18n.Name}}">previous</a>
|
||||
</span>
|
||||
{{/prev}}
|
||||
{{#next}}
|
||||
<span id="next">
|
||||
<a href="{{prefix}}o/{{no}}/">next</a>
|
||||
<a href="{{prefix}}o/{{no}}/?lang={{i18n.Name}}">next</a>
|
||||
</span>
|
||||
{{/next}}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user