gui: Use indexOf instead of startsWith for IE11 compatibility (ref #6940) (#8097)

Use indexOf instead of startsWith to make the now translatable theme
names appear correctly in IE11. This also prevents console log error
spam in the browser. The same problem was previously reported in #6940.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
tomasz1986 2022-01-06 12:46:15 +01:00 committed by GitHub
parent 083fa1803a
commit 0f93e76e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -2808,7 +2808,7 @@ angular.module('syncthing.core')
$scope.themeName = function (theme) {
var translation = $translate.instant("theme-name-" + theme);
if (translation.startsWith("theme-name-")) {
if (translation.indexOf("theme-name-") == 0) {
// Fall back to simple Title Casing on missing translation
translation = theme.toLowerCase().replace(/(?:^|\s)\S/g, function (a) {
return a.toUpperCase();