Fix instances of double translation and guard translation calls using typescript (#11443)

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Michael Telatynski 2023-08-22 16:32:05 +01:00 committed by GitHub
parent d13b6e1b41
commit ac70f7ac9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
157 changed files with 554 additions and 780 deletions

View file

@ -17,7 +17,7 @@ limitations under the License.
import zxcvbn, { ZXCVBNFeedbackWarning } from "zxcvbn";
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { _t, _td } from "../languageHandler";
import { _t, _td, TranslationKey } from "../languageHandler";
import { MatrixClientPeg } from "../MatrixClientPeg";
const ZXCVBN_USER_INPUTS = ["riot", "matrix"];
@ -90,8 +90,9 @@ export function scorePassword(
}
for (let i = 0; i < zxcvbnResult.feedback.suggestions.length; ++i) {
// translate suggestions
zxcvbnResult.feedback.suggestions[i] = _t(zxcvbnResult.feedback.suggestions[i]);
// translate suggestions - we ensure we mark them as `_td` at the top of this file
// https://github.com/dropbox/zxcvbn/issues/284 will be a better approach when it lands
zxcvbnResult.feedback.suggestions[i] = _t(zxcvbnResult.feedback.suggestions[i] as TranslationKey);
}
// and warning, if any
if (zxcvbnResult.feedback.warning) {