Repository: syncthing/syncthing
File: gui/default/syncthing/core/syncthingController.js (JavaScript)

Code before:

        $scope.isUnixAddress = function (address) {
            return address != null &&
                (address.indexOf('/') == 0 ||
                    address.indexOf('unix://') == 0 ||
                    address.indexOf('unixs://') == 0);
        };

        $scope.shareDeviceConfirmationModal = function (type) {
            var params = {
                type: type,
            };

            // Device name is used to indicate the "person" who shares their
            // device. If missing, fall back to short device ID instead, which
            // cannot be empty.
            var deviceID = $scope.currentDevice.deviceID;
            if ($scope.currentDevice.name) {
                var deviceName = $scope.currentDevice.name;
            } else {
                var deviceName = $scope.deviceShortID(deviceID);
            }

            // Title and footer can be reused between email, SMS, and possibly
            // other methods, hence we define them separately before the body.
            var title = $translate.instant("{%devicename%} has shared their Syncthing device ID!", {devicename: deviceName});
            var footer = $translate.instant("Learn more at {%url%}.", {url: "https://syncthing.net"});

            switch (type) {
                case "email":
                    params.heading = $translate.instant("Share by Email");
                    params.icon = "fa fa-envelope-o";
                    // Email message format requires using CRLF for line breaks.
                    // Ref: https://datatracker.ietf.org/doc/html/rfc5322
                    params.subject = title;
                    params.body = [
                        $translate.instant("You have been invited to connect with {%devicename%} using Syncthing!", {devicename: deviceName}),
                        $translate.instant("To accept the invitation, add a new device using the ID below."),
                        deviceID,
                        $translate.instant("Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it's transmitted over the internet."),
                        footer
                    ].join('\r\n\r\n');
                    break;
                case "sms":
                    params.heading = $translate.instant("Share by SMS");
                    params.icon = "fa fa-comments-o";
                    // SMS is limited to 160 characters (non-Unicode), so we keep
                    // it as short as possible, e.g. by stripping hyphens from
                    // device ID. The current minimum length is around 140 chars,
                    // but some room is required for longer sharing device names.
                    params.body = [

Review comment (suggestion):
The device name should be quoted to improve readability and avoid ambiguities.

Suggestion (note the quotes):
`Syncthing device ID for '{%devicename%}'`

I'd prefer seeing the common term "Syncthing" at the beginning of every such mail, instead of some user-supplied text.  And in my experience, email subjects are rarely full sentences (and need not be).

Code after:
        };

        $scope.docsURL = function (path) {
            var url = 'https://docs.syncthing.net';
            if (!path) {
                // Undefined or null should become a valid string.
                path = '';
            }
            var hash = path.indexOf('#');
            if (hash != -1) {
                url += '/' + path.slice(0, hash);
                url += '?version=' + $scope.versionBase();
                url += path.slice(hash);
            } else {
                url += '/' + path;
                url += '?version=' + $scope.versionBase();
            }
            return url;
        };

        $scope.inputTypeFor = function (key, value) {
            if (key.substr(0, 1) === '_') {
                return 'skip';
            }
            if (value === null) {
                return 'null';
            }
            if (typeof value === 'number') {
                return 'number';
            }
            if (typeof value === 'boolean') {
                return 'checkbox';
            }
            if (value instanceof Array) {
                return 'list';
            }
            if (typeof value === 'object') {
                return 'skip';
            }
            return 'text';
        };

        $scope.themeName = function (theme) {
            var translation = $translate.instant("theme-name-" + theme);
            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();
                });
            }
            return translation;