export default {
  methods: {
    getClientLocale() {
      if (navigator.language) {
        return navigator.languages[0];
      } else if (navigator.userLanguage) {
        return navigator.userLanguage; // IE < 11
      } else if (navigator.browserLanguage) {
        return navigator.userLanguage;
      } else if (navigator.systemLanguage) {
        return navigator.systemLanguage;
      }
    },

    toImperial(cm) {
      const realFeet = (cm * 0.3937) / 12;
      const feet = Math.floor(realFeet);
      const inches = Math.round((realFeet - feet) * 12);

      return `${feet}'${inches}"`;
    },

    toInch(cm) {
      return `${Math.round(cm / 2.45)} in`;
    },

    toLbs(kg) {
      const nearExact = kg / 0.45359237;
      const lbs = Math.floor(nearExact);

      return lbs;
    }
  }
};
