Ejemplo n.º 1
0
static int open_by_filename(const char *filename, const char *fmt, struct memblock *mem)
{
	// hack to be able to provide a comment for the translated string
	static char *csv_warning = QT_TRANSLATE_NOOP3("gettextFromC",
						      "Cannot open CSV file %s; please use Import log file dialog",
						      "'Import log file' should be the same text as corresponding label in Import menu");

	/* Suunto Dive Manager files: SDE, ZIP; divelogs.de files: DLD */
	if (!strcasecmp(fmt, "SDE") || !strcasecmp(fmt, "ZIP") || !strcasecmp(fmt, "DLD"))
		return try_to_open_zip(filename, mem);

	/* CSV files */
	if (!strcasecmp(fmt, "CSV"))
		return report_error(translate("gettextFromC", csv_warning), filename);
	/* Truly nasty intentionally obfuscated Cochran Anal software */
	if (!strcasecmp(fmt, "CAN"))
		return try_to_open_cochran(filename, mem);
	/* Cochran export comma-separated-value files */
	if (!strcasecmp(fmt, "DPT"))
		return try_to_open_csv(filename, mem, CSV_DEPTH);
	if (!strcasecmp(fmt, "LVD"))
		return try_to_open_liquivision(filename, mem);
	if (!strcasecmp(fmt, "TMP"))
		return try_to_open_csv(filename, mem, CSV_TEMP);
	if (!strcasecmp(fmt, "HP1"))
		return try_to_open_csv(filename, mem, CSV_PRESSURE);

	return 0;
}
Ejemplo n.º 2
0
	QString ChatEventInfo::formatMchatMembersList(const bool activeVoice) const
	{
		assert(!MyAimid_.isEmpty());

		QString result;
		result.reserve(512);

		const auto &friendlyMembers = Mchat_.MembersFriendly_;

		if (friendlyMembers.isEmpty())
		{
			return result;
		}

		const auto you =
            activeVoice ?
                QT_TRANSLATE_NOOP3("chat_event", "You", "active_voice") :
                QT_TRANSLATE_NOOP3("chat_event", "you", "passive_voice");

		const auto format =
			[this, you](const QString &name) -> const QString&
			{
				return (isMyAimid(name) ? you : name);
			};


		const auto &first = friendlyMembers.first();

		result += format(first);

		if (friendlyMembers.size() == 1)
		{
			return result;
		}

		const auto middle = friendlyMembers.mid(1, friendlyMembers.size() - 2);
		for (const auto &member : middle)
		{
			result += ", ";
			result += format(member);
		}

		result += QT_TRANSLATE_NOOP("chat_event", " and ");
		result += format(friendlyMembers.last());

		return result;
	}
Ejemplo n.º 3
0
	QString ChatEventInfo::formatMchatLeaveText() const
	{
		assert(Type_ == chat_event_type::mchat_leave);
		assert(!Mchat_.MembersFriendly_.isEmpty());
		assert(!SenderFriendly_.isEmpty());

		QString result;
		result.reserve(512);

		result += formatMchatMembersList(true);

		if (hasMultipleMembers())
		{
			result += QT_TRANSLATE_NOOP3("chat_event", " left the chat", "many");
		}
		else
		{
			result += QT_TRANSLATE_NOOP3("chat_event", " left the chat", "one");
		}

		return result;
	}
Ejemplo n.º 4
0
#endif
#endif // DISABLE_GUI

#ifndef DISABLE_GUI
#include <QDesktopServices>
#include <QProcess>
#endif

#include "base/utils/string.h"
#include "base/unicodestrings.h"
#include "base/logger.h"
#include "misc.h"
#include "fs.h"

static struct { const char *source; const char *comment; } units[] = {
    QT_TRANSLATE_NOOP3("misc", "B", "bytes"),
    QT_TRANSLATE_NOOP3("misc", "KiB", "kibibytes (1024 bytes)"),
    QT_TRANSLATE_NOOP3("misc", "MiB", "mebibytes (1024 kibibytes)"),
    QT_TRANSLATE_NOOP3("misc", "GiB", "gibibytes (1024 mibibytes)"),
    QT_TRANSLATE_NOOP3("misc", "TiB", "tebibytes (1024 gibibytes)"),
    QT_TRANSLATE_NOOP3("misc", "PiB", "pebibytes (1024 tebibytes)"),
    QT_TRANSLATE_NOOP3("misc", "EiB", "exbibytes (1024 pebibytes)")
};

void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action)
{
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) && defined(QT_DBUS_LIB)
    // Use dbus to power off / suspend the system
    if (action != ShutdownDialogAction::Shutdown) {
        // Some recent systems use systemd's logind
        QDBusInterface login1Iface("org.freedesktop.login1", "/org/freedesktop/login1",
Ejemplo n.º 5
0
void dummy()
{
  // KLFPathChooser
  QT_TRANSLATE_NOOP("KLFPathChooser", "Browse");
  // KLFAboutDialogUI
  QT_TRANSLATE_NOOP("KLFAboutDialogUI",
     "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
     "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
     "p, li { white-space: pre-wrap; }\n"
     "</style></head><body style=\"\">\n"
     "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">About KLatexFormula</span></p>\n"
     "<p align=\"justify\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">KLatexFormula was written by Philippe Faist, currently (2010) studying physics in Switzerland. First released in 2006 written in KDE3 environment, the program has seen many improvements and restructuring since then, leading to the current version, written in Qt 4.</p>\n"
     "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Author</span></p>\n"
     "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Philippe Faist, [email protected]</p>\n"
     "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">KLatexFormula On the Web</span></p>\n"
     "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://klatexformula.sourceforge.net/\"><span style=\" text-decoration: underline; color:#0000bf;\">Home Page at http://klatexformula.sourceforge.net/</span></a></p>\n"
     "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://klatexformula.sourceforge.net/doc/\"><span style=\" text-decoration: underline; color:#0000bf;\">Documentation at http://klatexformula.sourceforge.net/doc/</span></a></p></body></html>");
  QT_TRANSLATE_NOOP("KLFAboutDialogUI", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style></head><body style=\"font-weight:400; font-style:normal;\">\n<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;\"><span style=\" font-size:large;\">About KLatexFormula</span></p>\n<p align=\"justify\" style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">KLatexFormula was written by Philippe Faist, currently (2009) studying physics in Switzerland. First released in 2006 written in KDE3 environment, the program has seen many improvements and restructuring since then, leading to the current Qt 4 version.</p>\n<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;\">Author</p>\n<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Philippe Faist, [email protected]</p>\n<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;\">KLatexFormula On the Web</p>\n<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://klatexformula.sourceforge.net/\"><span style=\" text-decoration: underline; color:#0000bf;\">http://klatexformula.sourceforge.net/</span></a></p></body></html>");

  // KLFLatexSymbols
  QT_TRANSLATE_NOOP("KLFLatexSymbols", "Warning: failed to open file `%1'!");
  QT_TRANSLATE_NOOP("KLFLatexSymbols", "Warning: KLFLatexSymbols: error reading cache file ! code=%1");
  QT_TRANSLATE_NOOP("KLFLatexSymbols", "Can't save cache to file `%1'!");
  QT_TRANSLATE_NOOP("KLFLatexSymbols", "Warning: KLFLatexSymbols: error finding and reading cache file!");
  // KLFLibraryListManager
  QT_TRANSLATE_NOOP("KLFLibraryListManager", "Are you sure you want to delete %1 selected item(s) from library?");
  // KLFMainWin
  QT_TRANSLATE_NOOP("KLFMainWin", "Can't install klatexformula.cls to temporary directory !");
  QT_TRANSLATE_NOOP("KLFMainWin", "History");
  QT_TRANSLATE_NOOP("KLFMainWin", "Archive");
  QT_TRANSLATE_NOOP("KLFMainWin", "Unable to open library file!");
  QT_TRANSLATE_NOOP("KLFMainWin", "Error: Library file is incorrect or corrupt!\n");
  QT_TRANSLATE_NOOP("KLFMainWin", "Load Library");
  QT_TRANSLATE_NOOP("KLFMainWin", "The library file found was created by a more recent version of KLatexFormula.\nThe process of library loading may fail.");
  QT_TRANSLATE_NOOP("KLFMainWin", "Unable to load your formula history list!");
  QT_TRANSLATE_NOOP("KLFMainWin", "Error: History file is incorrect or corrupt!\n");
  QT_TRANSLATE_NOOP("KLFMainWin", "Load History");
  QT_TRANSLATE_NOOP("KLFMainWin", "The history file found was created by a more recent version of KLatexFormula.\nThe process of history loading may fail.");
  QT_TRANSLATE_NOOP("KLFMainWin", "Error: Unable to write to library file `%1'!");
  QT_TRANSLATE_NOOP("KLFMainWin", "Failed open for ToolTip Temp Image!\n%1");
  QT_TRANSLATE_NOOP("KLFMainWin", "Failed write to ToolTip Temp Image file %1!");
  QT_TRANSLATE_NOOP("KLFMainWin", "Sorry, format `%1' is not available.");
  QT_TRANSLATE_NOOP("KLFMainWin", "Error: Can't write to file %1!");
  QT_TRANSLATE_NOOP("KLFMainWin", "Created with KLatexFormula version %1");
  QT_TRANSLATE_NOOP("KLFMainWin", "Default");
  QT_TRANSLATE_NOOP("KLFMainWin", "default");
  QT_TRANSLATE_NOOP("KLFMainWin", "Error: Unable to load your style list!");
  // KLFMainWinUI
  QT_TRANSLATE_NOOP3("KLFMainWinUI", "KLatexFormula", "window title");
  QT_TRANSLATE_NOOP3("KLFMainWinUI", "Evaluate LaTeX Expression [Shift-Enter]", "tooltip");
  QT_TRANSLATE_NOOP3("KLFMainWinUI", "Show Latex Symbols palette", "tooltip");
  QT_TRANSLATE_NOOP3("KLFMainWinUI", "Toggle shrinked/expanded mode", "tooltip");
  QT_TRANSLATE_NOOP3("KLFMainWinUI", "Show Library", "tooltip");
  QT_TRANSLATE_NOOP("KLFMainWinUI", "Ctrl+E, Ctrl+Space");
  QT_TRANSLATE_NOOP("KLFMainWinUI", "Click and keep mouse button pressed to drag your formula to an other application");
  QT_TRANSLATE_NOOP("KLFMainWinUI", "Copy formula to clipboard");
  QT_TRANSLATE_NOOP("KLFMainWinUI", "Latex && Image Settings");
  // KLFSettings
  QT_TRANSLATE_NOOP("KLFSettings", "Cancel");
  QT_TRANSLATE_NOOP("KLFSettings", "Apply");
  QT_TRANSLATE_NOOP("KLFSettings", "OK");
  QT_TRANSLATE_NOOP("KLFSettings", "Reset defaults");
  QT_TRANSLATE_NOOP3("KLFSettings", "English Default", "[[first item of language graphical choice box]]");
  QT_TRANSLATE_NOOP3("KLFSettings", "%1 (%2)", "[[%1=Language (%2=Country)]]");
  QT_TRANSLATE_NOOP3("KLFSettings", "%1", "[[%1=Language, no country is specified]]");
  QT_TRANSLATE_NOOP("KLFSettings", "Could not find `%1' executable !");
  QT_TRANSLATE_NOOP("KLFSettings", "Please check your installation and specify the path to `%1' executable manually if it is not installed in $PATH.");
  QT_TRANSLATE_NOOP("KLFSettings", "You need to restart KLatexFormula for your new language settings to take effect.");
  QT_TRANSLATE_NOOP("KLFSettings", "Main editor font sample - click to change");
  QT_TRANSLATE_NOOP("KLFSettings", "Preamble editor font sample - click to change");
  QT_TRANSLATE_NOOP("KLFSettings", "Preview Size");
  QT_TRANSLATE_NOOP("KLFSettings", "Maximum Size of Preview Tooltip on LaTeX formula display");
  QT_TRANSLATE_NOOP("KLFSettings", "System E&xecutables and paths");
  QT_TRANSLATE_NOOP("KLFSettings", "A&dvanced settings");
  QT_TRANSLATE_NOOP("KLFSettings", "I  ");
  QT_TRANSLATE_NOOP("KLFSettings", "No Plugins have been loaded. Please install and enable individual plugins before trying to configure them.");
  QT_TRANSLATE_NOOP("KLFSettings", "The Add-On File %1 will be removed from disk.");
  // QObject
  QObject::tr("Error");
  QObject::tr("Can't create local directory `%1' !");
  QObject::tr("Can't make local config directory `%1' !");
  QObject::tr("Cancel");
  QObject::tr("Warning: Ignoring --input when --latexinput is given.\n");
  QObject::tr("Error: Can't read standard input (!)\n");
  QObject::tr("Error: Can't read input file `%1'.\n");
  QObject::tr("Unable to open stderr for write! Error: %1\n");
  QObject::tr("Unable to write to file `%1'! Error: %2\n");
  QObject::tr("PDF format is not available!\n");
  QObject::tr("Unable to save image to file `%1' in format `%2'!\n");
  QObject::tr("Warning: Ignoring --input since --latexinput is given.\n");
  QObject::tr("Unable to start Latex program!", "KLFBackend");
  QObject::tr("Unable to save image to file `%1' in format `%2'!\n", "KLFBackend::saveOutputToFile");
  QObject::tr("<b>Style Name</b>: %1<br>");
  QObject::tr("<b>Math Mode</b>: %1<br><b>DPI Resolution</b>: %2<br><b>Foreground Color</b>: %3 <font color=\"%4\"><b>[SAMPLE]</b></font><br><b>Background is Transparent</b>: %5<br><b>Background Color</b>: %6 <font color=\"%7\"><b>[SAMPLE]</b></font><br><b>LaTeX Preamble:</b><br><pre>%8</pre>");
  QObject::tr("ERROR: Can't generate preview for symbol %1 : status %2 !\n	Error: %3\n");
  QObject::tr("YES"); QObject::tr("NO");
  QObject::tr("Damonize option can only be used in interactive mode!.");
  QT_TRANSLATE_NOOP3("QObject",
		     "\n"
		     "KLatexFormula by Philippe Faist\n"
		     "\n"
		     "Usage: klatexformula\n"
		     "           Opens klatexformula Graphical User Interface (GUI)\n"
		     "       klatexformula [OPTIONS]\n"
		     "           Performs actions required by [OPTIONS], and exits\n"
		     "       klatexformula --interactive|-I [OPTIONS]\n"
		     "           Opens the GUI and performs actions required by [OPTIONS]\n"
		     "       klatexformula filename1.klf [ filename2.klf ... ]\n"
		     "           Opens the GUI and imports the given .klf file(s) into the library.\n"
		     "\n"
		     "       If additional filename arguments are passed to the command line, they are\n"
		     "       interpreted as .klf files to load into the library in separate resources\n"
		     "       (only in interactive mode).\n"
		     "\n"
		     "OPTIONS may be one or many of:\n"
		     "  -I|--interactive\n"
		     "      Runs KLatexFormula in interactive mode with a full-featured graphical user\n"
		     "      interface. This option is on by default, except if --input or --latexinput\n"
		     "      is given.\n"
		     "  -i|--input <file|->\n"
		     "      Specifies a file to read latex input from.\n"
		     "  -l|--latexinput <expr>\n"
		     "      Specifies the LaTeX code of an equation to render.\n"
		     "  -o|--output <file|->\n"
		     "      Specifies to write the output image (obtained from equation given by --input\n"
		     "      or --latexinput) to <file> or standard output.\n"
		     "  -F|--format <format>\n"
		     "      Specifies the format the output should be written in. By default, the format\n"
		     "      is guessed from file name extention and defaults to PNG.\n"
		     "  -f|--fgcolor <'#xxxxxx'>\n"
		     "      Specifies a color (in web #RRGGBB hex format) to use for foreground color.\n"
		     "      Don't forget to escape the '#' to prevent the shell from interpreting it as\n"
		     "      a comment.\n"
		     "  -b|--bgcolor <-|'#xxxxxx'>\n"
		     "      Specifies a color (in web #RRGGBB hex format, or '-' for transparent) to\n"
		     "      use as background color (defaults to transparent)\n"
		     "  -X|--dpi <N>\n"
		     "      Use N dots per inch (DPI) when converting latex output to image. Defaults to\n"
		     "      1200 (high-resolution image).\n"
		     "  -m|--mathmode <expression containing '...'>\n"
		     "      Specifies which LaTeX math mode to use, if any. The argument to this option\n"
		     "      is any string containing \"...\", which will be replaced by the equation\n"
		     "      itself. Defaults to \"\\[ ... \\]\"\n"
		     "  -p|--preamble <LaTeX code>\n"
		     "      Any LaTeX code that will be inserted before \\begin{document}. Useful for\n"
		     "      including custom packages with \\usepackage{...}.\n"
		     "  -q|--quiet\n"
		     "      Disable console output of warnings and errors.\n"
		     "\n"
		     "  --lborderoffset <N>\n"
		     "  --tborderoffset <N>\n"
		     "  --rborderoffset <N>\n"
		     "  --bborderoffset <N>\n"
		     "      Include a margin of N postscript points on left, top, right, or bottom margin\n"
		     "      respectively.\n"
		     "  --tempdir </path/to/temp/dir>\n"
		     "      Specify the directory in which KLatexFormula will write temporary files.\n"
		     "      Defaults to a system-specific temporary directory like \"/tmp/\".\n"
		     "  --latex <latex executable>\n"
		     "  --dvips <dvips executable>\n"
		     "  --gs <gs executable>\n"
		     "  --epstopdf <epstopdf executable>\n"
		     "      Specifiy the executable for latex, dvips, gs or epstopdf. By default, they\n"
		     "      are searched for in $PATH and/or in common system directories.\n"
		     "\n"
		     "  -h|--help\n"
		     "      Display this help text and exit.\n"
		     "  -V|--version\n"
		     "      Display KLatexFormula version information and exit.\n"
		     "\n"
		     "  -Q|--qtoption <qt-option>\n"
		     "      Specify a Qt-Specific option. For example, to launch KLatexFormula in\n"
		     "      Plastique GUI style, use:\n"
		     "        klatexformula  --qtoption='-style=Plastique'\n"
		     "      Note that if <qt-option> begins with a '-', then it must be appended to the\n"
		     "      long '--qtoption=' syntax with the equal sign.\n"
		     "\n"
		     "\n"
		     "NOTES\n"
		     "  * When run in interactive mode, the newly evaluated equation is appended to\n"
		     "    KLatexFormula's history.\n"
		     "  * When not run in interactive mode, no X11 server is needed.\n"
		     "  * Additional translation files and/or data can be provided to klatexformula by specifying\n"
		     "    a list of Qt rcc files or directories containing such files to import in the KLF_RESOURCES\n"
		     "    environment variable. Separate the file names with ':' on unix/mac, or ';' on windows. The\n"
		     "    default paths can be included with an empty section ('::') or leading or trailing ':'.\n"
		     "  * Please report any bugs and malfunctions to the author.\n"
		     "\n"
		     "Have a lot of fun!\n"
		     "\n",
		   "Command-line help instructions") ;
  // SkinConfigWidget
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Custom ...");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Skin Name");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Please enter skin name:");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "[New Skin Name]");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Error");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Can't overwrite a built-in skin. Please choose another name.");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Overwrite skin?");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "You are about to overwrite skin %1. Are you sure?");
  QT_TRANSLATE_NOOP3("SkinConfigWidget", "Delete skin?", "[[confirmation messagebox title]]");
  QT_TRANSLATE_NOOP("SkinConfigWidget", "Are you sure you want to delete the skin named `%1' ?");

  QT_TRANSLATE_NOOP("KLFMainWin", "Click and keep mouse button pressed to drag your formula to an other application. Current export profile: %1");
  QT_TRANSLATE_NOOP("KLFSettings", "Change Langugage");
  
  QT_TRANSLATE_NOOP("SysTrayMainIconifyButtons", "Quit KLatexFormula [Ctrl+Q]");
  QT_TRANSLATE_NOOP3("KLFMainWin", "Quit KLatexFormula", "tooltip");
}
Ejemplo n.º 6
0
QString Loader::languageNameForCode(const QString &langCode) const
{
    QString currentDictionary = langCode,   // e.g. en_GB-ize-wo_accents
            isoCode,            // locale ISO name
            variantName,         // dictionary variant name e.g. w_accents
            localizedLang,       // localized language
            localizedCountry,    // localized country
            localizedVariant;
    QByteArray variantEnglish; // dictionary variant in English

    int minusPos,          // position of "-" char
        variantCount = 0;  // used to iterate over variantList

    struct variantListType {
        const char *variantShortName;
        const char *variantEnglishName;
    };

    /*
     * This redefines the QT_TRANSLATE_NOOP3 macro provided by Qt to indicate that
     * statically initialised text should be translated so that it expands to just
     * the string that should be translated, making it possible to use it in the
     * single string construct below.
     */
#undef QT_TRANSLATE_NOOP3
#define QT_TRANSLATE_NOOP3(a, b, c) b

    const variantListType variantList[] = {
        { "40",             QT_TRANSLATE_NOOP3("Sonnet::Loader", "40", "dictionary variant") }, // what does 40 mean?
        { "60",             QT_TRANSLATE_NOOP3("Sonnet::Loader", "60", "dictionary variant") }, // what does 60 mean?
        { "80",             QT_TRANSLATE_NOOP3("Sonnet::Loader", "80", "dictionary variant") }, // what does 80 mean?
        { "ise",            QT_TRANSLATE_NOOP3("Sonnet::Loader", "-ise suffixes", "dictionary variant") },
        { "ize",            QT_TRANSLATE_NOOP3("Sonnet::Loader", "-ize suffixes", "dictionary variant") },
        { "ise-w_accents",  QT_TRANSLATE_NOOP3("Sonnet::Loader", "-ise suffixes and with accents", "dictionary variant") },
        { "ise-wo_accents", QT_TRANSLATE_NOOP3("Sonnet::Loader", "-ise suffixes and without accents", "dictionary variant") },
        { "ize-w_accents",  QT_TRANSLATE_NOOP3("Sonnet::Loader", "-ize suffixes and with accents", "dictionary variant") },
        { "ize-wo_accents", QT_TRANSLATE_NOOP3("Sonnet::Loader", "-ize suffixes and without accents", "dictionary variant") },
        { "lrg",            QT_TRANSLATE_NOOP3("Sonnet::Loader", "large", "dictionary variant") },
        { "med",            QT_TRANSLATE_NOOP3("Sonnet::Loader", "medium", "dictionary variant") },
        { "sml",            QT_TRANSLATE_NOOP3("Sonnet::Loader", "small", "dictionary variant") },
        { "variant_0",      QT_TRANSLATE_NOOP3("Sonnet::Loader", "variant 0", "dictionary variant") },
        { "variant_1",      QT_TRANSLATE_NOOP3("Sonnet::Loader", "variant 1", "dictionary variant") },
        { "variant_2",      QT_TRANSLATE_NOOP3("Sonnet::Loader", "variant 2", "dictionary variant") },
        { "wo_accents",     QT_TRANSLATE_NOOP3("Sonnet::Loader", "without accents", "dictionary variant") },
        { "w_accents",      QT_TRANSLATE_NOOP3("Sonnet::Loader", "with accents", "dictionary variant") },
        { "ye",             QT_TRANSLATE_NOOP3("Sonnet::Loader", "with ye, modern russian", "dictionary variant") },
        { "yeyo",           QT_TRANSLATE_NOOP3("Sonnet::Loader", "with yeyo, modern and old russian", "dictionary variant") },
        { "yo",             QT_TRANSLATE_NOOP3("Sonnet::Loader", "with yo, old russian", "dictionary variant") },
        { "extended",       QT_TRANSLATE_NOOP3("Sonnet::Loader", "extended", "dictionary variant") },
        { 0, 0 }
    };

    minusPos = currentDictionary.indexOf(QLatin1Char('-'));
    if (minusPos != -1) {
        variantName = currentDictionary.right(currentDictionary.length() - minusPos - 1);
        while (variantList[variantCount].variantShortName != 0)
            if (QLatin1String(variantList[variantCount].variantShortName) == variantName) {
                break;
            } else {
                variantCount++;
            }
        if (variantList[variantCount].variantShortName != 0) {
            variantEnglish = variantList[variantCount].variantEnglishName;
        } else {
            variantEnglish = variantName.toLatin1();
        }

        localizedVariant = tr(variantEnglish.constData(), "dictionary variant");
        isoCode = currentDictionary.left(minusPos);
    } else {
        isoCode = currentDictionary;
    }

    QLocale locale(isoCode);
    localizedCountry = locale.nativeCountryName();
    localizedLang = locale.nativeLanguageName();

    if (localizedLang.isEmpty() && localizedCountry.isEmpty()) {
        return isoCode;    // We have nothing
    }

    if (!localizedCountry.isEmpty() && !localizedVariant.isEmpty()) { // We have both a country name and a variant
        return tr("%1 (%2) [%3]", "dictionary name; %1 = language name, %2 = country name and %3 = language variant name"
                 ).arg(localizedLang, localizedCountry, localizedVariant);
    } else if (!localizedCountry.isEmpty()) { // We have a country name
        return tr("%1 (%2)", "dictionary name; %1 = language name, %2 = country name"
                 ).arg(localizedLang, localizedCountry);
    } else { // We only have a language name
        return localizedLang;
    }
}
Ejemplo n.º 7
0
#include <QtCore/QLocale>
#include <QtCore/QTranslator>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets/QWidget> // needed for abort() below
#else
#include <QtGui/QWidget> // needed for abort() below
#endif

#include "ktikzapplication.h"

// add copyright notice to the *.ts files; this string is not used anywhere else
static struct { const char *source; const char *comment; } copyrightString = QT_TRANSLATE_NOOP3("__Copyright__",
	"The original English text is copyrighted by the authors of the source "
	"files where the strings come from. This file is distributed under the "
	"same license as the KtikZ package. The translations in this file are "
	"copyrighted as follows.",
	"Translators: don't translate this, but put in the \"translation\" "
	"a copyright notice of the form \"This file was translated by <NAME>. "
	"Copyright (C) <YEAR> <NAME>.\" in which you fill in the year(s) of "
	"translation and your name.");

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
static void debugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
	// qDebug() and qWarning() only show messages when in debug mode
	QByteArray localMsg = msg.toLocal8Bit();
	switch (type)
	{
		case QtDebugMsg:
		case QtWarningMsg:
#ifndef QT_NO_DEBUG
Ejemplo n.º 8
0
    QString getContactInfo(std::shared_ptr<Logic::contact_profile> _profile, const std::map<QString, QString>& _countries)
    {
        QString info;
        QTextStream result(&info);

        QString gender;
        if (_profile->get_gender() == ql1s("male"))
            gender = QT_TRANSLATE_NOOP("search_widget", "M");
        else if (_profile->get_gender() == ql1s("female"))
            gender = QT_TRANSLATE_NOOP("search_widget", "F");

        if (!gender.isEmpty())
            result << gender;

        if (_profile->get_birthdate() != 0)
        {
//            QDateTime birthdate = QDateTime::fromMSecsSinceEpoch((qint64) _profile->get_birthdate() * 1000, Qt::LocalTime);
            QDateTime birthdate = QDateTime::fromMSecsSinceEpoch((qint64)_profile->get_birthdate(), Qt::LocalTime);

            int age = Utils::calcAge(birthdate);

            if (age > 0)
            {
                if (!info.isEmpty())
                    result << ", ";

                result << age;

                result << " " << Utils::GetTranslator()->getNumberString(
                    age,
                    QT_TRANSLATE_NOOP3("search_widget", "year", "1"),
                    QT_TRANSLATE_NOOP3("search_widget", "years", "2"),
                    QT_TRANSLATE_NOOP3("search_widget", "years", "5"),
                    QT_TRANSLATE_NOOP3("search_widget", "years", "21"));
            }
        }

        auto getAddress = [_profile, &_countries]()->QString
        {
            if (!_profile->get_home_address().get_country().isEmpty())
            {
                auto iter_country = _countries.find(_profile->get_home_address().get_country().toLower());
                if (_countries.end() != iter_country)
                    return iter_country->second;

                return _profile->get_home_address().get_country();
            }

            if (!_profile->get_home_address().get_state().isEmpty())
                return _profile->get_home_address().get_state();

            if (!_profile->get_home_address().get_city().isEmpty())
                return _profile->get_home_address().get_city();

            return QString();
        };



        QString loc = getAddress();
        if (!loc.isEmpty())
        {
            if (!info.isEmpty())
                result << ", ";

            result << loc;
        }


        return info;
    }
Ejemplo n.º 9
0
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "KReportPageSize.h"
#include <QCoreApplication>
#include <QPrinterInfo>

struct KReportPageSizeInfo {
    const char *name;
    struct { const char *source; const char *comment; } description;
    QPageSize::PageSizeId pageSize;
};

static const KReportPageSizeInfo pageSizeInfo[] = {
    { "A3",	QT_TRANSLATE_NOOP3("KReportPageFormat", "A3", ""), QPageSize::A3},
    { "A4",	QT_TRANSLATE_NOOP3("KReportPageFormat", "A4", ""), QPageSize::A4},
    { "A5",	QT_TRANSLATE_NOOP3("KReportPageFormat", "A5", ""), QPageSize::A5},
    { "Letter",	QT_TRANSLATE_NOOP3("KReportPageFormat", "US Letter",
                                   "Usually don't translate literally, use \"US Letter\""),
                QPageSize::Letter},
    { "Legal", QT_TRANSLATE_NOOP3("KReportPageFormat", "US Legal",
                                  "Usually don't translate literally, use \"US Legal\""),
                QPageSize::Legal},
    { "Screen",	QT_TRANSLATE_NOOP3("KReportPageFormat", "Screen", ""), QPageSize::A4},
    { "", {"", ""}, QPageSize::LastPageSize}
};

QStringList KReportPageSize::pageFormatNames()
{
    QStringList lst;
Ejemplo n.º 10
0
namespace Alarmz {

const TranslationSourceWithComment Alarm::LocalizedFrequencyNoRepeat = QT_TRANSLATE_NOOP3("Alarmz::Alarm", "None", "Alarm frequency: none");
const TranslationSourceWithComment Alarm::LocalizedFrequencyDaily    = QT_TRANSLATE_NOOP3("Alarmz::Alarm", "Daily", "Alarm frequency: daily");
const TranslationSourceWithComment Alarm::LocalizedFrequencyWeekly   = QT_TRANSLATE_NOOP3("Alarmz::Alarm", "Weekly", "Alarm frequency: weekly");
const TranslationSourceWithComment Alarm::LocalizedFrequencyMonthly  = QT_TRANSLATE_NOOP3("Alarmz::Alarm", "Monthly", "Alarm frequency: monthly");
const TranslationSourceWithComment Alarm::LocalizedFrequencyYearly   = QT_TRANSLATE_NOOP3("Alarmz::Alarm", "Yearly", "Alarm frequency: yearly");
const char *Alarm::LocalizedDisplayMethodMsgBox_NoIcon      = QT_TRANSLATE_NOOP("Alarmz::Alarm", "Message box - no icon");
const char *Alarm::LocalizedDisplayMethodMsgBox_Critical    = QT_TRANSLATE_NOOP("Alarmz::Alarm", "Message box - error");
const char *Alarm::LocalizedDisplayMethodMsgBox_Question    = QT_TRANSLATE_NOOP("Alarmz::Alarm", "Message box - question");
const char *Alarm::LocalizedDisplayMethodMsgBox_Exclamation = QT_TRANSLATE_NOOP("Alarmz::Alarm", "Message box - warning");
const char *Alarm::LocalizedDisplayMethodMsgBox_Information = QT_TRANSLATE_NOOP("Alarmz::Alarm", "Message box - information");
const char *Alarm::LocalizedDisplayMethodToast              = QT_TRANSLATE_NOOP("Alarmz::Alarm", "Toast");

void Alarm::setMessage(const QString &message)
{
    if (this->_message != message) {
        this->_message = message;
        this->_dirty = true;
    }
}

void Alarm::setDateTime(const QDateTime &dateTime)
{
    if (this->_dateTime != dateTime) {
        this->_dateTime = dateTime;
        this->_dirty = true;
    }
}

void Alarm::setFrequency(AlarmFrequency frequency)
{
    if (this->_frequency != frequency) {
        this->_frequency = frequency;
        this->_dirty = true;
    }
}

void Alarm::setDisplayMethod(AlarmDisplayMethod displayMethod)
{
    if (this->_displayMethod != displayMethod) {
        this->_displayMethod = displayMethod;
        this->_dirty = true;
    }
}

QVariant Alarm::field(int field) const
{
    switch (field) {
    case 0:
        return this->_message;

    case 1:
        return this->_dateTime;

    case 2:
        switch (this->_frequency) {
        case NoRepeat: return tr(LocalizedFrequencyNoRepeat);
        case Daily: return tr(LocalizedFrequencyDaily);
        case Weekly: return tr(LocalizedFrequencyWeekly);
        case Monthly: return tr(LocalizedFrequencyMonthly);
        case Yearly: return tr(LocalizedFrequencyYearly);
        default: return QString();
        }

    case 3:
        switch (this->_displayMethod) {
        case MsgBox_NoIcon: return tr(LocalizedDisplayMethodMsgBox_NoIcon);
        case MsgBox_Critical: return tr(LocalizedDisplayMethodMsgBox_Critical);
        case MsgBox_Question: return tr(LocalizedDisplayMethodMsgBox_Question);
        case MsgBox_Exclamation: return tr(LocalizedDisplayMethodMsgBox_Exclamation);
        case MsgBox_Information: return tr(LocalizedDisplayMethodMsgBox_Information);
        case Toast: return tr(LocalizedDisplayMethodToast);
        default: return QString();
        }

    default:
        return QVariant();
    }
}

} // namespace Alarmz