mirror of
https://github.com/documize/community.git
synced 2025-07-18 20:59:43 +02:00
Implement basic i18n client-side foundation
This commit is contained in:
parent
59c929d251
commit
8a25509019
9 changed files with 33 additions and 18 deletions
|
@ -36,7 +36,7 @@ func GetSMTPConfig(s *store.Store) (c smtp.Config) {
|
|||
c.SenderEmail, _ = s.Setting.Get("SMTP", "sender")
|
||||
c.SenderName, _ = s.Setting.Get("SMTP", "senderName")
|
||||
if c.SenderName == "" {
|
||||
c.SenderName = "Documize"
|
||||
c.SenderName = "Documize Community"
|
||||
}
|
||||
|
||||
// anon auth?
|
||||
|
|
|
@ -41,7 +41,7 @@ func main() {
|
|||
rt.Product.Major = "4"
|
||||
rt.Product.Minor = "2"
|
||||
rt.Product.Patch = "3"
|
||||
rt.Product.Revision = "220214141054"
|
||||
rt.Product.Revision = "220301191336"
|
||||
rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch)
|
||||
rt.Product.Edition = domain.CommunityEdition
|
||||
rt.Product.Title = "Community"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="{{appMeta.endpoint}}/public/logo?cb={{random-id}}"
|
||||
title="Documize" alt="Documize" class="img-fluid">
|
||||
title="Community" alt="Community" class="img-fluid">
|
||||
<div class="url">{{appMeta.title}} ({{appMeta.appHost}})</div>
|
||||
</div>
|
||||
<div class="login-form">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="{{appMeta.endpoint}}/public/logo?cb={{random-id}}"
|
||||
title="Documize" alt="Documize" class="img-fluid">
|
||||
title="Community" alt="Community" class="img-fluid">
|
||||
<div class="url">{{appMeta.title}} ({{appMeta.appHost}})</div>
|
||||
</div>
|
||||
{{user/password-reset reset=(action "reset")}}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{{/if}}
|
||||
{{#if session.isAdmin}}
|
||||
{{ui/ui-toolbar-icon icon=constants.Icon.Settings color=constants.Color.Green
|
||||
tooltip="Documize Community settings" linkTo="customize"}}
|
||||
linkTo="customize"}}
|
||||
{{/if}}
|
||||
{{/ui/ui-toolbar}}
|
||||
{{/if}}
|
||||
|
@ -27,20 +27,20 @@
|
|||
<div class="list">
|
||||
<div class="item {{if (eq selectedView "all") "selected"}}" {{action "onSelect" "all"}}>
|
||||
<i class={{concat "dicon " constants.Icon.All}} />
|
||||
<div class="name">All ({{model.spaces.length}})</div>
|
||||
<div class="name">{{localize 'all'}} ({{model.spaces.length}})</div>
|
||||
</div>
|
||||
<div class="item {{if (eq selectedView "public") "selected"}}" {{action "onSelect" "public"}}>
|
||||
<i class={{concat "dicon " constants.Icon.World}} />
|
||||
<div class="name">Public ({{publicSpaces.length}})</div>
|
||||
<div class="name">{{localize 'public'}} ({{publicSpaces.length}})</div>
|
||||
</div>
|
||||
{{#if session.authenticated}}
|
||||
<div class="item {{if (eq selectedView "protected") "selected"}}" {{action "onSelect" "protected"}}>
|
||||
<i class={{concat "dicon " constants.Icon.People}} />
|
||||
<div class="name">Protected ({{protectedSpaces.length}})</div>
|
||||
<div class="name">{{localize 'protected'}} ({{protectedSpaces.length}})</div>
|
||||
</div>
|
||||
<div class="item {{if (eq selectedView "personal") "selected"}}" {{action "onSelect" "personal"}}>
|
||||
<i class={{concat "dicon " constants.Icon.Person}} />
|
||||
<div class="name">Personal ({{personalSpaces.length}})</div>
|
||||
<div class="name">{{localize 'personal'}} ({{personalSpaces.length}})</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<Ui::UiSpacer @size="300" />
|
||||
|
||||
<div class="section">
|
||||
<div class="title">label</div>
|
||||
<div class="title">{{localize 'label'}}</div>
|
||||
{{#if labels}}
|
||||
<div class="list">
|
||||
{{#each labels as |label|}}
|
||||
|
@ -62,7 +62,7 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="empty">No labels</div>
|
||||
<div class="empty">{{localize 'no_labels'}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,7 +44,7 @@ export default Service.extend({
|
|||
updateAvailable: false,
|
||||
// empty theme uses default theme
|
||||
theme: '',
|
||||
locale: 'en-US',
|
||||
locale: '',
|
||||
|
||||
getBaseUrl(endpoint) {
|
||||
return [this.get('endpoint'), endpoint].join('/');
|
||||
|
|
|
@ -20,14 +20,28 @@ export default Service.extend({
|
|||
});
|
||||
},
|
||||
|
||||
localize(key) {
|
||||
localize(key, ...args) {
|
||||
console.log(this.session.locale);
|
||||
|
||||
let str = "";
|
||||
|
||||
switch(this.session.locale) {
|
||||
case "fr-FR":
|
||||
return "unsupported";
|
||||
str = "";
|
||||
break;
|
||||
default:
|
||||
return this.langs.enUS[key];
|
||||
}
|
||||
str = this.langs.enUS[key];
|
||||
}
|
||||
|
||||
if (str === "") {
|
||||
console.log("i18n miss", key);
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
str = str.replace(`{${i+1}}`, args[i]);
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="installer">
|
||||
<img src="/assets/img/setup/logo-purple.png" srcset="/assets/img/setup/logo-purple@2x.png" alt="Documize Community Setup" style="width: 250px; height: 76px;">
|
||||
<img src="/assets/img/setup/logo.png" srcset="/assets/img/setup/logo@2x.png" alt="Documize Community Setup" style="width: 250px; height: 76px;">
|
||||
<Ui::UiSpacer @size="300" />
|
||||
<h1 class="color-theme-700">Setup</h1>
|
||||
<p class="color-gray-800">
|
||||
|
@ -38,7 +38,7 @@
|
|||
<div class="form-group">
|
||||
<label for="activation-key">Activation Key</label>
|
||||
{{textarea id="activation-key" value=model.activationKey rows="5" class=(if hasKeyError "form-control is-invalid" "form-control")}}
|
||||
<small class="form-text text-muted">You can get it from <a href="https://www.documize.com/downloads" target="_blank">https://www.documize.com/downloads</a></small>
|
||||
<small class="form-text text-muted">You can get from <a href="https://www.documize.com/community" target="_blank">https://www.documize.com/community</a></small>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{ui/ui-button submit=true color=constants.Color.Green light=true label=buttonLabel onClick=(action "save")}}
|
||||
|
|
|
@ -45,4 +45,5 @@ type SiteMeta struct {
|
|||
Location string `json:"location"` // reserved for internal use
|
||||
Theme string `json:"theme"` // default side-wide theme, user overrideble
|
||||
Configured bool `json:"configured"` // is Documize instance configured
|
||||
Locale string `json:"locale"` // server default locale
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue