gui: Translate theme names in settings (#8006)
Add each subdirectory of the guiDir as a translation candidate string. The key is prefixed with "theme-name-" and the default English translation corresponds to the directory name turned to title case. Disable the automatic name mangling in the GUI JS code in favor of just looking up the translation.
This commit is contained in:
@@ -2822,9 +2822,14 @@ angular.module('syncthing.core')
|
||||
};
|
||||
|
||||
$scope.themeName = function (theme) {
|
||||
return theme.replace('-', ' ').replace(/(?:^|\s)\S/g, function (a) {
|
||||
return a.toUpperCase();
|
||||
});
|
||||
var translation = $translate.instant("theme-name-" + theme);
|
||||
if (translation.startsWith("theme-name-")) {
|
||||
// Fall back to simple Title Casing on missing translation
|
||||
translation = theme.toLowerCase().replace(/(?:^|\s)\S/g, function (a) {
|
||||
return a.toUpperCase();
|
||||
});
|
||||
}
|
||||
return translation;
|
||||
};
|
||||
|
||||
$scope.modalLoaded = function () {
|
||||
|
||||
Reference in New Issue
Block a user