From 0db29a0222e169dde68874c5889769c19b40ddbb Mon Sep 17 00:00:00 2001 From: Tali Herzka Date: Tue, 9 Jun 2015 10:37:22 -0700 Subject: [PATCH] add locale conditional... anyone have a windows machine to test this on? --- transcriptic.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/transcriptic.py b/transcriptic.py index ec3796f..f49f975 100644 --- a/transcriptic.py +++ b/transcriptic.py @@ -2,10 +2,16 @@ import json from os.path import expanduser import locale +import os import click import requests +if os.name == 'posix': + loc = 'en_US.UTF-8' +else: + loc = 'usa_usa' + class Config: def __init__(self, api_root, email, token, organization): @@ -147,7 +153,7 @@ def count(thing, things, num): result = response.json() count("instruction", "instructions", len(result['instructions'])) count("container", "containers", len(result['refs'])) - locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') + locale.setlocale(locale.LC_ALL, loc) click.echo(" %s" % locale.currency(float(result['total_cost']), grouping=True)) for w in result['warnings']: