Skip to content

Commit

Permalink
Test tst_xlsx2ts up and running
Browse files Browse the repository at this point in the history
Added description for scripts compile-cli.sh in readme
Added description for scripts ts-to-xlsx.sh and xlsx-to-ts.sh in readme both for stack conversion of folder content
Removed .vscode stuff
  • Loading branch information
s-t-e-f-a-n committed Jul 9, 2024
1 parent 4f7b968 commit 5b6d395
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 112 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -383,3 +383,4 @@ $RECYCLE.BIN/
compile_commands.json

src/internal/version.hpp
.vscode/
17 changes: 0 additions & 17 deletions .vscode/c_cpp_properties.json

This file was deleted.

29 changes: 0 additions & 29 deletions .vscode/launch.json

This file was deleted.

7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

28 changes: 0 additions & 28 deletions .vscode/tasks.json

This file was deleted.

23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ the cli can be invoked with two command line switches.
```bash
qTsConverter --no-version --no-location ../../tests/files/scenario_multiline.ts ./lol.xlsx
```
To create an excel file for each ts file in a folder,
a bash script can be invoked.
```bash
./scripts/ts-to-xlsx.sh /path/to/ts-files ./build/src/
```
To create a ts file for each excel file in a folder,
a bash script can be invoked.
```bash
./scripts/xlsx-to-ts.sh /path/to/xlsx-files ./build/src/
```



## Build

Expand All @@ -53,6 +65,12 @@ cd build
cmake -DBUILD_CLI:BOOL=ON -DCMAKE_PREFIX_PATH=/home/guerra/Qt/5.15.2/gcc_64/ ..
cmake --build .
```
or alternatively use script
```bash
cd scripts
./compile-cli.sh
```


### Linux
Compile from source and install:
Expand Down Expand Up @@ -99,8 +117,9 @@ cmake --install build_win_release
```

##
Example of supported TS file:
Example of supported TS file and its features (for reference see https://doc.qt.io/qt-6/linguist-ts-file-format.html):

```xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de" sourcelanguage="en">
Expand All @@ -119,4 +138,4 @@ Example of supported TS file:
</message>
</context>
</TS>

```
25 changes: 0 additions & 25 deletions src/internal/TitleHeaders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,3 @@ struct TitleHeader {
static constexpr char TranslatorComment[] = "translatorcomment";
static constexpr char TranslationType[] = "TranslationType";
};


/*
EXAMPLE - Expanded
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de" sourcelanguage="en">
<context>
<name>context a</name>
<message id = "-1">
<location filename="../dir/file.ui" line="26"/>
<source>source example</source>
<comment>comment example</comment>
<extracomment>extra comment example</extracomment>
<translatorcomment>translator comment example</translatorcomment>
<translation>translation example</translation>
<translation type="unfinished"></translation>
<translation type="vanished">Beispiel1</translation>
<translation type="obsolete">Beispiel2</translation>
</message>
</context>
</TS>
*/
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ target_link_libraries(
target_link_libraries(
tst_xlsx2ts
PUBLIC internal
PRIVATE Qt5::Core Qt5::Gui Qt5::Xml
PRIVATE Qt5::Core Qt5::Gui Qt5::Quick Qt5::Widgets Qt5::Xml
PUBLIC qtcsv QtXlsxWriter)

add_definitions(-DFILESPATH=\"${CMAKE_CURRENT_SOURCE_DIR}/files\")
Expand Down
Binary file modified tests/files/scenario_multilocation.xlsx
Binary file not shown.
10 changes: 7 additions & 3 deletions tests/tst_xlsx2ts.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#include "ConverterFactory.hpp"
#include "util.hpp"

#include <QApplication>

auto main() -> int
{
bool ret = false;

QApplication::setApplicationVersion("5.0.0");

ret |= !test_conversion("scenario_after_version_4_5_0.xlsx", "scenario_simple.ts",
ConverterFactory::ConversionType::Xlsx2Ts);

/* ret |= !test_conversion("scenario_multilocation.xlsx",
ret |= !test_conversion("scenario_multilocation.xlsx",
"scenario_multilocation.ts",
ConverterFactory::ConversionType::Xlsx2Ts);
*/

return static_cast<int>(ret);
}

0 comments on commit 5b6d395

Please sign in to comment.