1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00

i18n search strings

This commit is contained in:
McMatts 2022-03-08 11:35:59 -05:00
parent 6d735e8579
commit e0805d7131
4 changed files with 32 additions and 21 deletions

View file

@ -15,11 +15,11 @@ import Component from '@ember/component';
export default Component.extend({
localStorage: service('localStorage'),
i18n: service(),
resultPhrase: '',
searchQuery: computed('keywords', function() {
return encodeURIComponent(this.get('keywords'));
}),
// eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects
sortBy: {
name: true,
created: false,
@ -33,15 +33,15 @@ export default Component.extend({
let docs = this.get('results');
let duped = [];
let phrase = 'Nothing found';
let phrase = this.i18n.localize('nothing_found');
if (docs.length > 0) {
duped = _.uniqBy(docs, function(item) {
return item.get('documentId');
});
let references = docs.length === 1 ? "reference" : "references";
let docLabel = duped.length === 1 ? "document" : "documents";
let references = docs.length === 1 ? this.i18n.localize('reference') : this.i18n.localize('references');
let docLabel = duped.length === 1 ? this.i18n.localize('document') : this.i18n.localize('documents');
let i = docs.length;
let j = duped.length;
phrase = `${i} ${references} in ${j} ${docLabel}`;

View file

@ -1,9 +1,8 @@
<div class="view-search">
{{#if documents}}
<div class="text-right">
{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
{{#ui/ui-toolbar-icon icon=constants.Icon.Sort color=constants.Color.Gray tooltip="Sort"}}
{{#ui/ui-toolbar-icon icon=constants.Icon.Sort color=constants.Color.Gray tooltip=(localize 'sort')}}
{{#attach-popover class="ember-attacher-popper" hideOn="click" showOn="click" isShown=false placement="bottom-end" as |attacher|}}
<i class="dicon {{constants.Icon.Cross}} closer" {{action attacher.hide}} role="button" tabindex="0" title="Close" aria-label="Close" />
<div class="container">
@ -12,13 +11,13 @@
<div class="text-center">
<ul class="ui-option-picker ui-option-picker-horiz">
<li class="option {{if sortBy.name "selected"}}" {{action "onSetSort" "name"}} role="button" tabindex="0" aria-label="Sort by name">
<div class="text">Name</div>
<div class="text">{{localize 'sort_by_name'}}</div>
</li>
<li class="option {{if sortBy.created "selected"}}" {{action "onSetSort" "created"}} role="button" tabindex="0" aria-label="Sort by created">
<div class="text">Created date</div>
<div class="text">{{localize 'sort_by_created'}}</div>
</li>
<li class="option {{if sortBy.updated "selected"}}" {{action "onSetSort" "updated"}} role="button" tabindex="0" aria-label="Sort by revised">
<div class="text">Last updated</div>
<div class="text">{{localize 'sort_by_revised'}}</div>
</li>
</ul>
</div>
@ -28,10 +27,10 @@
<div class="text-center">
<ul class="ui-option-picker ui-option-picker-horiz">
<li class="option {{if sortBy.asc "selected"}}" {{action "onSetSort" "asc"}} role="button" tabindex="0" aria-label="Sort ascending">
<div class="text">Ascending</div>
<div class="text">{{localize 'sort_ascending'}}</div>
</li>
<li class="option {{if sortBy.desc "selected"}}" {{action "onSetSort" "desc"}} role="button" tabindex="0" aria-label="Sort descending">
<div class="text">Descending</div>
<div class="text">{{localize 'sort_descending'}}</div>
</li>
</ul>
</div>
@ -66,12 +65,11 @@
<div class="space">{{result.space}}</div>
<div class="snippet">{{result.excerpt}}</div>
{{#if result.template}}
<div class="template">Template</div>
<div class="template">{{localize 'template'}}</div>
{{/if}}
{{folder/document-tags documentTags=result.tags}}
{{/link-to}}
</li>
{{/each}}
</ul>
</div>

View file

@ -1,7 +1,7 @@
<div class="view-search">
<form onsubmit={{action "onSearch"}} class="form-inline" role="form">
<div class="form-group">
{{focus-input type="text" value=keywords class="form-control mr-3 search-box" placeholder="keywords, tags"}}
{{focus-input type="text" value=keywords class="form-control mr-3 search-box" placeholder=(localize 'search_hint')}}
</div>
<div class="form-group">
{{ui/ui-button color=constants.Color.Green light=true label=(localize 'search') onClick=(action "onSearch")}}
@ -11,6 +11,6 @@
{{search/search-results results=results keywords=keywords}}
{{else}}
<Ui::UiSpacer @size="300" />
<p class="color-red-700">Your search query is too short</p>
<p class="color-red-700">{{localize 'search_too_short'}}</p>
{{/if}}
</div>

View file

@ -24,7 +24,7 @@
"join": "Join",
"leave": "Leave",
"login": "Login",
"logout": "logout",
"logout": "Logout",
"authentication": "Authentication",
"move": "Move",
"moved": "Moved",
@ -45,6 +45,11 @@
"share": "Share",
"signin": "Sign In",
"sort": "Sort",
"sort_ascending": "Ascending",
"sort_descending": "Descending",
"sort_by_name": "Name",
"sort_by_created": "Created date",
"sort_by_revised": "Last updated",
"unassigned": "Unassigned",
"update": "Update",
"viewed": "Viewed",
@ -76,6 +81,7 @@
"filter": "Filter",
"all": "All",
"not_found": "Not found",
"nothing_found": "Nothing found",
"expand_collapse": "Expand/collapse",
"options": "Options",
"settings": "Settings",
@ -85,6 +91,8 @@
"profile": "Profile",
"go_top": "Go top",
"help": "Help",
"reference": "reference",
"references": "references",
"public": "Public",
"protected": "Protected",
@ -109,6 +117,9 @@
"reports": "Reports",
"bookmarks": "Bookmarks",
"content": "Content",
"template": "Template",
"document": "document",
"documents": "documents",
"space_new": "New Space",
"space_name": "Space name",
@ -145,6 +156,8 @@
"welcome": "Welcome to Documize",
"welcome_explain": "Let's set up your account and get you started",
"profile_explain": "Manage your profile and password",
"search_hint": "keywords, tags",
"search_too_short": "Your search query is too short",
"search_doc_name": "Document name",
"search_doc_content": "Document content",
"search_tag_name": "Tag name",