27#include <wx/filename.h>
48 if( str2.Contains(
"DarkAudacity" ))
51 if( !str2.Contains(
"Audacity" ))
54 str3.Replace(
"Audacity",
"DarkAudacity" );
55 str3.Replace(
" an DarkAudacity",
" a DarkAudacity" );
57 str3.Replace(
"Sync-Lock",
"Time-Lock" );
58 str3.Replace(
"Sync-&Lock",
"Time-&Lock" );
59 str3.Replace(
"Sync Lock",
"Time Lock" );
60 return wxTranslations::GetUntranslatedString(str3);
73 const wxString& str2 = wxGetTranslation( str1 );
81 struct lconv * localeInfo = localeconv();
83 mDecimalSeparator = wxString(wxSafeConvertMB2WX(localeInfo->decimal_point)).GetChar(0);
90 wxPathFormat
format = wxPATH_MAC;
91#elif defined(__WXGTK__)
92 wxPathFormat
format = wxPATH_UNIX;
93#elif defined(__WXMSW__)
94 wxPathFormat
format = wxPATH_WIN;
99 auto forbid = wxFileName::GetForbiddenChars(
format);
101 for (
auto cc: forbid) {
102#if defined(__WXGTK__)
103 if (cc == wxT(
'*') || cc == wxT(
'?')) {
107 exclude.push_back(wxString{ cc });
114 auto separators = wxString(
"\\/");
116 for(
auto cc: separators) {
117 if (forbid.Find(cc) == wxNOT_FOUND)
118 exclude.push_back(wxString{ cc });
124 wxSetlocale( LC_NUMERIC,
"C" );
137 wxString s = stringToConvert;
139 s.Replace(wxT(
","), wxT(
"."));
141 return s.ToCDouble(result);
152 int digitsAfterDecimalPoint )
155 numberToConvert, digitsAfterDecimalPoint);
163 int digitsAfterDecimalPoint )
168 if (digitsAfterDecimalPoint == -1)
170 result.Printf(wxT(
"%f"), numberToConvert);
174 result.Replace(wxT(
"."), decSep);
176 if (result.Find(decSep) != -1)
179 int pos = result.length() - 1;
181 (result.GetChar(pos) == wxT(
'0')) &&
182 (result.GetChar(pos - 1) != decSep))
187 result = result.Left(pos+1);
193 format.Printf(wxT(
"%%.%if"), digitsAfterDecimalPoint);
194 result.Printf(
format, numberToConvert);
198 result.Replace(wxT(
"."), decSep);
207 double dSize =
size.GetHi() * pow(2.0, 32);
208 dSize +=
size.GetLo();
218 sizeStr =
XO(
"Unable to determine");
223 else if (
size < 1024.0 * 1024.0) {
227 else if (
size < 1024.0 * 1024.0 * 1024.0) {
243 for(
const auto &item :
exclude)
245 if(
name.Contains(item))
247 name.Replace(item, sub);
257 name.Replace(wxT(
"/"), wxT(
":"));
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.