-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from brylie/add-i18n
Add translation support and update language strings
- Loading branch information
Showing
9 changed files
with
64 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
{% load i18n %} | ||
|
||
{% if suggestions %} | ||
<div class="suggestions"> | ||
<strong>Suggested responses:</strong><br> | ||
<strong>{% translate "Suggested responses:" %}</strong><br> | ||
{% for suggestion in suggestions %} | ||
<span class="suggestion">{{ suggestion.text }}</span> | ||
<button class="btn btn-default suggestion" tabindex="{{ forloop.counter }}"> | ||
{{ suggestion.text }} | ||
</button> | ||
{% endfor %} | ||
</div> | ||
<script> | ||
const userMessageInput = document.getElementById('user-message-input'); | ||
const suggestions = document.querySelectorAll('.suggestion'); | ||
suggestions.forEach(suggestion => { | ||
suggestion.addEventListener('click', function() { | ||
userMessageInput.value = suggestion.textContent; | ||
userMessageInput.focus(); | ||
/* We use an IIFE here to avoid redefining variables in the global scope */ | ||
(function() { | ||
const userMessageInput = document.getElementById('user-message-input'); | ||
const suggestions = document.querySelectorAll('.suggestion'); | ||
suggestions.forEach(suggestion => { | ||
suggestion.addEventListener('click', function() { | ||
if (userMessageInput) { | ||
userMessageInput.value = this.textContent; | ||
userMessageInput.focus(); | ||
} | ||
}); | ||
}); | ||
}); | ||
console.log('suggestions loaded'); | ||
})(); | ||
</script> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters