/* jshint sub: true */

lang["en"] = {
    unknownMember: "Unknown member",
    unknownChannel: "Unknown channel",
    newMessage: "New message",
    message: "Message",
    netErrorShort: "Network",
    onlyVisible: "(only visible to you)",

    starred: "Starred",
    channels: "Channels",
    members: "Members",
    privateMessageRoom: "Direct messages",

    shareYourLocation: "Share your GPS location",

    ok: "Ok",
    dissmiss: "Cancel",

    formatDate: function(ts) {
        if (typeof(ts) !== "string")
            ts = parseFloat(ts);
        var today = new Date(),
            yesterday = new Date(),
            dateObj = new Date(ts);

        today.setHours(0, 0, 0, 0);
        yesterday.setTime(today.getTime());
        yesterday.setDate(yesterday.getDate() -1);

        if (dateObj.getTime() > today.getTime()) {
            // Today time
            return dateObj.toLocaleTimeString();
        }
        if (dateObj.getTime() > yesterday.getTime()) {
            return "yesterday, " +dateObj.toLocaleTimeString();
        }
        return dateObj.toLocaleString();
    },

    formatDay: function(ts) {
        var today = new Date(),
            yesterday = new Date(),
            dateObj = new Date(ts);

        today.setHours(0, 0, 0, 0);
        yesterday.setTime(today.getTime());
        yesterday.setDate(yesterday.getDate() -1);

        if (dateObj.getTime() > today.getTime()) {
            // Today time
            return "today";
        }
        if (dateObj.getTime() > yesterday.getTime()) {
            return "yesterday";
        }
        return dateObj.toLocaleDateString();
    },

    chanName: function(serviceName, chanName) {
        return serviceName +'/' +chanName;
    },

    dom: {
        "fileUploadCancel": "Cancel",
        "neterror": "Cannot connect to chat !",

        "ctxMenuSettings": "Settings",
        "ctxMenuLogout": "Logout",

        "settingTitle": "Settings",
        "setting-menu-services": "Services",
        "settings-services-title": "Services",
        "setting-menu-display": "Display",
        "settings-display-title": "Display",
        "setting-menu-privacy": "Privacy",
        "settings-privacy-title": "Privacy",
        "settingCommit": "Apply",

        "settings-serviceAddButton": "Add a service",
        "settings-serviceListEmpty": "You don't have any service yet. Please add a service to continue.",
        "settings-serviceAddConfirm": "Next",

        "settings-displayEmojiProviderLbl": "Emoji provider",
        "settings-displayDisplayAvatarLbl": "Display avatars",
        "settings-displayColorfulNamesLbl": "Colorful names",
        "settings-displayScrollAvatarsLbl": "Scroll avatars",

        "settings-displayAttachmentContentLbl": "Automaticcaly unwrap attachments ?",
        "settings-displayAttachmentContent-never": "Never",
        "settings-displayAttachmentContent-always": "Always",
        "settings-displayAttachmentContent-notimg": "If they don't contain image"
    }
};

lang["en"].pinCount = function(count) {
    if (count === 0)
        return "No pinned messages";
    return count + (count === 1 ? " pinned message" : " pinned messages");
};

lang["en"].userCount = function(count) {
    if (count === 0)
        return "No users in this room";
    return count + (count === 1 ? " user" : " users");
};

lang["en"].edited = function(ts) {
    return "(edited " +lang["en"].formatDate(ts) +")";
};

lang["en"].topicDetail = function(creator, ts) {
    return "by " +creator.getName() +" on " +lang["en"].formatDate(ts);
};

