def usb_code_for_current_locale
      @usb_code_for_current_locale ||=
          begin
            locale = I18n.locale
            if locale
              locale = locale.to_s.partition('.')[0]  # remove encoding
              result = HIDAPI::Language.get_by_code(locale)
              unless result
                locale = locale.partition('_')[0]     # chop off extra specification
                result = HIDAPI::Language.get_by_code(locale)
              end
              result ? result[:usb_code] : 0
            else
              0
            end
          end
    end
def usb_code_for_current_locale
      @usb_code_for_current_locale ||=
          begin
            locale = I18n.locale
            if locale
              locale = locale.to_s.partition('.')[0]  # remove encoding
              result = HIDAPI::Language.get_by_code(locale)
              unless result
                locale = locale.partition('_')[0]     # chop off extra specification
                result = HIDAPI::Language.get_by_code(locale)
              end
              result ? result[:usb_code] : 0
            else
              0
            end
          end
    end
Gets the USB code for the current locale.