Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
fix bidi isolation mark wrapping in locale.translation
Browse files Browse the repository at this point in the history
address #4396 (comment)

Auditors: @aekeus

Test Plan:
1. go to ledger panel, save recovery keys
2. verify that opening the saved file in the browser does not show non-ascii characters
  • Loading branch information
diracdeltas committed Oct 11, 2016
1 parent ac27858 commit 4124965
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,19 @@ var ctx = null
var translations = {}
var lang = 'en-US'

// todo: FSI/PDI stripping can probably be replaced once
// https://github.com/l20n/l20n.js/commit/2fea50bf43c43a8e930a519a37f0f64f3626e885
// is released
const FSI = '\u2068'
const PDI = '\u2069'

// Return a translate token from cache or a placeholder
// indicating that no translation is available
exports.translation = function (token, replacements = {}) {
if (translations[token]) {
let returnVal = translations[token]
for (var key in replacements) {
returnVal = returnVal.replace(new RegExp('{{\\s*' + key + '\\s*}}'), replacements[key])
returnVal = returnVal.replace(new RegExp(FSI + '{{\\s*' + key + '\\s*}}' + PDI), replacements[key])
}
return returnVal
} else {
Expand Down

1 comment on commit 4124965

@aekeus
Copy link
Member

@aekeus aekeus commented on 4124965 Oct 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.