← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/stock-amounts into lp:widelands

 

Just 1 nit for the i18n

Diff comments:

> === modified file 'src/wui/waresdisplay.cc'
> --- src/wui/waresdisplay.cc	2018-07-08 13:53:45 +0000
> +++ src/wui/waresdisplay.cc	2018-09-10 09:50:43 +0000
> @@ -385,12 +385,31 @@
>  	remove_all_warelists();
>  }
>  
> +const char* unit_suffixes[] = {
> +	"",
> +	/** TRANSLATORS: This is a suffix for large numbers (5k = 5,000) */
> +	_("k"),
> +	/** TRANSLATORS: This is a suffix for large numbers (5M = 5,000,000) */
> +	_("M"),
> +	/** TRANSLATORS: This is a suffix for large numbers (5G = 5,000,000,000) */
> +	_("G")
> +};
> +static std::string get_amount_string(uint32_t amount) {
> +	uint8_t size = 0;
> +	while (amount >= (size ? 1000 : 10000)) {
> +		amount /= 1000;
> +		size++;
> +	}
> +	/** TRANSLATORS: the first placeholder is a number and the second one a size suffix, e.g. 50 k */
> +	return (boost::format(_("%1%%2%")) % amount % unit_suffixes[size]).str();

Please shift this code to the unit suffixes to make translators' lives easier. The hint should tell them to use the narrow format, 1 letter maximum, and to contact us if they need more letters.

> +}
> +
>  std::string WaresDisplay::info_for_ware(Widelands::DescriptionIndex ware) {
>  	int totalstock = 0;
>  	for (const Widelands::WareList* warelist : warelists_) {
>  		totalstock += warelist->stock(ware);
>  	}
> -	return boost::lexical_cast<std::string>(totalstock);
> +	return get_amount_string(totalstock);
>  }
>  
>  /*


-- 
https://code.launchpad.net/~widelands-dev/widelands/stock-amounts/+merge/354558
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/stock-amounts into lp:widelands.


References