Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
f4d44034
Commit
f4d44034
authored
Jan 26, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup code for copying placeable
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
8bf43787
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
21 deletions
+22
-21
docs/user/translating.rst
docs/user/translating.rst
+2
-0
weblate/static/loader-bootstrap.js
weblate/static/loader-bootstrap.js
+19
-20
weblate/trans/templatetags/translations.py
weblate/trans/templatetags/translations.py
+1
-1
No files found.
docs/user/translating.rst
View file @
f4d44034
...
...
@@ -92,6 +92,8 @@ While translating you can use following keyboard shortcuts:
Focus comment editor.
:kbd:`Alt+M`
Shows machine translation tab.
:kbd:`Alt+<NUMBER>`
Copies placeable of given number from source string.
:kbd:`Alt+M <NUMBER>`
Copy machine translation of given number to current translation.
:kbd:`Alt+I <NUMBER>`
...
...
weblate/static/loader-bootstrap.js
View file @
f4d44034
...
...
@@ -654,38 +654,37 @@ $(function () {
/* Copy from source text highlight check */
$
(
'
.hlcheck
'
).
click
(
function
(
e
)
{
var
text
=
$
(
this
).
clone
();
text
.
find
(
"
.
nchk
"
).
remove
();
text
.
find
(
"
.
highlight-number
"
).
remove
();
text
=
text
.
text
();
$
(
'
.translation-editor
'
).
insertAtCaret
(
$
.
trim
(
text
)).
trigger
(
'
autosize.resize
'
);;
e
.
preventDefault
();
});
/* and shortcuts */
var
possibleShortcuts
=
[
'
a
'
,
'
b
'
,
'
d
'
,
'
g
'
,
'
i
'
,
'
j
'
,
'
k
'
,
'
l
'
,
'
o
'
,
'
p
'
,
'
q
'
,
'
t
'
,
'
u
'
,
'
w
'
,
'
x
'
,
'
y
'
];
for
(
var
icheck
=
0
;
icheck
<
possibleShortcuts
.
length
;
icheck
++
){
Mousetrap
.
bindGlobal
(
"
alt+
"
+
possibleShortcuts
[
icheck
],
function
(
e
)
{
});
for
(
var
i
=
1
;
i
<
10
;
i
++
)
{
Mousetrap
.
bindGlobal
(
"
alt+
"
+
i
,
function
(
e
)
{});
}
if
(
$
(
"
.hlcheck
"
).
length
>
0
)
{
$
(
'
.hlcheck
'
).
each
(
function
(
idx
){
var
$this
=
$
(
this
);
if
(
idx
<
possibleShortcuts
.
length
)
{
if
(
$this
.
find
(
"
.nchk
"
).
length
>
0
)
{
$this
.
find
(
"
.nchk
"
).
html
(
"
<sup title='ALT+
"
+
possibleShortcuts
[
idx
]
+
"
'>
"
+
possibleShortcuts
[
idx
]
+
"
</sup>
"
);
}
else
{
$this
.
prepend
(
"
<span class='nchk text-info' ><sup title='ALT+
"
+
possibleShortcuts
[
idx
]
+
"
'>
"
+
possibleShortcuts
[
idx
]
+
"
</sup>
</span>
"
);
}
if
(
idx
<
10
)
{
var
key
=
getNumericKey
(
idx
);
$
(
this
).
find
(
'
.highlight-number
'
).
html
(
"
<span class='badge kbd-badge' title='
"
+
interpolate
(
gettext
(
'
Alt+%s
'
),
[
key
])
+
"
'>
"
+
key
+
"
</span>
"
);
Mousetrap
.
bindGlobal
(
"
alt+
"
+
possibleShortcuts
[
idx
],
function
(
e
)
{
$this
.
click
();
return
false
;
}
"
alt+
"
+
key
,
function
(
e
)
{
$this
.
click
();
return
false
;
}
);
}
else
{
if
(
$this
.
find
(
"
.nchk
"
))
{
$this
.
find
(
"
.nchk
"
).
html
(
""
);
}
$this
.
find
(
"
.highlight-number
"
).
html
(
""
);
}
});
}
...
...
weblate/trans/templatetags/translations.py
View file @
f4d44034
...
...
@@ -128,7 +128,7 @@ def format_translation(value, language, diff=None, search_match=None,
htext
=
escape
(
force_text
(
highlight
[
2
]))
find_highlight
=
value
.
find
(
htext
,
start_search
)
if
find_highlight
>=
0
:
newpart
=
u'<span class="hlcheck">{0}</span>'
.
format
(
htext
)
newpart
=
u'<span class="hlcheck">{0}<
span class="highlight-number"></span><
/span>'
.
format
(
htext
)
next_part
=
value
[(
find_highlight
+
len
(
htext
)):]
value
=
value
[:
find_highlight
]
+
newpart
+
next_part
start_search
=
find_highlight
+
len
(
newpart
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment