26#include <wx/filename.h>
47 if( str2.Contains(
"DarkAudacity" ))
50 if( !str2.Contains(
"Audacity" ))
53 str3.Replace(
"Audacity",
"DarkAudacity" );
54 str3.Replace(
" an DarkAudacity",
" a DarkAudacity" );
56 str3.Replace(
"Sync-Lock",
"Time-Lock" );
57 str3.Replace(
"Sync-&Lock",
"Time-&Lock" );
58 str3.Replace(
"Sync Lock",
"Time Lock" );
59 return wxTranslations::GetUntranslatedString(str3);
72 const wxString& str2 = wxGetTranslation( str1 );
80 struct lconv * localeInfo = localeconv();
82 mDecimalSeparator = wxString(wxSafeConvertMB2WX(localeInfo->decimal_point)).GetChar(0);
89 wxPathFormat
format = wxPATH_MAC;
90#elif defined(__WXGTK__)
91 wxPathFormat
format = wxPATH_UNIX;
92#elif defined(__WXMSW__)
93 wxPathFormat
format = wxPATH_WIN;
98 auto forbid = wxFileName::GetForbiddenChars(
format);
100 for (
auto cc: forbid) {
101#if defined(__WXGTK__)
102 if (cc ==
wxT(
'*') || cc ==
wxT(
'?')) {
106 exclude.push_back(wxString{ cc });
113 auto separators = wxString(
"\\/");
115 for(
auto cc: separators) {
116 if (forbid.Find(cc) == wxNOT_FOUND)
117 exclude.push_back(wxString{ cc });
123 wxSetlocale( LC_NUMERIC,
"C" );
136 wxString s = stringToConvert;
138 s.Replace(
wxT(
","),
wxT(
"."));
140 return s.ToCDouble(result);
151 int digitsAfterDecimalPoint )
154 numberToConvert, digitsAfterDecimalPoint);
162 int digitsAfterDecimalPoint )
167 if (digitsAfterDecimalPoint == -1)
169 result.Printf(
wxT(
"%f"), numberToConvert);
173 result.Replace(
wxT(
"."), decSep);
175 if (result.Find(decSep) != -1)
178 int pos = result.length() - 1;
180 (result.GetChar(pos) ==
wxT(
'0')) &&
181 (result.GetChar(pos - 1) != decSep))
186 result = result.Left(pos+1);
192 format.Printf(
wxT(
"%%.%if"), digitsAfterDecimalPoint);
193 result.Printf(
format, numberToConvert);
197 result.Replace(
wxT(
"."), decSep);
206 double dSize =
size.GetHi() * pow(2.0, 32);
207 dSize +=
size.GetLo();
217 sizeStr =
XO(
"Unable to determine");
222 else if (
size < 1024.0 * 1024.0) {
226 else if (
size < 1024.0 * 1024.0 * 1024.0) {
242 for(
const auto &item :
exclude)
244 if(
name.Contains(item))
246 name.Replace(item, sub);
const TranslatableString name
STRINGS_API const wxString & GetCustomTranslation(const wxString &str1)
STRINGS_API const wxString & GetCustomSubstitution(const wxString &str1)
static wxChar GetDecimalSeparator()
Get the decimal separator for the current locale.
static wxString ToDisplayString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, uses the user's locale's decimal separator.
static wxString ToString(double numberToConvert, int digitsAfterDecimalPoint=-1)
Convert a number to a string, always uses the dot as decimal separator.
static wxChar mDecimalSeparator
static TranslatableString FormatSize(wxLongLong size)
Convert a number to a string while formatting it in bytes, KB, MB, GB.
static void Init()
Initialize internationalisation support. Call this once at program start.
static bool SanitiseFilename(wxString &name, const wxString &sub)
Check a proposed file name string for illegal characters and remove them return true iff name is "vis...
static void SetCeeNumberFormat()
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
static wxArrayString exclude
Holds a msgid for the translation catalog; may also bind format arguments.