aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRenaud Guezennec <renaud@rolisteam.org>2022-04-30 04:08:26 +0000
committerRenaud Guezennec <renaud@rolisteam.org>2022-04-30 04:08:26 +0000
commit80b6e82c9007470f3deb2775fb3205e510919903 (patch)
tree7a67533902ab4db7ab92b25f594f6c4c89cb2ed8
parentcdbb6104b1351471e6792cc96f82eae92539c5bf (diff)
downloadOneRoll-80b6e82c9007470f3deb2775fb3205e510919903.tar.gz
OneRoll-80b6e82c9007470f3deb2775fb3205e510919903.zip
Improve translations.
-rw-r--r--.gitignore4
-rw-r--r--Messages.sh30
-rw-r--r--src/bin/cli/main.cpp10
-rw-r--r--src/libparser/node/executionnode.h2
-rw-r--r--src/libparser/node/helpnode.cpp60
-rw-r--r--src/libparser/node/listsetrollnode.cpp2
6 files changed, 44 insertions, 64 deletions
diff --git a/.gitignore b/.gitignore
index 6574b7a..90d3141 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,7 @@ build*
*hangs*
*queue*
*fuzzer0*
+po/*
+*.po
+*.pot
+enpo/*
diff --git a/Messages.sh b/Messages.sh
new file mode 100644
index 0000000..8d7db24
--- /dev/null
+++ b/Messages.sh
@@ -0,0 +1,30 @@
+#! /bin/bash
+
+$EXTRACT_TR_STRINGS `find . -name \*.cpp -o -name \*.h` -o $podir/rolisteam-diceparser_qt.pot
+
+#previousText=""
+
+#cat HelpMe.md | { cat ; echo ; } | while read line;
+#do
+# if [ -z "$line" ];
+# then
+# if [ -n "$previousText" ];
+# then
+# echo "i18nd(\"HelpMe\", \"$previousText\");" >> rc.cpp
+# previousText=""
+# fi
+# else
+# if [ -n "$previousText" ];
+# then
+# previousText="$previousText\n$line"
+# else
+# previousText="$line"
+# fi
+# fi
+#done
+#if [ -n "$previousText" ];
+#then
+# echo "i18nd(\"HelpMe\", \"$previousText\");" >> rc.cpp
+#fi
+
+#$XGETTEXT rc.cpp -o $podir/rolisteam-diceparser_documentation.pot
diff --git a/src/bin/cli/main.cpp b/src/bin/cli/main.cpp
index 0420ac3..167def9 100644
--- a/src/bin/cli/main.cpp
+++ b/src/bin/cli/main.cpp
@@ -127,12 +127,12 @@ void displayMarkdown(QString json)
QString str("```Markdown\n");
if(!error.isEmpty())
{
- str.append(QStringLiteral("Error: %1\n").arg(error));
+ str.append(QObject::tr("Error: %1\n").arg(error));
}
else
{
if(!warning.isEmpty())
- str.append(QStringLiteral("Warning: %1\n").arg(warning));
+ str.append(QObject::tr("Warning: %1\n").arg(warning));
if(!comment.isEmpty())
{
@@ -145,7 +145,7 @@ void displayMarkdown(QString json)
}
else
{
- str.append(QStringLiteral("# %1\nDetails:[%3 (%2)]\n").arg(scalarText).arg(diceList).arg(cmd));
+ str.append(QObject::tr("# %1\nDetails:[%3 (%2)]\n").arg(scalarText).arg(diceList).arg(cmd));
}
}
str.append(QStringLiteral("```"));
@@ -277,10 +277,10 @@ void displayCommandResult(QString json, bool withColor, QString color)
QString str;
if(withColor)
- str= QString("Result: \e[0;%4;1m%1\e[0m - details:[%3 (%2)]")
+ str= QObject::tr("Result: \e[0;%4;1m%1\e[0m - details:[%3 (%2)]")
.arg(scalarText, diceList, cmd, DisplayToolBox::colorToIntCode(color));
else
- str= QString("Result: %1 - details:[%3 (%2)]").arg(scalarText, diceList, cmd);
+ str= QObject::tr("Result: %1 - details:[%3 (%2)]").arg(scalarText, diceList, cmd);
if(!resultStr.isEmpty() && resultStr != scalarText)
{
diff --git a/src/libparser/node/executionnode.h b/src/libparser/node/executionnode.h
index d1bdf66..55b741a 100644
--- a/src/libparser/node/executionnode.h
+++ b/src/libparser/node/executionnode.h
@@ -4,11 +4,13 @@
#include "result/result.h"
#include <diceparser/diceparserhelper.h>
+#include <QCoreApplication>
/**
* @brief The ExecutionNode class
*/
class ExecutionNode
{
+ Q_DECLARE_TR_FUNCTIONS(ExecutionNode)
public:
/**
* @brief ExecutionNode
diff --git a/src/libparser/node/helpnode.cpp b/src/libparser/node/helpnode.cpp
index 8ab48a9..9cac27e 100644
--- a/src/libparser/node/helpnode.cpp
+++ b/src/libparser/node/helpnode.cpp
@@ -19,7 +19,7 @@
***************************************************************************/
#include "helpnode.h"
-HelpNode::HelpNode() : m_path("https://github.com/Rolisteam/DiceParser/blob/master/HelpMe.md")
+HelpNode::HelpNode() : m_path("https://invent.kde.org/rolisteam/rolisteam-diceparser/-/blob/master/HelpMe.md")
{
m_result= new StringResult();
}
@@ -40,62 +40,6 @@ void HelpNode::run(ExecutionNode* previous)
"\n"
"Full documentation at: %1")
.arg(m_path));
- /*txtResult->setText(QObject::tr("Rolisteam Dice Parser:\n"
- "\n"
- "Example (with ! as prefix):\n"
- "!2d6\n"
- "!1d20\n"
- "\n"
- "Operator list:\n"
- "\n"
- "k : Keep : 2d10k1 => roll two 10-sided dice and keep the
- higher one (kl1 for smaller one)\n" "K : Keep And Explode : 2d10K1 => Equivalent of 2d10e10k1\n" "s :
- Sort : 8d10 => roll eight 10-sided dice and sort the result list\n" "c : Count :
- 8d10c[>7] => roll eight 10-sided dice and count how many dice are higher than 7\n" "r : Reroll :
- 8d6r1 => roll eight 6-sided dice and reroll dice once if its result is 1. (result of the reroll can be
- 1)\n" "e : Explode : 8d10e10 => roll eight 10-sided dice and while dice makes a 10 it is
- reroll. The result is added to those dice.\n" "a : Reroll and add : 8d6a1 => roll eight 6-sided dice
- and reroll dice once and the result is added at 1\n" "m : Merge : 1d20;1d10mk1 => roll one 20-side
- die and one 10-sided die and keep the higher die\n" "i : if : 1d100i[=100]{\"jackpot\"} => Roll
- one 100-side die and display \"jackpot\" if the die result is 100.\n" "f : filter : 4d10f[!=4] =>
- roll four 10-sided dice and ignore all dice with 4 as result"
- "; : Next instruction : 1d20;2d10;3d8 => roll one 20-sided die, two 10-sided
- dice and three 8-sided dice \n" "g : Group : 8d10g10 => count how many group of 10 it is
- possible to do (according to rule of 7th sea).\n"
- "# : Comment : 1d2 #flip coin=> display flip coin as comment of 1 or 2
- result.\n"
- "\n"
- "Validator:\n"
- "\n"
- "Supported conditions: >,<,=,>=,<=,!=\n"
- "Supported operators: % (modulo), &,^,| \n"
- "\n"
- " Examples:\n"
- "\n"
- "c[>7 & %2=0] : count how many dice are higher than 7 and even\n"
- "c[>7 | %2=0] : count how many dice are higher than 7 or even\n"
- "c[>7 ^ %2=0] : count how many dice are higher than 7 or even but not higher
- than 7 and even\n"
- "\n"
- "List:\n"
- "\n"
- "1L[green,blue] => pick value from the list (green or blue)\n"
- "2L[green,blue] => pick two values from the list (green,green | green,blue |
- blue,green | blue,blue)\n" "2Lu[green,blue] => pick two unique values from the list (green,blue |
- blue,green)\n"
- "\n"
- "Arithmetic\n"
- "\n"
- "8+8+8 => 24\n"
- "24-4 => 20\n"
- "(3+4)*2 => 14\n"
- "7/2 => 3.5\n"
- "2^4 => 16\n"
- "1d6+6 => roll one 6-sided die and add 6 to its result\n"
- "(2d4+2)d10 => roll two 4-sided dice, add 2 to the result[2;8] then roll from
- four to ten 10-sided dice\n"
- "\n"
- "Full documentation at: %1").arg(m_path));*/
m_result->setPrevious(nullptr);
}
else if(nullptr != previous)
@@ -114,7 +58,7 @@ QString HelpNode::toString(bool wl) const
{
if(wl)
{
- return QString("%1 [label=\"Rolisteam Dice Parser:\nFull documentation at: %2\"]").arg(m_id, m_path);
+ return QString("%1 [label=\"%3 : %2\"]").arg(m_id, m_path, tr("Rolisteam Dice Parser:\nFull documentation at"));
}
else
{
diff --git a/src/libparser/node/listsetrollnode.cpp b/src/libparser/node/listsetrollnode.cpp
index 2cee645..4ea5b18 100644
--- a/src/libparser/node/listsetrollnode.cpp
+++ b/src/libparser/node/listsetrollnode.cpp
@@ -68,7 +68,7 @@ void ListSetRollNode::run(ExecutionNode* previous)
if(diceCount > static_cast<quint64>(m_values.size()) && m_unique)
{
m_errors.insert(Dice::ERROR_CODE::TOO_MANY_DICE,
- QObject::tr("More unique values asked than possible values (L operator)"));
+ tr("More unique values asked than possible values (L operator)"));
}
else
{