summaryrefslogtreecommitdiff
path: root/zen
diff options
context:
space:
mode:
Diffstat (limited to 'zen')
-rw-r--r--zen/i18n.h13
-rw-r--r--zen/process_exec.cpp2
-rw-r--r--zen/zstring.h13
3 files changed, 20 insertions, 8 deletions
diff --git a/zen/i18n.h b/zen/i18n.h
index e858913a..28b8c087 100644
--- a/zen/i18n.h
+++ b/zen/i18n.h
@@ -35,6 +35,8 @@ struct TranslationHandler
virtual std::wstring translate(const std::wstring& text) const = 0; //simple translation
virtual std::wstring translate(const std::wstring& singular, const std::wstring& plural, int64_t n) const = 0;
+ virtual bool layoutIsRtl() const = 0; //right-to-left? e.g. Hebrew, Arabic
+
private:
TranslationHandler (const TranslationHandler&) = delete;
TranslationHandler& operator=(const TranslationHandler&) = delete;
@@ -50,8 +52,6 @@ std::shared_ptr<const TranslationHandler> getTranslator();
-
-
//######################## implementation ##############################
namespace impl
{
@@ -101,6 +101,15 @@ std::wstring translate(const std::wstring& singular, const std::wstring& plural,
//fallback:
return replaceCpy(std::abs(n64) == 1 ? singular : plural, L"%x", formatNumber(n));
}
+
+
+inline
+bool languageLayoutIsRtl()
+{
+ if (std::shared_ptr<const TranslationHandler> t = getTranslator())
+ return t->layoutIsRtl();
+ return false;
+}
}
#endif //I18_N_H_3843489325044253425456
diff --git a/zen/process_exec.cpp b/zen/process_exec.cpp
index 89df9f8b..46c04eb5 100644
--- a/zen/process_exec.cpp
+++ b/zen/process_exec.cpp
@@ -69,7 +69,7 @@ std::pair<int /*exit code*/, std::string> processExecuteImpl(const Zstring& file
const int fdTempFile = ::open(tempFilePath.c_str(), O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC,
S_IRUSR | S_IWUSR); //0600
if (fdTempFile == -1)
- THROW_LAST_SYS_ERROR("open");
+ THROW_LAST_SYS_ERROR("open(" + utfTo<std::string>(tempFilePath) + ")");
auto guardTmpFile = makeGuard<ScopeGuardRunMode::onExit>([&] { ::close(fdTempFile); });
//"deleting while handle is open" == FILE_FLAG_DELETE_ON_CLOSE
diff --git a/zen/zstring.h b/zen/zstring.h
index bf7ac526..00b1c86e 100644
--- a/zen/zstring.h
+++ b/zen/zstring.h
@@ -79,11 +79,11 @@ struct LessNaturalSort { bool operator()(const Zstring& lhs, const Zstring& rhs)
//------------------------------------------------------------------------------------------
//common Unicode characters
-const wchar_t EN_DASH = L'\u2013';
-const wchar_t EM_DASH = L'\u2014';
+const wchar_t EN_DASH = L'\u2013'; //–
+const wchar_t EM_DASH = L'\u2014'; //—
const wchar_t* const SPACED_DASH = L" \u2014 "; //using 'EM DASH'
-const wchar_t* const ELLIPSIS = L"\u2026"; //"..."
-const wchar_t MULT_SIGN = L'\u00D7'; //fancy "x"
+const wchar_t* const ELLIPSIS = L"\u2026"; //…
+const wchar_t MULT_SIGN = L'\u00D7'; //×
const wchar_t NOBREAK_SPACE = L'\u00A0';
const wchar_t ZERO_WIDTH_SPACE = L'\u200B';
@@ -96,7 +96,10 @@ const wchar_t RTL_MARK = L'\u200F'; //UTF-8: E2 80 8F https://www.w3.org/Interna
//const wchar_t BIDI_DIR_EMBEDDING_RTL = L'\u202B'; //=> not working on Win 10
//const wchar_t BIDI_POP_DIR_FORMATTING = L'\u202C'; //=> not working on Win 10
-const wchar_t RIGHT_ARROW_CURV_DOWN = L'\u2935'; //Right Arrow Curving Down
+const wchar_t RIGHT_ARROW_CURV_DOWN = L'\u2935'; //Right Arrow Curving Down: ⤵
+//Windows bug: rendered differently depending on presence of e.g. LTR_MARK!
+//there is no "Left Arrow Curving Down" => WTF => better than nothing:
+const wchar_t LEFT_ARROW_ANTICLOCK = L'\u2B8F'; //Anticlockwise Triangle-Headed Top U-Shaped Arrow: ⮏
const wchar_t* const TAB_SPACE = L" "; //4: the only sensible space count for tabs
bgstack15