change message to Chinese

This commit is contained in:
Marco 2021-01-07 17:21:36 +08:00
parent d84a15bc47
commit 544480687a
3 changed files with 13 additions and 13 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
mi-scale/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -274,23 +274,23 @@ class ScanProcessor():
lib = Xiaomi_Scale_Body_Metrics.bodyMetrics(calcweight, height, age, sex, 0) lib = Xiaomi_Scale_Body_Metrics.bodyMetrics(calcweight, height, age, sex, 0)
message = '{' message = '{'
message += '"weight":' + "{:.2f}".format(weight) message += '"重量":' + "{:.2f}".format(weight)
message += ',"weight_unit":"' + str(unit) + '"' message += ',"重量单位":"' + str(unit) + '"'
message += ',"bmi":' + "{:.2f}".format(lib.getBMI()) message += ',"BMI身体质量指数":' + "{:.2f}".format(lib.getBMI())
message += ',"basal_metabolism":' + "{:.2f}".format(lib.getBMR()) message += ',"基本代谢":' + "{:.2f}".format(lib.getBMR())
message += ',"visceral_fat":' + "{:.2f}".format(lib.getVisceralFat()) message += ',"内脏脂肪":' + "{:.2f}".format(lib.getVisceralFat())
if hasImpedance: if hasImpedance:
lib = Xiaomi_Scale_Body_Metrics.bodyMetrics(calcweight, height, age, sex, int(miimpedance)) lib = Xiaomi_Scale_Body_Metrics.bodyMetrics(calcweight, height, age, sex, int(miimpedance))
bodyscale = ['Obese', 'Overweight', 'Thick-set', 'Lack-exerscise', 'Balanced', 'Balanced-muscular', 'Skinny', 'Balanced-skinny', 'Skinny-muscular'] bodyscale = ['Obese', 'Overweight', 'Thick-set', 'Lack-exerscise', 'Balanced', 'Balanced-muscular', 'Skinny', 'Balanced-skinny', 'Skinny-muscular']
message += ',"lean_body_mass":' + "{:.2f}".format(lib.getLBMCoefficient()) message += ',"去脂体重":' + "{:.2f}".format(lib.getLBMCoefficient())
message += ',"body_fat":' + "{:.2f}".format(lib.getFatPercentage()) message += ',"体脂":' + "{:.2f}".format(lib.getFatPercentage())
message += ',"water":' + "{:.2f}".format(lib.getWaterPercentage()) message += ',"水分":' + "{:.2f}".format(lib.getWaterPercentage())
message += ',"bone_mass":' + "{:.2f}".format(lib.getBoneMass()) message += ',"骨量":' + "{:.2f}".format(lib.getBoneMass())
message += ',"muscle_mass":' + "{:.2f}".format(lib.getMuscleMass()) message += ',"肌肉量":' + "{:.2f}".format(lib.getMuscleMass())
message += ',"protein":' + "{:.2f}".format(lib.getProteinPercentage()) message += ',"蛋白质":' + "{:.2f}".format(lib.getProteinPercentage())
message += ',"body_type":"' + str(bodyscale[lib.getBodyType()]) + '"' message += ',"身体类型":"' + str(bodyscale[lib.getBodyType()]) + '"'
message += ',"metabolic_age":' + "{:.0f}".format(lib.getMetabolicAge()) message += ',"代谢年龄":' + "{:.0f}".format(lib.getMetabolicAge())
message += ',"timestamp":"' + mitdatetime + '"' message += ',"timestamp":"' + mitdatetime + '"'
message += '}' message += '}'