MCPcopy Create free account
hub / github.com/audacity/audacity / UnQuoteMsgid

Method UnQuoteMsgid

libraries/lib-nyquist-effects/NyquistBase.cpp:1890–1934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1888}
1889
1890TranslatableString NyquistBase::UnQuoteMsgid(
1891 const wxString& s, bool allowParens, wxString* pExtraString)
1892{
1893 if (pExtraString)
1894 *pExtraString = wxString {};
1895
1896 int len = s.length();
1897 if (len >= 2 && s[0] == wxT('\"') && s[len - 1] == wxT('\"'))
1898 {
1899 auto unquoted = s.Mid(1, len - 2);
1900 // Sorry, no context strings, yet
1901 // (See also comments in NyquistEffectsModule::AutoRegisterPlugins)
1902 return TranslatableString { unquoted, {} };
1903 }
1904 else if (
1905 allowParens && len >= 2 && s[0] == wxT('(') && s[len - 1] == wxT(')'))
1906 {
1907 Tokenizer tzer;
1908 tzer.Tokenize(s, true, 1, 1);
1909 auto& tokens = tzer.tokens;
1910 if (tokens.size() > 1)
1911 {
1912 if (pExtraString && tokens[1][0] == '(')
1913 {
1914 // A choice with a distinct internal string form like
1915 // ("InternalString" (_ "Visible string"))
1916 // Recur to find the two strings
1917 *pExtraString = UnQuote(tokens[0], false);
1918 return UnQuoteMsgid(tokens[1]);
1919 }
1920 else
1921 {
1922 // Assume the first token was _ -- we don't check that
1923 // And the second is the string, which is internationalized
1924 // Sorry, no context strings, yet
1925 return UnQuoteMsgid(tokens[1], false);
1926 }
1927 }
1928 else
1929 return {};
1930 }
1931 else
1932 // If string was not quoted, assume no translation exists
1933 return Verbatim(s);
1934}
1935
1936wxString NyquistBase::UnQuote(
1937 const wxString& s, bool allowParens, wxString* pExtraString)

Callers

nothing calls this directly

Calls 4

VerbatimFunction · 0.85
TokenizeMethod · 0.80
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected