89 Commits

Author SHA1 Message Date
Vitaly Zdanevich
5478f290a1 README.org: fzf example: preview window make bigger
Was 50%:50% and by UX we do not need the half of the screen for the dictionary name.
2025-10-07 23:44:02 +03:00
Evgeniy A. Dushistov
9c77e91006 fix: include stdio for popen 2025-08-17 14:29:03 +03:00
Evgeniy A. Dushistov
b74bc2478a chore: document integration with readline
fixes #27
2025-08-17 14:22:40 +03:00
Vitaly Zdanevich
58c48988f6 README.org: add fzf 2025-08-17 13:58:02 +03:00
NorwayFun
07cd873e9d po: Adding Georgian translation 2025-08-17 13:52:26 +03:00
Evgeniy A. Dushistov
4545473da9 refactor: use more clear way to concat strings 2025-08-17 13:51:53 +03:00
Evgeniy A. Dushistov
849f0ed1ac fix: memory leak instroduced in #110 2025-08-17 13:51:53 +03:00
Evgeniy A. Dushistov
d5e1eb4d93 test: use actions/checkout@v4 2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
3a4b76124c test: make sure cmake 3.10 works 2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
6eaebaaa2f test: use cmake from distributive 2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
e24722b8fc test: ubuntu 20.04 is missing, use 22.04 instead 2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
c57ef6e916 fix: use READLINE_(INCLUDE_DIR|LIBRARY) if WITH_READLINE==True 2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
24c08365c4 fix: set given invalid arguments for CACHE mode: missing type or docstring 2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
8f77ede167 chore: update requirement for cmake to 3.10, to make modern cmake happy
and fix build on latest Ubuntu (24.04)
2025-08-17 13:32:56 +03:00
Evgeniy A. Dushistov
3a8ab1d5c3 test: install missed libglib2.0-dev on CI machine 2025-08-17 13:32:56 +03:00
Norayr Chilingarian
5887505185 Fix build with GCC 14 and modern glib: const correctness and deprecated API
- Use 'const gchar*' for result of g_utf8_next_char() to satisfy GCC 14's stricter const rules
- Remove incorrect g_free() on non-allocated pointer from g_utf8_next_char()
- Replace deprecated g_pattern_match_string() with g_pattern_spec_match_string()
2025-08-17 12:48:04 +03:00
Xiao Pan
beebb0faa7 fix: read_history() multiple times will add repeat histories to history lists
Issue Description:

When sdcv found multiple items, whatever your choice is, sdcv will add
double the current history entries to history file. For example, if
current history is "a\nb", you search akjk and there's multiple results,
whatever you choose, even -1,  after this is done, the history file will
be rewritten to "a\nb\nakjk\na\nb", note here \n is newline character.
So if you have 500 lines of history, you search akjk and there's
multiple results, you choose -1, after done there's 1001 lines of
history.

How to reproduce:

You can download this dictionary file
https://github.com/skywind3000/ECDICT/releases/download/1.0.28/ecdict-stardict-28.zip
and put into your dictionary directory, on Arch, with AUR, you can
install from https://aur.archlinux.org/packages/stardict-ecdict. Then,
make sure you also add the dictionary name to ~/.config/sdcv_ordering if
you have one. Add some lines to your history file if you do not have.
Then search for "akjk" with sdcv, e,g, `sdcv akjk`, then it will prompt
you to choose, you can choose -1, then ctrl-d to exit. Expected result
is history file add akjk at the end. Actual result is history file now
contain original content + akjk + original content duplicate as I
described in the issue description.

Fix and reasons:

I'm a hobbyist and I'm not a professional, I haven't use C++ for years
so many of my writings is very likely wrong. After some trail and error,
I found that call read_history() multiple times will add repeat
histories to history lists. In the commit d2327e2, a new IReadLine
object is created (note name changes, also note I know this description
of a IReadLine object is wrong). Here's a permalink:
49c8094b53/src/libwrapper.cpp (L418).
The problem of this new IReadLine object `choice_readline` is it called
read_history() again from ./src/readline.cpp constructor, because
there's already a IReadLine object `io` constructed at ./src/sdcv.cpp.
When read_history() is called twice, there's a "history lists" read from
history file first then append from history file again, so when you
destruct IReadLine object with write_history() in ./src/readline.cpp,
the history file contain duplicate content after write. Here are
permalinks:
49c8094b53/src/readline.cpp (L88),
and
49c8094b53/src/readline.cpp (L94).

So my fix is to just to use `io` IReadLine object and not to create a
new `choice_readline` object.

Misc:

During my trial and errors process, I made an example code to show
read_history()'s weird behavior. I did not dig deeper, I just guess
maybe there's some kind of werid history list as mentioned in
https://tiswww.cwru.edu/php/chet/readline/history.html#History-List-Management.

Here's the example code a.c, note you need to include stdio.h,
readline/history.h, and readline/readline.h. I did not include them here
because commit message seems will make them comment.
```c
...
int main (void)
{
	rl_readline_name="learn_readline";
	using_history();
	read_history("/home/xyz/test/learn_readline/history.txt");
	write_history("/home/xyz/test/learn_readline/history2.txt");
	{
		rl_readline_name="learn_readline";
		using_history();
		read_history("/home/xyz/test/learn_readline/history.txt");
		write_history("/home/xyz/test/learn_readline/history3.txt");
	}
	write_history("/home/xyz/test/learn_readline/history4.txt");
	return 0;
}
```
Here's the content of history.txt:
```
a
b
```
After build and run, as you can guess, history2.txt is same as
history.txt. But history3.txt and history4.txt content are:
```
a
b
a
b
```

Signed-off-by: Xiao Pan <xyz@flylightning.xyz>
2024-08-15 13:08:33 +03:00
Evgeniy A. Dushistov
49c8094b53 version 0.5.5 2023-04-18 21:47:55 +03:00
Evgeniy A. Dushistov
4346e65bd3 fix CI build: ubuntu-18.04 not supported by github actions anymore 2023-04-18 21:44:18 +03:00
Evgeniy A. Dushistov
d144e0310c fix CI build 2023-01-16 16:44:09 +03:00
NiLuJe
6e36e7730c Warn on unknown dicts 2022-09-16 18:48:08 +03:00
NiLuJe
abe5e9e72f Check accesses to the bookname_to_ifo std::map
Avoid crashes when passing unknown dicts to the -u flag

Fix #87
2022-09-16 18:48:08 +03:00
NiLuJe
488ec68854 Use off_t for stuff mainly assigned to a stat.st_size value
Allows simplifying the mmap sanity checks in mapfile, and actually
ensuring they won't break when -D_FILE_OFFSET_BITS=64
2022-09-14 22:12:29 +03:00
Marcelino Alberdi Pereira
b698445ead Add a small summary of the project to the README 2022-09-07 17:51:13 +03:00
Evgeniy A. Dushistov
504e7807e6 add information about 0.5.4 into NEWS 2022-06-24 21:49:00 +03:00
Evgeniy A. Dushistov
6c80bf2d99 t_json: add data about new dictionary 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
8742575c33 fix bash syntax error 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
b294b76fb5 check file size before mapping on linux 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
823ec3d840 clang-format for mapfile 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
6ab8b51e6c version 0.5.4 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
881657b336 Revert "replace deprecated g_pattern_match_string function"
This reverts commit 452a4e07fb.
2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
911fc2f561 more robust parsing of ifo file
fixes #79 fixes #81
2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
f488f5350b stardict_lib.hpp: remove unused headers plus clang-format 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
e72220e748 use cmake to check if compiler supports c++11 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
b77c0e793a replace deprecated g_pattern_match_string function 2022-06-24 21:34:47 +03:00
Evgeniy A. Dushistov
ebaa6f2136 clang-format for stardict_lib.cpp 2022-06-24 21:34:47 +03:00
Aleksa Sarai
d054adb37c tests: add multiple results integration test
Make sure we return all of the relevant results, even in cases with
lots of results (larger than ENTR_PER_PAGE in the offset index) and
where you have a synyonym and headword present for the same word.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-11-14 22:38:26 +03:00
Aleksa Sarai
4a9b1dae3d stardict_lib: remove dead poGet{Current,Next,Pre}Word iterators
They aren't used at all by scdv, and thus aren't tested (meaning that
adaptions to the core lookup algorithms can be complicated because these
methods use them but aren't tested so there's no real way of knowing if
a change has broken the methods or not).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-11-14 22:38:26 +03:00
Aleksa Sarai
6d385221d0 lookup: return all matching entries found during lookup
Previously, we would just return the first entry we found that matched
the requested word. This causes issues with dictionaries that have lots
of entries which can be found using the same search string. In these
cases, the user got a completely arbitrary word returned to them rather
than the full set.

While this may seem strange, this is incredibly commonplace in Japanese
and likely several other languages. In Japanese:

 * When written using kanji, the same string of characters could refer
   to more than one word which may have a completely different meaning.
   Examples include 潜る (くぐる、もぐる) and 辛い (からい、つらい).

 * When written in kana, the same string of characters can also refer to
   more than one word which is written using completely different kanji,
   and has a completely different meaning. Examples include きく
   (聞く、効く、菊) and たつ (立つ、建つ、絶つ).

In both cases, these are different words in every sense of the word, and
have separate headwords for each in the dictionary. Thus in order to be
completely useful for such dictionaries, sdcv needs to be able to return
every matching word in the dictionary.

The solution is conceptually simple -- return a set containing the
indices rather than just a single index. Since every list we search is
sorted (to allow binary searching), once we find one match we can just
walk backwards and forwards from the match point to find the entire
block of matching terms and add them to the set in linear time. A
std::set is used so that we don't return duplicate results needlessly.

This solution was in practice a bit more complicated because .otf cache
files require a bit more fiddling, and also the ->lookup methods are
used by some callers to find the next entry if no entry was found. But
on the whole it's not too drastic of a change from the previous setup.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-11-14 22:38:26 +03:00
Evgeniy Dushistov
3d15ce3b07 Merge pull request #77 from cyphar/multi-word-lookups
lookup: do not bail on first failed lookup with a word list
2021-10-17 21:03:14 +03:00
Aleksa Sarai
51338ac5bb lookup: do not bail on first failed lookup with a word list
Due to the lack of deinflection support in StarDict, users might want to
be able to create a list of possible deinflections and search each one
to see if there is a dictionary entry for that deinflection.

Being able to do this in one sdcv invocation is far more preferable to
calling sdcv once for each candidate due to the performance cost of
doing so. The most obvious language that would benefit from this is
Japanese, but I'm sure other folks would prefer this.

In order to make this use-case better supported -- try to look up every
word in the provided list of words before existing with an error if any
one of the words failed to be looked up.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-09-29 03:28:44 +10:00
Evgeniy Dushistov
5ada75e08d Merge pull request #73 from 258204/json
Added --json (same as --json-output) to match man
2021-06-21 12:45:09 +03:00
258204
c7d9944f7d Added --json (same as --json-output) to match man 2021-06-19 19:19:31 -06:00
Evgeniy Dushistov
3963e358cd Merge pull request #68 from NiLuJe/glib-getopt
Handle "rest" arguments the glib way
2021-01-27 16:33:36 +03:00
NiLuJe
3b26731b02 Making glib thinks it's a filename instead of a string prevents the
initial UTF-8 conversion

At least on POSIX.

Windows is another kettle of fish. But then it was probably already
broken there.
2021-01-14 19:26:06 +01:00
NiLuJe
070a9fb0bd Oh, well, dirty hackery it is, then.
the previous approachonly works as long as locales are actually sane
(i.e., the test only passes if you *actually* have the ru_RU.KOI8-R
locale built, which the CI doesn't).
2021-01-12 04:37:07 +01:00
NiLuJe
8f096629ec Unbreak tests
glib already runs the argument through g_locale_to_utf8 with
G_OPTION_REMAINING
2021-01-12 04:16:03 +01:00
NiLuJe
25768c6b80 Handle "rest" arguments the glib way
Ensures the "stop parsing" token (--) is handled properly.
2021-01-12 03:35:55 +01:00
Evgeniy Dushistov
4ae4207349 Merge pull request #67 from doozan/master
Use binary search for synonyms, fixes #31
2020-12-23 04:30:13 +03:00
Jeff Doozan
994c1c7ae6 Use mapfile directly instead of buffer 2020-12-21 17:10:37 -05:00
Jeff Doozan
d38f8f13c9 Synonyms: Use MapFile 2020-12-21 08:53:29 -05:00
Jeff Doozan
cc7bcb8b73 Fix crash if dictionary has no synonyms 2020-12-19 18:37:15 -05:00
Jeff Doozan
8e9f72ae57 Synonyms lookup: return correct offset 2020-12-19 18:01:21 -05:00
Jeff Doozan
88af1a077c Use binary search for synonyms, fixes #31 2020-12-19 15:10:39 -05:00
Evgeniy Dushistov
b66799f358 Merge pull request #66 from Dushistov/fix-ci
fix ci: github changed API for path/env
2020-12-10 00:42:34 +03:00
Evgeniy A. Dushistov
be5c3a35bf fix ci: github changed API for path/env 2020-12-10 00:40:14 +03:00
Evgeniy A. Dushistov
e73388c726 release 0.5.3 2020-08-14 13:06:51 +03:00
Evgeniy A. Dushistov
7e8fee5e78 update translation and readme 2020-08-14 13:01:18 +03:00
Evgeniy Dushistov
bc890621a9 Merge pull request #64 from Dushistov/to-release
To release
2020-08-14 12:56:08 +03:00
Evgeniy A. Dushistov
0836551bb4 require cmake at least 3.5, and glib 2.36
this should be fine to support ubuntu 16.04 lts
2020-08-14 12:52:37 +03:00
Evgeniy A. Dushistov
824764ab50 handle possibly invalid data: origin_data == nullptr 2020-08-14 12:46:42 +03:00
Evgeniy A. Dushistov
431a5774ba fix warning 2020-08-14 12:37:21 +03:00
Evgeniy A. Dushistov
7facbe215e refactoring: run clang-format against code 2020-08-14 12:36:02 +03:00
Evgeniy Dushistov
79773d6af9 Merge pull request #63 from Dushistov/github-actions
migrate to github actions
2020-08-14 12:30:22 +03:00
Evgeniy A. Dushistov
373bd786d7 CI: remove travis and update link to README 2020-08-14 12:28:01 +03:00
Evgeniy Dushistov
cef6eb5447 Create main.yml 2020-08-14 12:22:10 +03:00
Evgeniy Dushistov
995bdc5bdb Merge pull request #61 from pavelbykov/patch-1
corrected word version
2020-07-04 22:45:27 +03:00
Pavel Bykov
581c2d2b5c corrected word version 2020-07-04 12:30:25 +02:00
Evgeniy Dushistov
958ec353ca Merge pull request #59 from guidocella/xdg
Comply with the XDG Base Directory Specification
2020-05-11 17:19:06 +03:00
Guido Cella
2fd47ba0d0 Keep searching in $HOME 2020-05-10 12:48:32 +02:00
Evgeniy Dushistov
357ca4d453 Merge pull request #60 from guidocella/typo
Typo
2020-05-10 11:40:29 +03:00
Guido Cella
3736ef0060 Typo 2020-05-10 07:19:34 +02:00
Guido Cella
3413d847c5 Comply with the XDG Base Directory Specification 2020-05-10 07:01:31 +02:00
Evgeniy A. Dushistov
780b7dd214 infra: add t_return_code to tests list 2020-03-17 17:13:25 +03:00
Evgeniy Dushistov
08461acab8 Merge pull request #57 from alcah/master
Return exit code 2 if search term not found
2020-03-17 17:09:42 +03:00
alcah
2d1a454026 add return code test 2020-03-17 23:43:16 +10:30
alcah
021e467b37 return exit code 2 if search term not found 2020-03-17 22:15:16 +10:30
Evgeniy Dushistov
a500176661 Merge pull request #44 from nickeb96/master
Added $SDCV_HISTFILE to set history file
2018-05-08 03:21:18 +03:00
nickeb96
7341675088 Moved history file path code to helper function 2018-05-07 20:08:47 -04:00
nickeb96
51f808d96c Updated man page 2018-05-07 18:02:42 -04:00
nickeb96
7719111c57 Added support for 2018-05-07 17:45:07 -04:00
Evgeniy Dushistov
51db56f7e5 Merge pull request #38 from nijel/master
Store integer magic in cache file
2017-11-14 18:52:06 +03:00
Michal Čihař
0f83f0aa0b Store integer magic in cache file
This allows to detect different endianity of machines to avoid
loading caches created with different endianity.

Fixes #36

Signed-off-by: Michal Čihař <michal@cihar.com>
2017-11-14 16:39:57 +01:00
Evgeniy Dushistov
a7432338ee Merge pull request #37 from nijel/test
Use single quotes around JSON data to reduce need for escaping
2017-11-09 18:39:34 +03:00
Michal Čihař
69fe19d269 Use single quotes around JSON data to reduce need for escaping
Also use unicode escape sequence for newline to avoid problems with some
shells decoding \n even when they probably should not.
2017-11-08 22:51:23 +01:00
Evgeniy Dushistov
b9a1fba5bb Merge pull request #35 from nijel/test
Pass parameters individually to the test
2017-11-09 00:32:26 +03:00
Michal Čihař
ac2acfdcd2 Pass parameters individually to the test
This way we can properly quote path.
2017-11-08 15:38:10 +01:00
Evgeniy Dushistov
925a4bc163 Merge pull request #34 from nijel/test
Fix test execution on Debian
2017-11-08 16:59:34 +03:00
Michal Čihař
4b6486c58e Fix test execution on Debian
The default /bin/sh is probably more picky than bash.

Fixes #33
2017-11-08 14:30:37 +01:00
45 changed files with 1082 additions and 759 deletions

View File

@@ -15,7 +15,7 @@ BreakBeforeBinaryOperators: true
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true BreakConstructorInitializersBeforeComma: true
BinPackParameters: true BinPackParameters: true
ColumnLimit: 0 ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: false
DerivePointerAlignment: false DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false

50
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '00 02 */4 * *'
env:
RUST_BACKTRACE: 1
jobs:
tests:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.10'
github-api-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check versions
run: |
set -e
cmake --version
gcc --version
echo "end of versions checking"
shell: bash
- uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libglib2.0-dev
version: 1.0
- name: Run tests
run: |
set -e
cd $GITHUB_WORKSPACE
mkdir build
cd build
cmake -DBUILD_TESTS=True ..
make -k -j2 VERBOSE=1
ctest --output-on-failure
shell: bash

View File

@@ -1,49 +0,0 @@
#
# Available repositories are listed here:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
#
sudo: false
language: cpp
matrix:
include:
- env: COMPILER_VERSION=4.8
os: linux
compiler: g++
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- kalakris-cmake
- ubuntu-sdk-team
packages:
- g++-4.8
- cmake
- libglib2.0-dev
- jq
# - env: COMPILER_VERSION=3.5
# os: linux
# compiler: clang++
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# - llvm-toolchain-precise-3.5
# packages:
# - clang-3.5
# - cmake
# - libglib2.0-dev
before_script:
- mkdir build
- cd build
- CC=$CC-${COMPILER_VERSION} CXX=$CXX-${COMPILER_VERSION} cmake -DBUILD_TESTS=True ..
- cd ..
script:
- cd build
- make -k -j2 VERBOSE=1
- ctest --output-on-failure

View File

@@ -1,24 +1,18 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
cmake_policy(VERSION 3.10)
project(sdcv) project(sdcv)
# Older versions have a different signature for CMAKE_MINIMUM_REQUIRED, set(CMAKE_CXX_STANDARD 11)
# check it manually just to make sure set(CMAKE_CXX_STANDARD_REQUIRED True)
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8) set(CMAKE_CXX_EXTENSIONS False)
message(FATAL_ERROR "${PROJECT_NAME} requires at least CMake v2.8."
" You are running v${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}."
" Please upgrade." )
endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8)
# If we get this far, use the modern signature. This will also cause newer
# CMake versions to try to be backwards-compatible with the desired version
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_policy(VERSION 2.8)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler.cmake")
set(ZLIB_FIND_REQUIRED True) set(ZLIB_FIND_REQUIRED True)
include(FindZLIB) include(FindZLIB)
set(GLIB2_REQ "'glib-2.0 >= 2.6.1'") set(GLIB2_REQ "'glib-2.0 >= 2.36'")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGLIB2.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGLIB2.cmake")
@@ -33,7 +27,8 @@ if (WITH_READLINE)
find_path(READLINE_INCLUDE_DIR readline/readline.h) find_path(READLINE_INCLUDE_DIR readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline) find_library(READLINE_LIBRARY NAMES readline)
if (NOT (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)) if (NOT (READLINE_INCLUDE_DIR AND READLINE_LIBRARY))
set(WITH_READLINE False CACHE FORCE) message(STATUS "readline library not FOUND, disable it's usage")
set(WITH_READLINE False CACHE BOOL "Use readline library" FORCE)
endif () endif ()
endif (WITH_READLINE) endif (WITH_READLINE)
@@ -88,10 +83,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
include_directories( include_directories(
${ZLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
${GLIB2_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}
${READLINE_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src/lib ${CMAKE_CURRENT_SOURCE_DIR}/src/lib
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
if (WITH_READLINE)
include_directories(${READLINE_INCLUDE_DIR})
endif()
# #
# Packing stuff # Packing stuff
@@ -101,7 +99,7 @@ set(CPACK_PACKAGE_VENDOR "Evgeniy Dushistov <dushistov@mail.ru>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.org") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.org")
set(CPACK_PACKAGE_VERSION_MAJOR "0") set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "5") set(CPACK_PACKAGE_VERSION_MINOR "5")
set(CPACK_PACKAGE_VERSION_PATCH "2") set(CPACK_PACKAGE_VERSION_PATCH "5")
set(sdcv_VERSION set(sdcv_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
@@ -113,8 +111,10 @@ add_executable(sdcv ${sdcv_SRCS})
target_link_libraries(sdcv target_link_libraries(sdcv
${GLIB2_LIBRARIES} ${GLIB2_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${READLINE_LIBRARY}
) )
if (WITH_READLINE)
target_link_libraries(sdcv ${READLINE_LIBRARY})
endif()
if (ENABLE_NLS) if (ENABLE_NLS)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "locale") set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "locale")
endif () endif ()
@@ -152,5 +152,8 @@ if (BUILD_TESTS)
add_sdcv_shell_test(t_utf8output) add_sdcv_shell_test(t_utf8output)
add_sdcv_shell_test(t_utf8input) add_sdcv_shell_test(t_utf8input)
add_sdcv_shell_test(t_datadir) add_sdcv_shell_test(t_datadir)
add_sdcv_shell_test(t_return_code)
add_sdcv_shell_test(t_multiple_results)
add_sdcv_shell_test(t_newlines_in_ifo)
endif (BUILD_TESTS) endif (BUILD_TESTS)

26
NEWS
View File

@@ -1,9 +1,25 @@
Version 0.5.5
- Avoid crashes when passing unknown dicts to the -u flag (by NiLuJe)
- Use off_t for stuff mainly assigned to a stat.st_size value
Version 0.5.4
- Use binary search for synonyms
- Various improvments in work with synonyms
- Added --json (same as --json-output) to match man
- Show all matched result
- More robust parsing of ifo file
- Prevent crash if file size of files not matched expecting one for .oft files
Version 0.5.3
- Use single quotes around JSON data to reduce need for escaping
- Store integer magic in cache file
- Added $SDCV_HISTFILE to set history file
- return exit code 2 if search term not found
- Comply with the XDG Base Directory Specification
Version 0.5.2 Version 0.5.2
Synonyms index support (.syn files) by Peter <craven@gmx.net> - Synonyms index support (.syn files) by Peter <craven@gmx.net>
Add support of json output by Peter <craven@gmx.net> (--json-output) - Add support of json output by Peter <craven@gmx.net> (--json-output)
Add -e for exact searches (no fuzzy matches) by Peter <craven@gmx.net> - Add -e for exact searches (no fuzzy matches) by Peter <craven@gmx.net>
Fix build with clang 3.4.1 - Fix build with clang 3.4.1
fix FSF address in license by Tomáš Čech <sleep_walker@suse.com> - fix FSF address in license by Tomáš Čech <sleep_walker@suse.com>
Version 0.5.1 Version 0.5.1
Fix usage of SDCV_PAGER by Anton Yuzhaninov Fix usage of SDCV_PAGER by Anton Yuzhaninov

View File

@@ -1,6 +1,9 @@
#+OPTIONS: ^:nil #+OPTIONS: ^:nil
[[https://travis-ci.org/Dushistov/sdcv][https://travis-ci.org/Dushistov/sdcv.svg?branch=master]] [[https://github.com/Dushistov/sdcv/actions?query=workflow%3ACI+branch%3Amaster][https://github.com/Dushistov/sdcv/workflows/CI/badge.svg]]
[[https://github.com/Dushistov/sdcv/blob/master/LICENSE][https://img.shields.io/badge/license-GPL%202-brightgreen.svg]] [[https://github.com/Dushistov/sdcv/blob/master/LICENSE][https://img.shields.io/badge/license-GPL%202-brightgreen.svg]]
* sdcv
*sdcv* is a simple, cross-platform, text-based utility for working with dictionaries in [[http://stardict-4.sourceforge.net/][StarDict]] format.
* How to compile and install * How to compile and install
#+BEGIN_SRC sh #+BEGIN_SRC sh
mkdir /tmp/build-sdcv mkdir /tmp/build-sdcv
@@ -22,9 +25,30 @@ you can use "DESTDIR" variable to change installation path
See sdcv man page for usage description. See sdcv man page for usage description.
* Bugs * Bugs
If you find bug reports it via email to dushistov at mail dot ru. To report bugs use https://github.com/Dushistov/sdcv/issues ,
if it is not possible you can report it via email to dushistov at mail dot ru.
Be sure to include the word "sdcv" somewhere in the "Subject:" field. Be sure to include the word "sdcv" somewhere in the "Subject:" field.
* Integration with [[https://github.com/junegunn/fzf][fzf]]
Useful when you have multiple dictionaries
#+BEGIN_SRC sh
fzf --prompt="Dict: " \
--phony \
--bind "enter:reload(sdcv {q} -n --json | jq '.[].dict' -r)" \
--preview "sdcv {q} -en --use-dict={}" \
--preview-window=right:70%:wrap \
< <(echo)
#+END_SRC
* Integration with readline
This lines can be added to inputrc file (~/.inputrc, /etc/inputrc),
to abort multiply usage with ESC:
#+begin_src
$if sdcv
"\e\e": "-1\n"
$endif
#+end_src
* Notes to developer * Notes to developer
** make source code release ** make source code release
#+BEGIN_SRC sh #+BEGIN_SRC sh

View File

@@ -16,19 +16,6 @@ if (NOT DEFINED SDCV_COMPILER_IS_GCC_COMPATIBLE)
endif() endif()
endif() endif()
if (MSVC AND (MSVC_VERSION LESS 1900))
message(FATAL_ERROR "MSVC version ${MSVC_VERSION} have no full c++11 support")
elseif (MSVC)
add_definitions(-DNOMINMAX)
elseif (NOT MSVC)
check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
if (CXX_SUPPORTS_CXX11)
append("-std=c++11" CMAKE_CXX_FLAGS)
else ()
message(FATAL_ERROR "sdcv requires C++11 support but the '-std=c++11' flag isn't supported.")
endif()
endif ()
if (SDCV_COMPILER_IS_GCC_COMPATIBLE) if (SDCV_COMPILER_IS_GCC_COMPATIBLE)
append("-Wall" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_C_FLAGS) append("-Wall" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_C_FLAGS)
append("-Wall" "-pedantic" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_CXX_FLAGS) append("-Wall" "-pedantic" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_CXX_FLAGS)

View File

@@ -25,7 +25,7 @@ you can use the UP and DOWN keys to cycle through history.
.B "\-h \-\-help" .B "\-h \-\-help"
Display help message and exit Display help message and exit
.TP 8 .TP 8
.B "\-v \-\-verbose" .B "\-v \-\-version"
Display version and exit Display version and exit
.TP 8 .TP 8
.B "\-l \-\-list\-dicts" .B "\-l \-\-list\-dicts"
@@ -64,7 +64,7 @@ Use ANSI escape codes for colorizing sdcv output (does not work with json output
.TP .TP
/usr/share/stardict/dic /usr/share/stardict/dic
.TP .TP
$(HOME)/.stardict/dic $(XDG_DATA_HOME)/stardict/dic
Place where sdcv expects to find dictionaries. Place where sdcv expects to find dictionaries.
Instead of /usr/share/stardict/dic you can use any directory Instead of /usr/share/stardict/dic you can use any directory
@@ -72,12 +72,12 @@ you want, just set the STARDICT_DATA_DIR environment variable.
For example, if you have dictionaries in /mnt/data/stardict-dicts/dic, For example, if you have dictionaries in /mnt/data/stardict-dicts/dic,
set STARDICT_DATA_DIR to /mnt/data/stardict-dicts. set STARDICT_DATA_DIR to /mnt/data/stardict-dicts.
.TP .TP
$(HOME)/.sdcv_history $(XDG_DATA_HOME)/sdcv_history
This file includes the last $(SDCV_HISTSIZE) words, which you sought with sdcv. This file includes the last $(SDCV_HISTSIZE) words, which you sought with sdcv.
SDCV uses this file only if it was compiled with readline library support. SDCV uses this file only if it was compiled with readline library support.
.TP .TP
$(HOME)/.sdcv_ordering $(XDG_CONFIG_HOME)/sdcv_ordering
This is a text file containing one dictionary bookname per line. This is a text file containing one dictionary bookname per line.
It specifies in which order the results of a search should be shown. It specifies in which order the results of a search should be shown.
@@ -86,11 +86,14 @@ Environment Variables Used By \fIsdcv\fR:
.TP 20 .TP 20
.B STARDICT_DATA_DIR .B STARDICT_DATA_DIR
If set, sdcv uses this variable as the data directory, this means that sdcv If set, sdcv uses this variable as the data directory, this means that sdcv
searches dictionaries in $\fBSTARDICT_DATA_DIR\fR\\dic searches dictionaries in $\fBSTARDICT_DATA_DIR\fR/dic
.TP 20 .TP 20
.B SDCV_HISTSIZE .B SDCV_HISTSIZE
If set, sdcv writes in $(HOME)/.sdcv_history the last $(SDCV_HISTSIZE) words, If set, sdcv writes in $(XDG_DATA_HOME)/sdcv_history (or $(SDCV_HISTFILE)) the last $(SDCV_HISTSIZE) words,
which you look up using sdcv. If it is not set, then the last 2000 words are saved in $(HOME)/.sdcv_history. which you look up using sdcv. If it is not set, then the last 2000 words are saved in $(XDG_DATA_HOME)/sdcv_history.
.TP 20
.B SDCV_HISTFILE
If set, sdcv writes it's history to $(SDCV_HISTFILE). If it is not set, then the default $(XDG_DATA_HOME)/sdcv_history path will be used.
.TP 20 .TP 20
.B SDCV_PAGER .B SDCV_PAGER
If SDCV_PAGER is set, its value is used as the name of the program If SDCV_PAGER is set, its value is used as the name of the program

View File

@@ -50,7 +50,7 @@ sdcv проста, міжплатформена текстова утиліта
.TP .TP
/usr/share/stardict/dic /usr/share/stardict/dic
.TP .TP
$(HOME)/.stardict/dic $(XDG_DATA_HOME)/stardict/dic
Місце, де sdcv очікує знайти словники. Місце, де sdcv очікує знайти словники.
Замість шляху /usr/share/stardict/dic Ви можете використовувати все, Замість шляху /usr/share/stardict/dic Ви можете використовувати все,
@@ -58,7 +58,7 @@ $(HOME)/.stardict/dic
Наприклад, якщо Ви маєте словники у теці /mnt/data/stardict-dicts/dic, Наприклад, якщо Ви маєте словники у теці /mnt/data/stardict-dicts/dic,
встановіть STARDICT_DATA_DIR у /mnt/data/stardict-dicts. встановіть STARDICT_DATA_DIR у /mnt/data/stardict-dicts.
.TP .TP
$(HOME)/.sdcv_history $(XDG_DATA_HOME)/sdcv_history
Цей файл містить останні $(SDCV_HISTSIZE) слова, які Ви шукали з sdcv. Цей файл містить останні $(SDCV_HISTSIZE) слова, які Ви шукали з sdcv.
SDCV використовує цей файл при умові, якщо sdcv був скомпільований SDCV використовує цей файл при умові, якщо sdcv був скомпільований
@@ -69,12 +69,12 @@ SDCV використовує цей файл при умові, якщо sdcv
.TP 20 .TP 20
.B STARDICT_DATA_DIR .B STARDICT_DATA_DIR
Якщо встановлена, sdcv використає цю змінну як теку даних, це означає, Якщо встановлена, sdcv використає цю змінну як теку даних, це означає,
що sdcv шукатиме словники у $\fBSTARDICT_DATA_DIR\fR\dic що sdcv шукатиме словники у $\fBSTARDICT_DATA_DIR\fR/dic
.TP 20 .TP 20
.B SDCV_HISTSIZE .B SDCV_HISTSIZE
Якщо встановлена, sdcv писатиме у $(HOME)/.sdcv_history лише Якщо встановлена, sdcv писатиме у $(XDG_DATA_HOME)/sdcv_history лише
останні $(SDCV_HISTSIZE) слова, які Ви шукали з sdcv. Якщо не встановлена, останні $(SDCV_HISTSIZE) слова, які Ви шукали з sdcv. Якщо не встановлена,
то збірігатиметься останніх 2000 слів у $(HOME)/.sdcv_history. то збірігатиметься останніх 2000 слів у $(XDG_DATA_HOME)/sdcv_history.
.SH BUGS .SH BUGS
Звіти про помилки висилайте на адресу dushistov на mail крапка ru. Звіти про помилки висилайте на адресу dushistov на mail крапка ru.
Не забувайте включати слово "sdcv" десь у полі "Тема:". Не забувайте включати слово "sdcv" десь у полі "Тема:".

View File

@@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.4.2\n" "Project-Id-Version: sdcv 0.4.2\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2008-09-24 10:42+0200\n" "PO-Revision-Date: 2008-09-24 10:42+0200\n"
"Last-Translator: Michal Čihař <michal@cihar.com>\n" "Last-Translator: Michal Čihař <michal@cihar.com>\n"
"Language-Team: Czech <cs@li.org>\n" "Language-Team: Czech <cs@li.org>\n"
@@ -20,21 +20,21 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "popen selhalo" msgstr "popen selhalo"
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "Nepodařilo se převést %s do utf8.\n" msgstr "Nepodařilo se převést %s do utf8.\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, fuzzy, c-format #, fuzzy, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "Nalezeno %d záznamů podobných %s.\n" msgstr "Nalezeno %d záznamů podobných %s.\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "Vaše volba [-1 pro ukončení]: " msgstr "Vaše volba [-1 pro ukončení]: "
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, fuzzy, c-format #, fuzzy, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -43,102 +43,102 @@ msgstr ""
"Chybná volba.\n" "Chybná volba.\n"
"Musí být mezi 0 a %d nebo -1.\n" "Musí být mezi 0 a %d nebo -1.\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "Nic podobného %s nenalezeno, promiň :(\n" msgstr "Nic podobného %s nenalezeno, promiň :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
#, fuzzy #, fuzzy
msgid "display version information and exit" msgid "display version information and exit"
msgstr "-v, --version zobrazí informace o verzi a skončí\n" msgstr "-v, --version zobrazí informace o verzi a skončí\n"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
#, fuzzy #, fuzzy
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "-l, --list-dicts zobrazí seznam dostupných slovníků a skončí\n" msgstr "-l, --list-dicts zobrazí seznam dostupných slovníků a skončí\n"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
#, fuzzy #, fuzzy
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "-u, --use-dict jméno vyhledávat jen v zadaném slovníku\n" msgstr "-u, --use-dict jméno vyhledávat jen v zadaném slovníku\n"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
#, fuzzy #, fuzzy
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "--utf8-output výstup musí být v utf8\n" msgstr "--utf8-output výstup musí být v utf8\n"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
#, fuzzy #, fuzzy
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "--utf8-input vstup musí být v utf8\n" msgstr "--utf8-input vstup musí být v utf8\n"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
#, fuzzy #, fuzzy
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "" msgstr ""
"--data-dir cesta/někam použít tento adresář jako cestu ke slovníkům " "--data-dir cesta/někam použít tento adresář jako cestu ke slovníkům "
"stardict\n" "stardict\n"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Konzolová verze Stardictu, verze %s\n" msgstr "Konzolová verze Stardictu, verze %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "g_mkdir selhalo: %s\n" msgstr "g_mkdir selhalo: %s\n"
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "Zadejte slovo nebo frázi: " msgstr "Zadejte slovo nebo frázi: "
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "Nebyla zadáno nic k přeložení.\n" msgstr "Nebyla zadáno nic k přeložení.\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, c-format #, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "Jméno slovníku Počet slov\n" msgstr "Jméno slovníku Počet slov\n"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.4.2\n" "Project-Id-Version: sdcv 0.4.2\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2009-06-15 23:20+0800\n" "PO-Revision-Date: 2009-06-15 23:20+0800\n"
"Language-Team: Vincent Petry <PVince81@yahoo.fr>\n" "Language-Team: Vincent Petry <PVince81@yahoo.fr>\n"
"Language: \n" "Language: \n"
@@ -22,21 +22,21 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "Échec de popen" msgstr "Échec de popen"
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "Ne peut convertir %s au format utf8.\n" msgstr "Ne peut convertir %s au format utf8.\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, fuzzy, c-format #, fuzzy, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "Trouvé %d éléments similaires à %s.\n" msgstr "Trouvé %d éléments similaires à %s.\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "Votre choix[-1 pour abandonner] : " msgstr "Votre choix[-1 pour abandonner] : "
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, fuzzy, c-format #, fuzzy, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -45,107 +45,107 @@ msgstr ""
"Selection invalide.\n" "Selection invalide.\n"
"Veuillez choisir un nombre entre 0 et %d, ou -1.\n" "Veuillez choisir un nombre entre 0 et %d, ou -1.\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "Aucun mot/phrase similaire à %s, désolé :(\n" msgstr "Aucun mot/phrase similaire à %s, désolé :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
#, fuzzy #, fuzzy
msgid "display version information and exit" msgid "display version information and exit"
msgstr "" msgstr ""
"-v, --version afficher les informations de version et sortir\n" "-v, --version afficher les informations de version et sortir\n"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
#, fuzzy #, fuzzy
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "" msgstr ""
"-l, --list-dicts afficher la liste des dictionnaires disponibles et " "-l, --list-dicts afficher la liste des dictionnaires disponibles et "
"sortir\n" "sortir\n"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
#, fuzzy #, fuzzy
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "" msgstr ""
"-u, --use-dict nom_dict pour chercher seulement en utilisant le " "-u, --use-dict nom_dict pour chercher seulement en utilisant le "
"dictionnaire spécifié\n" "dictionnaire spécifié\n"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
#, fuzzy #, fuzzy
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "--utf8-output force la sortie au format utf8\n" msgstr "--utf8-output force la sortie au format utf8\n"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
#, fuzzy #, fuzzy
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "--utf8-input force l'entrée de sdcv au format utf8\n" msgstr "--utf8-input force l'entrée de sdcv au format utf8\n"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
#, fuzzy #, fuzzy
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "" msgstr ""
"--data-dir chemin utiliser ce chemin pour trouver les données de " "--data-dir chemin utiliser ce chemin pour trouver les données de "
"stardict\n" "stardict\n"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Version console de Stardict, version %s\n" msgstr "Version console de Stardict, version %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "Échec de g_mkdir : %s\n" msgstr "Échec de g_mkdir : %s\n"
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "Entrez un mot ou une phrase: " msgstr "Entrez un mot ou une phrase: "
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "Il n'y a pas de mots/phrases à traduire.\n" msgstr "Il n'y a pas de mots/phrases à traduire.\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, c-format #, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "Nom dictionnaire Nombre de mots\n" msgstr "Nom dictionnaire Nombre de mots\n"

147
po/ka.po Normal file
View File

@@ -0,0 +1,147 @@
# Georgian translation for sdcv.
# Copyright (C) 2025 sdcv authors
# This file is distributed under the same license as the sdcv project.
# Temuri Doghonadze <temuri.doghonadze@gmail.com>, 2025.
#
msgid ""
msgstr ""
"Project-Id-Version: sdcv 0.5\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2025-01-26 03:17+0100\n"
"Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>\n"
"Language-Team: Georgian <(nothing)>\n"
"Language: ka\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.5\n"
#: ../src/libwrapper.cpp:300
msgid "popen failed"
msgstr "popen ჩავარდა"
#: ../src/libwrapper.cpp:341
#, c-format
msgid "Can not convert %s to utf8.\n"
msgstr "%s-ის utf8-ში გადაყვანა შეუძლებელია.\n"
#: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, c-format
msgid "Found %zu items, similar to %s.\n"
msgstr "აღმოჩენილია %zu ელემენტი, რომელიც %s-ს ჰგავს.\n"
#: ../src/libwrapper.cpp:417
msgid "Your choice[-1 to abort]: "
msgstr "თქვენი არჩევანი[-1 გასაუქმებლად]: "
#: ../src/libwrapper.cpp:427
#, c-format
msgid ""
"Invalid choice.\n"
"It must be from 0 to %zu or -1.\n"
msgstr ""
"არასწორი არჩევანი.\n"
"უნდა იყოს 0-დან %zu-მდე, ან -1.\n"
#: ../src/libwrapper.cpp:446
#, c-format
msgid "Nothing similar to %s, sorry :(\n"
msgstr "%s-ს არაფერი ჰგავს :(\n"
#: ../src/sdcv.cpp:89
msgid "display version information and exit"
msgstr "ვერსიის ჩვენება და გასვლა"
#: ../src/sdcv.cpp:91
msgid "display list of available dictionaries and exit"
msgstr "ხელმისაწვდომი ლექსიკონების ჩვენება და გასვლა"
#: ../src/sdcv.cpp:93
msgid "for search use only dictionary with this bookname"
msgstr "ძებნისთვის, მხოლოდ, ამ სახელის მქონე ლექსიკონის გამოყენება"
#: ../src/sdcv.cpp:94
msgid "bookname"
msgstr "ლექსიკონის_სახელი"
#: ../src/sdcv.cpp:96
msgid "for use in scripts"
msgstr "სკრიპტებში გამოსაყენებლად"
#: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON"
msgstr "შედეგების JSON ფორმატში გამოტანა"
#: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr ""
"მსგავსი სიტყვებისთვის არაზუსტი ძებნა გამოყენებული არ იქნება. "
"დაბრუნდება, მხოლოდ, ზუსტი დამთხვევები"
#: ../src/sdcv.cpp:102
msgid "output must be in utf8"
msgstr "გამოტანა utf8-ში უნდა იყოს"
#: ../src/sdcv.cpp:104
msgid "input of sdcv in utf8"
msgstr "პროგრამაში შეყვანა utf8 -ში"
#: ../src/sdcv.cpp:106
msgid "use this directory as path to stardict data directory"
msgstr ""
"ამ საქაღალდის გამოყენება stardict-ის მონაცემების საქაღალდის ბილიკად"
#: ../src/sdcv.cpp:107
msgid "path/to/dir"
msgstr "ბილიკი/სასურველ/საქაღალდემდე"
#: ../src/sdcv.cpp:109
msgid ""
"only use the dictionaries in data-dir, do not search in user and system "
"directories"
msgstr ""
"ლექსიკონების, მხოლოდ, data-dir-დან გამოყენება. მომხმარებლის და სისტემურ "
"საქაღალდეებში ძებნა არ მოხდება"
#: ../src/sdcv.cpp:111
msgid "colorize the output"
msgstr "ფერებში გამოტანა"
#: ../src/sdcv.cpp:116
msgid " words"
msgstr " სიტყვა"
#: ../src/sdcv.cpp:122
#, c-format
msgid "Invalid command line arguments: %s\n"
msgstr "არასწორი ბრძანების სტრიქონის არგუმენტები: %s\n"
#: ../src/sdcv.cpp:128
#, c-format
msgid "Console version of Stardict, version %s\n"
msgstr "Startdict-ის კონსოლის ვერსია. ვერსია %s\n"
#: ../src/sdcv.cpp:206
#, c-format
msgid "g_mkdir failed: %s\n"
msgstr "g_mkdir ჩავარდა: %s\n"
#: ../src/sdcv.cpp:222
msgid "Enter word or phrase: "
msgstr "შეიყვანეთ სიტყვა ან ფრაზა: "
#: ../src/sdcv.cpp:230
#, c-format
msgid "There are no words/phrases to translate.\n"
msgstr "სათარგმნი სიტყვების/ფრაზების გარეშე.\n"
#: ../src/sdcv.cpp:242
#, c-format
msgid "Dictionary's name Word count\n"
msgstr "ლექსიკონის სახელი სიტყვების რაოდენობა\n"
#: ../src/utils.cpp:48
#, c-format
msgid "Can not convert %s to current locale.\n"
msgstr "ვერ გადავიყვანე %s მიმდინარე ლოკალში.\n"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.5\n" "Project-Id-Version: sdcv 0.5\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2017-08-16 10:05+0300\n" "PO-Revision-Date: 2017-08-16 10:05+0300\n"
"Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n" "Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n"
"Language-Team: Russian <ru@li.org>\n" "Language-Team: Russian <ru@li.org>\n"
@@ -23,21 +23,21 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "функция popen завершилась с ошибкой" msgstr "функция popen завершилась с ошибкой"
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "Не могу преобразовать %s в utf8.\n" msgstr "Не могу преобразовать %s в utf8.\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, c-format #, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "Найдено %zu слов, похожих на %s.\n" msgstr "Найдено %zu слов, похожих на %s.\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "Ваш выбор[-1 - отмена]: " msgstr "Ваш выбор[-1 - отмена]: "
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, c-format #, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -46,95 +46,98 @@ msgstr ""
"Неправильный выбор.\n" "Неправильный выбор.\n"
"Должно быть от 0 до %zu или -1.\n" "Должно быть от 0 до %zu или -1.\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "Ничего похожего на %s, извините :(\n" msgstr "Ничего похожего на %s, извините :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
msgid "display version information and exit" msgid "display version information and exit"
msgstr "показать номер версии и завершить работу" msgstr "показать номер версии и завершить работу"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "показать список доступных словарей и завершить работу" msgstr "показать список доступных словарей и завершить работу"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "для поиска использовать только этот словарь с таким именем" msgstr "для поиска использовать только этот словарь с таким именем"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "имя_словаря" msgstr "имя_словаря"
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "для использования в скриптах" msgstr "для использования в скриптах"
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "выдать результат в JSON формате" msgstr "выдать результат в JSON формате"
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "не использовать нечеткий поиск похожих слов, вернуть только точные совпадения" msgstr ""
"не использовать нечеткий поиск похожих слов, вернуть только точные совпадения"
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "вывод программы должен быть в utf8" msgstr "вывод программы должен быть в utf8"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "ввод программы в utf8" msgstr "ввод программы в utf8"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "" msgstr ""
"использовать эту директорию в качестве пути к \"stardict data\" директории" "использовать эту директорию в качестве пути к \"stardict data\" директории"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "путь/до/директории" msgstr "путь/до/директории"
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "использовать словари только из data-dir, не искать в пользовательских и системных каталогах" msgstr ""
"использовать словари только из data-dir, не искать в пользовательских и "
"системных каталогах"
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "раскрашивать вывод в разные цвета" msgstr "раскрашивать вывод в разные цвета"
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "слова" msgstr "слова"
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "Неправильный аргумент командой строки: %s\n" msgstr "Неправильный аргумент командой строки: %s\n"
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Консольная версия StarDict, версия %s\n" msgstr "Консольная версия StarDict, версия %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "g_mkdir завершился с ошибкой: %s\n" msgstr "g_mkdir завершился с ошибкой: %s\n"
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "Введите слово или фразу: " msgstr "Введите слово или фразу: "
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "Не задано слова/фразы для перевода.\n" msgstr "Не задано слова/фразы для перевода.\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, c-format #, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "Название словаря Количество слов\n" msgstr "Название словаря Количество слов\n"

View File

@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.5\n" "Project-Id-Version: sdcv 0.5\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2017-08-16 10:01+0300\n" "PO-Revision-Date: 2017-08-16 10:01+0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,115 +20,115 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, c-format #, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, c-format #, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
"It must be from 0 to %zu or -1.\n" "It must be from 0 to %zu or -1.\n"
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
msgid "display version information and exit" msgid "display version information and exit"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "" msgstr ""
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, c-format #, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "" msgstr ""

View File

@@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.3.2\n" "Project-Id-Version: sdcv 0.3.2\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2007-09-11 00:22+0100\n" "PO-Revision-Date: 2007-09-11 00:22+0100\n"
"Last-Translator: Ivan Masár <helix84@centrum.sk>\n" "Last-Translator: Ivan Masár <helix84@centrum.sk>\n"
"Language-Team: Slovak <sk-i18n@lists.linux.sk>\n" "Language-Team: Slovak <sk-i18n@lists.linux.sk>\n"
@@ -22,22 +22,22 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "popen zlyhalo" msgstr "popen zlyhalo"
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "nie je možné konvertovať %s na utf8.\n" msgstr "nie je možné konvertovať %s na utf8.\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, fuzzy, c-format #, fuzzy, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "Nájdené %d položiek, podobných %s,\n" msgstr "Nájdené %d položiek, podobných %s,\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
#, fuzzy #, fuzzy
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "Vaša voľba[-1 zruší]: " msgstr "Vaša voľba[-1 zruší]: "
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, fuzzy, c-format #, fuzzy, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -46,103 +46,103 @@ msgstr ""
"Neplatná voľba.\n" "Neplatná voľba.\n"
"Musí byť od 0 do %d alebo -1.\n" "Musí byť od 0 do %d alebo -1.\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "Ľutujem, nič sa nepodobá na %s :(\n" msgstr "Ľutujem, nič sa nepodobá na %s :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
#, fuzzy #, fuzzy
msgid "display version information and exit" msgid "display version information and exit"
msgstr "-v, --version zobrazí informácie o verzii a skončí\n" msgstr "-v, --version zobrazí informácie o verzii a skončí\n"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
#, fuzzy #, fuzzy
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "" msgstr ""
"-l, --list-dicts zobrazí zoznam dostupných slovníkov a skončí\n" "-l, --list-dicts zobrazí zoznam dostupných slovníkov a skončí\n"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
#, fuzzy #, fuzzy
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "-u, --use-dict názov použiť pre hľadanie iba zvolený slovník\n" msgstr "-u, --use-dict názov použiť pre hľadanie iba zvolený slovník\n"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
#, fuzzy #, fuzzy
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "--utf8-output výstup musí byť v utf8\n" msgstr "--utf8-output výstup musí byť v utf8\n"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
#, fuzzy #, fuzzy
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "--utf8-input vstup pre sdcv je v utf8\n" msgstr "--utf8-input vstup pre sdcv je v utf8\n"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
#, fuzzy #, fuzzy
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "" msgstr ""
"--data-dir path/to/dir použiť tento priečinok ako cestu pre stardict " "--data-dir path/to/dir použiť tento priečinok ako cestu pre stardict "
"dátový priečinok\n" "dátový priečinok\n"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Konzolová verzia StarDict, verzia %s\n" msgstr "Konzolová verzia StarDict, verzia %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "g_mkdir zlyhalo: %s\n" msgstr "g_mkdir zlyhalo: %s\n"
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "Vložte slovo alebo frázu: " msgstr "Vložte slovo alebo frázu: "
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "Nie je čo preložiť.\n" msgstr "Nie je čo preložiť.\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, c-format #, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "názov slovníka počet slov\n" msgstr "názov slovníka počet slov\n"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.3\n" "Project-Id-Version: sdcv 0.3\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2004-12-14 17:54+0300\n" "PO-Revision-Date: 2004-12-14 17:54+0300\n"
"Last-Translator: <dubyk@lsl.lviv.ua>\n" "Last-Translator: <dubyk@lsl.lviv.ua>\n"
"Language-Team: Ukrainian <dubyk@lsl.lviv.ua>\n" "Language-Team: Ukrainian <dubyk@lsl.lviv.ua>\n"
@@ -23,22 +23,22 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "Не можу перетворити %s у utf8.\n" msgstr "Не можу перетворити %s у utf8.\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, fuzzy, c-format #, fuzzy, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "Знайдено %d слів, схожих на %s.\n" msgstr "Знайдено %d слів, схожих на %s.\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
#, fuzzy #, fuzzy
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "Ваш вибір: " msgstr "Ваш вибір: "
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, fuzzy, c-format #, fuzzy, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -47,105 +47,105 @@ msgstr ""
"Неправильний вибір.\n" "Неправильний вибір.\n"
"Повинно бути від 0 до %d.\n" "Повинно бути від 0 до %d.\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "Нічого схожого на %s, даруйте :(\n" msgstr "Нічого схожого на %s, даруйте :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
#, fuzzy #, fuzzy
msgid "display version information and exit" msgid "display version information and exit"
msgstr "-v, --version показати номер версії і завершити роботу\n" msgstr "-v, --version показати номер версії і завершити роботу\n"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
#, fuzzy #, fuzzy
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "" msgstr ""
"-l, --list-dicts показати список доступних словників і завершити " "-l, --list-dicts показати список доступних словників і завершити "
"роботу\n" "роботу\n"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
#, fuzzy #, fuzzy
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "" msgstr ""
"-u, --use-dict ім`я словника для пошуку використовувати лише цей словник\n" "-u, --use-dict ім`я словника для пошуку використовувати лише цей словник\n"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
#, fuzzy #, fuzzy
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "--utf8-output вивід програми повинен бути в utf8\n" msgstr "--utf8-output вивід програми повинен бути в utf8\n"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
#, fuzzy #, fuzzy
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "--utf8-input ввід програми в utf8\n" msgstr "--utf8-input ввід програми в utf8\n"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
#, fuzzy #, fuzzy
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "" msgstr ""
"--data-dir тека використовувати цю теку як шлях до stardict data " "--data-dir тека використовувати цю теку як шлях до stardict data "
"directory\n" "directory\n"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Консольна версія Зоряного словника [Stardict], номер версії %s\n" msgstr "Консольна версія Зоряного словника [Stardict], номер версії %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "ВведЁть слово або фразу: " msgstr "ВведЁть слово або фразу: "
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "Не задано слова/фрази для перекладу.\n" msgstr "Не задано слова/фрази для перекладу.\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, fuzzy, c-format #, fuzzy, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "назва словника кількість слів\n" msgstr "назва словника кількість слів\n"

View File

@@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.3\n" "Project-Id-Version: sdcv 0.3\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2005-1-17 00:58+0800\n" "PO-Revision-Date: 2005-1-17 00:58+0800\n"
"Last-Translator: Cai Qian <caiqian@gnome.org>\n" "Last-Translator: Cai Qian <caiqian@gnome.org>\n"
"Language-Team: Simplified Chinese\n" "Language-Team: Simplified Chinese\n"
@@ -19,22 +19,22 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "" msgstr ""
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "无法将 %s 转换为 UTF-8。\n" msgstr "无法将 %s 转换为 UTF-8。\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, fuzzy, c-format #, fuzzy, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "发现 %d 条记录和 %s 相似。\n" msgstr "发现 %d 条记录和 %s 相似。\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
#, fuzzy #, fuzzy
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "您的选择为:" msgstr "您的选择为:"
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, fuzzy, c-format #, fuzzy, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -43,100 +43,100 @@ msgstr ""
"无效的选择。\n" "无效的选择。\n"
"必须是 0 到 %d。\n" "必须是 0 到 %d。\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "对不起,没有发现和 %s 相似的 :(\n" msgstr "对不起,没有发现和 %s 相似的 :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
#, fuzzy #, fuzzy
msgid "display version information and exit" msgid "display version information and exit"
msgstr "-v, --version 显示版本信息并退出\n" msgstr "-v, --version 显示版本信息并退出\n"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
#, fuzzy #, fuzzy
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "-l, --list-dicts 显示可用的字典列表并退出\n" msgstr "-l, --list-dicts 显示可用的字典列表并退出\n"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
#, fuzzy #, fuzzy
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "-u, --use-dict 字典名 只使用指定的字典进行单词搜索\n" msgstr "-u, --use-dict 字典名 只使用指定的字典进行单词搜索\n"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
#, fuzzy #, fuzzy
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "--utf8-output 输出必须是 UTF-8\n" msgstr "--utf8-output 输出必须是 UTF-8\n"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
#, fuzzy #, fuzzy
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "--utf8-input sdcv 的输入为 UTF-8\n" msgstr "--utf8-input sdcv 的输入为 UTF-8\n"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
#, fuzzy #, fuzzy
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "--data-dir 目录路径 指定 Stardict 数据所在目录的路径\n" msgstr "--data-dir 目录路径 指定 Stardict 数据所在目录的路径\n"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Stardict 的控制台版本,版本为 %s\n" msgstr "Stardict 的控制台版本,版本为 %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "请输入单词或短语:" msgstr "请输入单词或短语:"
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "没有供翻译的单词或短语。\n" msgstr "没有供翻译的单词或短语。\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, fuzzy, c-format #, fuzzy, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "字典名 单词量\n" msgstr "字典名 单词量\n"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sdcv 0.4.2\n" "Project-Id-Version: sdcv 0.4.2\n"
"Report-Msgid-Bugs-To: dushistov@mail.ru\n" "Report-Msgid-Bugs-To: dushistov@mail.ru\n"
"POT-Creation-Date: 2017-08-16 09:52+0300\n" "POT-Creation-Date: 2020-08-14 12:58+0300\n"
"PO-Revision-Date: 2013-06-12 14:11+0800\n" "PO-Revision-Date: 2013-06-12 14:11+0800\n"
"Last-Translator: Wei-Lun Chao <bluebat@member.fsf.org>\n" "Last-Translator: Wei-Lun Chao <bluebat@member.fsf.org>\n"
"Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n" "Language-Team: Chinese (traditional) <zh-l10n@linux.org.tw>\n"
@@ -22,21 +22,21 @@ msgstr ""
msgid "popen failed" msgid "popen failed"
msgstr "popen 失敗" msgstr "popen 失敗"
#: ../src/libwrapper.cpp:340 #: ../src/libwrapper.cpp:341
#, c-format #, c-format
msgid "Can not convert %s to utf8.\n" msgid "Can not convert %s to utf8.\n"
msgstr "無法將 %s 轉換為 UTF-8。\n" msgstr "無法將 %s 轉換為 UTF-8。\n"
#: ../src/libwrapper.cpp:398 ../src/libwrapper.cpp:432 #: ../src/libwrapper.cpp:399 ../src/libwrapper.cpp:433
#, fuzzy, c-format #, fuzzy, c-format
msgid "Found %zu items, similar to %s.\n" msgid "Found %zu items, similar to %s.\n"
msgstr "找到 %d 項紀錄和 %s 相似。\n" msgstr "找到 %d 項紀錄和 %s 相似。\n"
#: ../src/libwrapper.cpp:416 #: ../src/libwrapper.cpp:417
msgid "Your choice[-1 to abort]: " msgid "Your choice[-1 to abort]: "
msgstr "您的選擇是[-1 表示放棄]" msgstr "您的選擇是[-1 表示放棄]"
#: ../src/libwrapper.cpp:426 #: ../src/libwrapper.cpp:427
#, fuzzy, c-format #, fuzzy, c-format
msgid "" msgid ""
"Invalid choice.\n" "Invalid choice.\n"
@@ -45,100 +45,100 @@ msgstr ""
"無效的選擇。\n" "無效的選擇。\n"
"必須是 0 到 %d 之間或 -1。\n" "必須是 0 到 %d 之間或 -1。\n"
#: ../src/libwrapper.cpp:445 #: ../src/libwrapper.cpp:446
#, c-format #, c-format
msgid "Nothing similar to %s, sorry :(\n" msgid "Nothing similar to %s, sorry :(\n"
msgstr "抱歉,沒有和 %s 相似者 :(\n" msgstr "抱歉,沒有和 %s 相似者 :(\n"
#: ../src/sdcv.cpp:88 #: ../src/sdcv.cpp:89
#, fuzzy #, fuzzy
msgid "display version information and exit" msgid "display version information and exit"
msgstr "-v, --version 顯示版本資訊並離開\n" msgstr "-v, --version 顯示版本資訊並離開\n"
#: ../src/sdcv.cpp:90 #: ../src/sdcv.cpp:91
#, fuzzy #, fuzzy
msgid "display list of available dictionaries and exit" msgid "display list of available dictionaries and exit"
msgstr "-l, --list-dicts 顯示可用的字典清單並離開\n" msgstr "-l, --list-dicts 顯示可用的字典清單並離開\n"
#: ../src/sdcv.cpp:92 #: ../src/sdcv.cpp:93
#, fuzzy #, fuzzy
msgid "for search use only dictionary with this bookname" msgid "for search use only dictionary with this bookname"
msgstr "-u, --use-dict 字典名 只使用指定的字典進行單字搜尋\n" msgstr "-u, --use-dict 字典名 只使用指定的字典進行單字搜尋\n"
#: ../src/sdcv.cpp:93 #: ../src/sdcv.cpp:94
msgid "bookname" msgid "bookname"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:95 #: ../src/sdcv.cpp:96
msgid "for use in scripts" msgid "for use in scripts"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:97 #: ../src/sdcv.cpp:98
msgid "print the result formatted as JSON" msgid "print the result formatted as JSON"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:99 #: ../src/sdcv.cpp:100
msgid "do not fuzzy-search for similar words, only return exact matches" msgid "do not fuzzy-search for similar words, only return exact matches"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:101 #: ../src/sdcv.cpp:102
#, fuzzy #, fuzzy
msgid "output must be in utf8" msgid "output must be in utf8"
msgstr "--utf8-output 輸出必須是 UTF-8\n" msgstr "--utf8-output 輸出必須是 UTF-8\n"
#: ../src/sdcv.cpp:103 #: ../src/sdcv.cpp:104
#, fuzzy #, fuzzy
msgid "input of sdcv in utf8" msgid "input of sdcv in utf8"
msgstr "--utf8-input sdcv 的輸入為 UTF-8\n" msgstr "--utf8-input sdcv 的輸入為 UTF-8\n"
#: ../src/sdcv.cpp:105 #: ../src/sdcv.cpp:106
#, fuzzy #, fuzzy
msgid "use this directory as path to stardict data directory" msgid "use this directory as path to stardict data directory"
msgstr "--data-dir 目錄路徑 指定 Stardict 資料所在目錄的路徑\n" msgstr "--data-dir 目錄路徑 指定 Stardict 資料所在目錄的路徑\n"
#: ../src/sdcv.cpp:106 #: ../src/sdcv.cpp:107
msgid "path/to/dir" msgid "path/to/dir"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:108 #: ../src/sdcv.cpp:109
msgid "" msgid ""
"only use the dictionaries in data-dir, do not search in user and system " "only use the dictionaries in data-dir, do not search in user and system "
"directories" "directories"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:110 #: ../src/sdcv.cpp:111
msgid "colorize the output" msgid "colorize the output"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:115 #: ../src/sdcv.cpp:116
msgid " words" msgid " words"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:121 #: ../src/sdcv.cpp:122
#, c-format #, c-format
msgid "Invalid command line arguments: %s\n" msgid "Invalid command line arguments: %s\n"
msgstr "" msgstr ""
#: ../src/sdcv.cpp:127 #: ../src/sdcv.cpp:128
#, c-format #, c-format
msgid "Console version of Stardict, version %s\n" msgid "Console version of Stardict, version %s\n"
msgstr "Stardict 的主控臺版本,版本為 %s\n" msgstr "Stardict 的主控臺版本,版本為 %s\n"
#: ../src/sdcv.cpp:202 #: ../src/sdcv.cpp:206
#, c-format #, c-format
msgid "g_mkdir failed: %s\n" msgid "g_mkdir failed: %s\n"
msgstr "g_mkdir 失敗:%s\n" msgstr "g_mkdir 失敗:%s\n"
#: ../src/sdcv.cpp:217 #: ../src/sdcv.cpp:222
msgid "Enter word or phrase: " msgid "Enter word or phrase: "
msgstr "請輸入單字或片語:" msgstr "請輸入單字或片語:"
#: ../src/sdcv.cpp:225 #: ../src/sdcv.cpp:230
#, c-format #, c-format
msgid "There are no words/phrases to translate.\n" msgid "There are no words/phrases to translate.\n"
msgstr "沒有可供翻譯的單字或片語。\n" msgstr "沒有可供翻譯的單字或片語。\n"
#: ../src/sdcv.cpp:237 #: ../src/sdcv.cpp:242
#, c-format #, c-format
msgid "Dictionary's name Word count\n" msgid "Dictionary's name Word count\n"
msgstr "字典名稱 單字數量\n" msgstr "字典名稱 單字數量\n"

View File

@@ -27,7 +27,7 @@ public:
private: private:
const char *start; /* start of mmap'd area */ const char *start; /* start of mmap'd area */
const char *end; /* end of mmap'd area */ const char *end; /* end of mmap'd area */
unsigned long size; /* size of mmap */ off_t size; /* size of mmap */
int type; int type;
z_stream zStream; z_stream zStream;
@@ -47,7 +47,7 @@ private:
std::string origFilename; std::string origFilename;
std::string comment; std::string comment;
unsigned long crc; unsigned long crc;
unsigned long length; off_t length;
unsigned long compressedLength; unsigned long compressedLength;
DictCache cache[DICT_CACHE_SIZE]; DictCache cache[DICT_CACHE_SIZE];
MapFile mapfile; MapFile mapfile;

View File

@@ -23,6 +23,7 @@
#endif #endif
#include <cstring> #include <cstring>
#include <cstdio> //for popen
#include <map> #include <map>
#include <memory> #include <memory>
@@ -199,14 +200,18 @@ static std::string parse_data(const gchar *data, bool colorize_output)
void Library::SimpleLookup(const std::string &str, TSearchResultList &res_list) void Library::SimpleLookup(const std::string &str, TSearchResultList &res_list)
{ {
glong ind; std::set<glong> wordIdxs;
res_list.reserve(ndicts()); res_list.reserve(ndicts());
for (gint idict = 0; idict < ndicts(); ++idict) for (gint idict = 0; idict < ndicts(); ++idict) {
if (SimpleLookupWord(str.c_str(), ind, idict)) wordIdxs.clear();
res_list.push_back( if (SimpleLookupWord(str.c_str(), wordIdxs, idict))
TSearchResult(dict_name(idict), for (auto &wordIdx : wordIdxs)
poGetWord(ind, idict), res_list.push_back(
parse_data(poGetWordData(ind, idict), colorize_output_))); TSearchResult(dict_name(idict),
poGetWord(wordIdx, idict),
parse_data(poGetWordData(wordIdx, idict),
colorize_output_)));
}
} }
void Library::LookupWithFuzzy(const std::string &str, TSearchResultList &res_list) void Library::LookupWithFuzzy(const std::string &str, TSearchResultList &res_list)
@@ -314,12 +319,12 @@ public:
private: private:
FILE *output; FILE *output;
}; };
} } // namespace
bool Library::process_phrase(const char *loc_str, IReadLine &io, bool force) search_result Library::process_phrase(const char *loc_str, IReadLine &io, bool force)
{ {
if (nullptr == loc_str) if (nullptr == loc_str)
return true; return SEARCH_SUCCESS;
std::string query; std::string query;
@@ -330,6 +335,7 @@ bool Library::process_phrase(const char *loc_str, IReadLine &io, bool force)
gsize bytes_read; gsize bytes_read;
gsize bytes_written; gsize bytes_written;
glib::Error err; glib::Error err;
search_result rval = SEARCH_SUCCESS;
glib::CharStr str; glib::CharStr str;
if (!utf8_input_) if (!utf8_input_)
str.reset(g_locale_to_utf8(loc_str, -1, &bytes_read, &bytes_written, get_addr(err))); str.reset(g_locale_to_utf8(loc_str, -1, &bytes_read, &bytes_written, get_addr(err)));
@@ -339,11 +345,11 @@ bool Library::process_phrase(const char *loc_str, IReadLine &io, bool force)
if (nullptr == get_impl(str)) { if (nullptr == get_impl(str)) {
fprintf(stderr, _("Can not convert %s to utf8.\n"), loc_str); fprintf(stderr, _("Can not convert %s to utf8.\n"), loc_str);
fprintf(stderr, "%s\n", err->message); fprintf(stderr, "%s\n", err->message);
return false; return SEARCH_FAILURE;
} }
if (str[0] == '\0') if (str[0] == '\0')
return true; return SEARCH_SUCCESS;
TSearchResultList res_list; TSearchResultList res_list;
@@ -410,10 +416,9 @@ bool Library::process_phrase(const char *loc_str, IReadLine &io, bool force)
colorize_output_ ? ESC_END : ""); colorize_output_ ? ESC_END : "");
} }
int choise; int choise;
std::unique_ptr<IReadLine> choice_readline(create_readline_object());
for (;;) { for (;;) {
std::string str_choise; std::string str_choise;
choice_readline->read(_("Your choice[-1 to abort]: "), str_choise); io.read(_("Your choice[-1 to abort]: "), str_choise);
sscanf(str_choise.c_str(), "%d", &choise); sscanf(str_choise.c_str(), "%d", &choise);
if (choise >= 0 && choise < int(res_list.size())) { if (choise >= 0 && choise < int(res_list.size())) {
sdcv_pager pager; sdcv_pager pager;
@@ -443,10 +448,11 @@ bool Library::process_phrase(const char *loc_str, IReadLine &io, bool force)
loc_str = utf8_to_locale_ign_err(get_impl(str)); loc_str = utf8_to_locale_ign_err(get_impl(str));
if (!json_) if (!json_)
printf(_("Nothing similar to %s, sorry :(\n"), utf8_output_ ? get_impl(str) : loc_str.c_str()); printf(_("Nothing similar to %s, sorry :(\n"), utf8_output_ ? get_impl(str) : loc_str.c_str());
rval = SEARCH_NO_RESULT;
} }
if (json_) { if (json_) {
fputs("]\n", stdout); fputs("]\n", stdout);
} }
return true; return rval;
} }

View File

@@ -23,6 +23,13 @@ struct TSearchResult {
typedef std::vector<TSearchResult> TSearchResultList; typedef std::vector<TSearchResult> TSearchResultList;
//possible return values for Library.process_phase()
enum search_result {
SEARCH_SUCCESS = 0,
SEARCH_FAILURE,
SEARCH_NO_RESULT
};
//this class is wrapper around Dicts class for easy use //this class is wrapper around Dicts class for easy use
//of it //of it
class Library : public Libs class Library : public Libs
@@ -38,7 +45,7 @@ public:
setFuzzy(!no_fuzzy); setFuzzy(!no_fuzzy);
} }
bool process_phrase(const char *loc_str, IReadLine &io, bool force = false); search_result process_phrase(const char *loc_str, IReadLine &io, bool force = false);
private: private:
bool utf8_input_; bool utf8_input_;

View File

@@ -7,6 +7,7 @@
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@@ -21,13 +22,13 @@ public:
~MapFile(); ~MapFile();
MapFile(const MapFile &) = delete; MapFile(const MapFile &) = delete;
MapFile &operator=(const MapFile &) = delete; MapFile &operator=(const MapFile &) = delete;
bool open(const char *file_name, unsigned long file_size); bool open(const char *file_name, off_t file_size);
gchar *begin() { return data; } gchar *begin() { return data; }
private: private:
char *data = nullptr; char *data = nullptr;
unsigned long size = 0ul;
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
size_t size = 0u;
int mmap_fd = -1; int mmap_fd = -1;
#elif defined(_WIN32) #elif defined(_WIN32)
HANDLE hFile = 0; HANDLE hFile = 0;
@@ -35,25 +36,31 @@ private:
#endif #endif
}; };
inline bool MapFile::open(const char *file_name, unsigned long file_size) inline bool MapFile::open(const char *file_name, off_t file_size)
{ {
size = file_size;
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
if ((mmap_fd = ::open(file_name, O_RDONLY)) < 0) { if ((mmap_fd = ::open(file_name, O_RDONLY)) < 0) {
//g_print("Open file %s failed!\n",fullfilename); // g_print("Open file %s failed!\n",fullfilename);
return false; return false;
} }
data = (gchar *)mmap(nullptr, file_size, PROT_READ, MAP_SHARED, mmap_fd, 0); struct stat st;
if (fstat(mmap_fd, &st) == -1 || st.st_size < 0 || (st.st_size == 0 && S_ISREG(st.st_mode))
|| st.st_size != file_size) {
close(mmap_fd);
return false;
}
size = static_cast<size_t>(st.st_size);
data = (gchar *)mmap(nullptr, size, PROT_READ, MAP_SHARED, mmap_fd, 0);
if ((void *)data == (void *)(-1)) { if ((void *)data == (void *)(-1)) {
//g_print("mmap file %s failed!\n",idxfilename); // g_print("mmap file %s failed!\n",idxfilename);
size = 0u;
data = nullptr; data = nullptr;
return false; return false;
} }
#elif defined(_WIN32) #elif defined(_WIN32)
hFile = CreateFile(file_name, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, hFile = CreateFile(file_name, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
FILE_ATTRIBUTE_NORMAL, 0); hFileMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0, file_size, nullptr);
hFileMap = CreateFileMapping(hFile, nullptr, PAGE_READONLY, 0,
file_size, nullptr);
data = (gchar *)MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, file_size); data = (gchar *)MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, file_size);
#else #else
gsize read_len; gsize read_len;

View File

@@ -57,11 +57,25 @@ public:
return stdio_getline(stdin, line); return stdio_getline(stdin, line);
} }
}; };
} } // namespace
#else #else
namespace namespace
{ {
std::string get_hist_file_path()
{
const gchar *hist_file_str = g_getenv("SDCV_HISTFILE");
if (hist_file_str != nullptr)
return std::string(hist_file_str);
const std::string hist_file_path = std::string(g_get_home_dir()) + G_DIR_SEPARATOR + ".sdcv_history";
if (g_file_test(hist_file_path.c_str(), G_FILE_TEST_IS_REGULAR))
return hist_file_path;
return std::string(g_get_user_data_dir()) + G_DIR_SEPARATOR + "sdcv_history";
}
class real_readline : public IReadLine class real_readline : public IReadLine
{ {
@@ -70,13 +84,13 @@ public:
{ {
rl_readline_name = "sdcv"; rl_readline_name = "sdcv";
using_history(); using_history();
const std::string histname = std::string(g_get_home_dir()) + G_DIR_SEPARATOR + ".sdcv_history"; const std::string histname = get_hist_file_path();
read_history(histname.c_str()); read_history(histname.c_str());
} }
~real_readline() ~real_readline()
{ {
const std::string histname = std::string(g_get_home_dir()) + G_DIR_SEPARATOR + ".sdcv_history"; const std::string histname = get_hist_file_path();
write_history(histname.c_str()); write_history(histname.c_str());
const gchar *hist_size_str = g_getenv("SDCV_HISTSIZE"); const gchar *hist_size_str = g_getenv("SDCV_HISTSIZE");
int hist_size; int hist_size;
@@ -102,7 +116,7 @@ public:
add_history(phrase.c_str()); add_history(phrase.c_str());
} }
}; };
} } // namespace
#endif //WITH_READLINE #endif //WITH_READLINE
IReadLine *create_readline_object() IReadLine *create_readline_object()

View File

@@ -53,7 +53,7 @@ static void free_str_array(gchar **arr)
g_free(*p); g_free(*p);
g_free(arr); g_free(arr);
} }
} } // namespace
namespace glib namespace glib
{ {
using StrArr = ResourceWrapper<gchar *, gchar *, free_str_array>; using StrArr = ResourceWrapper<gchar *, gchar *, free_str_array>;
@@ -61,13 +61,14 @@ using StrArr = ResourceWrapper<gchar *, gchar *, free_str_array>;
static void list_dicts(const std::list<std::string> &dicts_dir_list, bool use_json); static void list_dicts(const std::list<std::string> &dicts_dir_list, bool use_json);
int main(int argc, char *argv[]) try { int main(int argc, char *argv[])
try {
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
#if ENABLE_NLS #if ENABLE_NLS
bindtextdomain("sdcv", bindtextdomain("sdcv",
//"./locale"//< for testing //"./locale"//< for testing
GETTEXT_TRANSLATIONS_PATH //< should be GETTEXT_TRANSLATIONS_PATH //< should be
); );
textdomain("sdcv"); textdomain("sdcv");
#endif #endif
@@ -82,6 +83,7 @@ int main(int argc, char *argv[]) try {
glib::CharStr opt_data_dir; glib::CharStr opt_data_dir;
gboolean only_data_dir = FALSE; gboolean only_data_dir = FALSE;
gboolean colorize = FALSE; gboolean colorize = FALSE;
glib::StrArr word_list;
const GOptionEntry entries[] = { const GOptionEntry entries[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version,
@@ -95,6 +97,8 @@ int main(int argc, char *argv[]) try {
_("for use in scripts"), nullptr }, _("for use in scripts"), nullptr },
{ "json-output", 'j', 0, G_OPTION_ARG_NONE, &json_output, { "json-output", 'j', 0, G_OPTION_ARG_NONE, &json_output,
_("print the result formatted as JSON"), nullptr }, _("print the result formatted as JSON"), nullptr },
{ "json", 'j', 0, G_OPTION_ARG_NONE, &json_output,
_("print the result formatted as JSON"), nullptr },
{ "exact-search", 'e', 0, G_OPTION_ARG_NONE, &no_fuzzy, { "exact-search", 'e', 0, G_OPTION_ARG_NONE, &no_fuzzy,
_("do not fuzzy-search for similar words, only return exact matches"), nullptr }, _("do not fuzzy-search for similar words, only return exact matches"), nullptr },
{ "utf8-output", '0', 0, G_OPTION_ARG_NONE, &utf8_output, { "utf8-output", '0', 0, G_OPTION_ARG_NONE, &utf8_output,
@@ -108,11 +112,13 @@ int main(int argc, char *argv[]) try {
_("only use the dictionaries in data-dir, do not search in user and system directories"), nullptr }, _("only use the dictionaries in data-dir, do not search in user and system directories"), nullptr },
{ "color", 'c', 0, G_OPTION_ARG_NONE, &colorize, { "color", 'c', 0, G_OPTION_ARG_NONE, &colorize,
_("colorize the output"), nullptr }, _("colorize the output"), nullptr },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, get_addr(word_list),
_("search terms"), _(" words") },
{}, {},
}; };
glib::Error error; glib::Error error;
GOptionContext *context = g_option_context_new(_(" words")); GOptionContext *context = g_option_context_new(nullptr);
g_option_context_set_help_enabled(context, TRUE); g_option_context_set_help_enabled(context, TRUE);
g_option_context_add_main_entries(context, entries, nullptr); g_option_context_add_main_entries(context, entries, nullptr);
const gboolean parse_res = g_option_context_parse(context, &argc, &argv, get_addr(error)); const gboolean parse_res = g_option_context_parse(context, &argc, &argv, get_addr(error));
@@ -141,13 +147,13 @@ int main(int argc, char *argv[]) try {
data_dir = get_impl(opt_data_dir); data_dir = get_impl(opt_data_dir);
} }
const char *homedir = g_getenv("HOME"); std::string conf_dir = std::string(g_get_home_dir()) + G_DIR_SEPARATOR + ".stardict";
if (!homedir) if (!g_file_test(conf_dir.c_str(), G_FILE_TEST_IS_DIR))
homedir = g_get_home_dir(); conf_dir = std::string(g_get_user_data_dir()) + G_DIR_SEPARATOR + "stardict";
std::list<std::string> dicts_dir_list; std::list<std::string> dicts_dir_list;
if (!only_data_dir) if (!only_data_dir)
dicts_dir_list.push_back(std::string(homedir) + G_DIR_SEPARATOR + ".stardict" + G_DIR_SEPARATOR + "dic"); dicts_dir_list.push_back(conf_dir + G_DIR_SEPARATOR + "dic");
dicts_dir_list.push_back(data_dir); dicts_dir_list.push_back(data_dir);
if (show_list_dicts) { if (show_list_dicts) {
list_dicts(dicts_dir_list, json_output); list_dicts(dicts_dir_list, json_output);
@@ -180,24 +186,35 @@ int main(int argc, char *argv[]) try {
} }
// add bookname to list // add bookname to list
gchar **p = get_impl(use_dict_list); for (gchar **p = get_impl(use_dict_list); *p != nullptr; ++p) {
while (*p) { auto it = bookname_to_ifo.find(*p);
order_list.push_back(bookname_to_ifo.at(*p)); if (it != bookname_to_ifo.end()) {
++p; order_list.push_back(it->second);
} else {
fprintf(stderr, _("Unknown dictionary: %s\n"), *p);
}
} }
} else { } else {
const std::string odering_cfg_file = std::string(homedir) + G_DIR_SEPARATOR_S ".sdcv_ordering"; std::string ordering_cfg_file = std::string(g_get_user_config_dir()) + G_DIR_SEPARATOR_S "sdcv_ordering";
FILE *ordering_file = fopen(odering_cfg_file.c_str(), "r"); FILE *ordering_file = fopen(ordering_cfg_file.c_str(), "r");
if (ordering_file == nullptr) {
ordering_cfg_file = std::string(g_get_home_dir()) + G_DIR_SEPARATOR_S ".sdcv_ordering";
ordering_file = fopen(ordering_cfg_file.c_str(), "r");
}
if (ordering_file != nullptr) { if (ordering_file != nullptr) {
std::string line; std::string line;
while (stdio_getline(ordering_file, line)) { while (stdio_getline(ordering_file, line)) {
order_list.push_back(bookname_to_ifo.at(line)); auto it = bookname_to_ifo.find(line);
if (it != bookname_to_ifo.end()) {
order_list.push_back(it->second);
} else {
fprintf(stderr, _("Unknown dictionary: %s\n"), line.c_str());
}
} }
fclose(ordering_file); fclose(ordering_file);
} }
} }
const std::string conf_dir = std::string(g_get_home_dir()) + G_DIR_SEPARATOR + ".stardict";
if (g_mkdir(conf_dir.c_str(), S_IRWXU) == -1 && errno != EEXIST) { if (g_mkdir(conf_dir.c_str(), S_IRWXU) == -1 && errno != EEXIST) {
fprintf(stderr, _("g_mkdir failed: %s\n"), strerror(errno)); fprintf(stderr, _("g_mkdir failed: %s\n"), strerror(errno));
} }
@@ -206,16 +223,22 @@ int main(int argc, char *argv[]) try {
lib.load(dicts_dir_list, order_list, disable_list); lib.load(dicts_dir_list, order_list, disable_list);
std::unique_ptr<IReadLine> io(create_readline_object()); std::unique_ptr<IReadLine> io(create_readline_object());
if (optind < argc) { if (word_list != nullptr) {
for (int i = optind; i < argc; ++i) search_result rval = SEARCH_SUCCESS;
if (!lib.process_phrase(argv[i], *io, non_interactive)) { gchar **p = get_impl(word_list);
return EXIT_FAILURE; while (*p) {
} search_result this_rval = lib.process_phrase(*p++, *io, non_interactive);
// If we encounter any error, save it but continue through the word
// list to check all requested words.
if (rval == SEARCH_SUCCESS)
rval = this_rval;
}
if (rval != SEARCH_SUCCESS)
return rval;
} else if (!non_interactive) { } else if (!non_interactive) {
std::string phrase; std::string phrase;
while (io->read(_("Enter word or phrase: "), phrase)) { while (io->read(_("Enter word or phrase: "), phrase)) {
if (!lib.process_phrase(phrase.c_str(), *io)) if (lib.process_phrase(phrase.c_str(), *io) == SEARCH_FAILURE)
return EXIT_FAILURE; return EXIT_FAILURE;
phrase.clear(); phrase.clear();
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,10 @@
#pragma once #pragma once
#include <cstdio>
#include <cstring> #include <cstring>
#include <functional> #include <functional>
#include <list> #include <list>
#include <map>
#include <memory> #include <memory>
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -29,7 +28,7 @@ inline void set_uint32(gchar *addr, guint32 val)
struct cacheItem { struct cacheItem {
guint32 offset; guint32 offset;
gchar *data; gchar *data;
//write code here to make it inline // write code here to make it inline
cacheItem() { data = nullptr; } cacheItem() { data = nullptr; }
~cacheItem() { g_free(data); } ~cacheItem() { g_free(data); }
}; };
@@ -67,7 +66,7 @@ private:
gint cache_cur = 0; gint cache_cur = 0;
}; };
//this structure contain all information about dictionary // this structure contain all information about dictionary
struct DictInfo { struct DictInfo {
std::string ifo_file_name; std::string ifo_file_name;
guint32 wordcount; guint32 wordcount;
@@ -78,8 +77,8 @@ struct DictInfo {
std::string website; std::string website;
std::string date; std::string date;
std::string description; std::string description;
guint32 index_file_size; off_t index_file_size;
guint32 syn_file_size; off_t syn_file_size;
std::string sametypesequence; std::string sametypesequence;
bool load_from_ifo_file(const std::string &ifofilename, bool istreedict); bool load_from_ifo_file(const std::string &ifofilename, bool istreedict);
@@ -92,21 +91,31 @@ public:
guint32 wordentry_size; guint32 wordentry_size;
virtual ~IIndexFile() {} virtual ~IIndexFile() {}
virtual bool load(const std::string &url, gulong wc, gulong fsize, bool verbose) = 0; virtual bool load(const std::string &url, gulong wc, off_t fsize, bool verbose) = 0;
virtual const gchar *get_key(glong idx) = 0; virtual const gchar *get_key(glong idx) = 0;
virtual void get_data(glong idx) = 0; virtual void get_data(glong idx) = 0;
virtual const gchar *get_key_and_data(glong idx) = 0; virtual const gchar *get_key_and_data(glong idx) = 0;
virtual bool lookup(const char *str, glong &idx) = 0; virtual bool lookup(const char *str, std::set<glong> &idxs, glong &next_idx) = 0;
virtual bool lookup(const char *str, std::set<glong> &idxs)
{
glong unused_next_idx;
return lookup(str, idxs, unused_next_idx);
};
}; };
class SynFile class SynFile
{ {
public: public:
SynFile() {}
~SynFile() {}
bool load(const std::string &url, gulong wc); bool load(const std::string &url, gulong wc);
bool lookup(const char *str, glong &idx); bool lookup(const char *str, std::set<glong> &idxs, glong &next_idx);
bool lookup(const char *str, std::set<glong> &idxs);
const gchar *get_key(glong idx) { return synlist[idx]; }
private: private:
std::map<std::string, gulong> synonyms; MapFile synfile;
std::vector<gchar *> synlist;
}; };
class Dict : public DictBase class Dict : public DictBase
@@ -133,7 +142,12 @@ public:
*offset = idx_file->wordentry_offset; *offset = idx_file->wordentry_offset;
*size = idx_file->wordentry_size; *size = idx_file->wordentry_size;
} }
bool Lookup(const char *str, glong &idx); bool Lookup(const char *str, std::set<glong> &idxs, glong &next_idx);
bool Lookup(const char *str, std::set<glong> &idxs)
{
glong unused_next_idx;
return Lookup(str, idxs, unused_next_idx);
}
bool LookupWithRule(GPatternSpec *pspec, glong *aIndex, int iBuffLen); bool LookupWithRule(GPatternSpec *pspec, glong *aIndex, int iBuffLen);
@@ -146,7 +160,7 @@ private:
std::unique_ptr<IIndexFile> idx_file; std::unique_ptr<IIndexFile> idx_file;
std::unique_ptr<SynFile> syn_file; std::unique_ptr<SynFile> syn_file;
bool load_ifofile(const std::string &ifofilename, gulong &idxfilesize); bool load_ifofile(const std::string &ifofilename, off_t &idxfilesize);
}; };
class Libs class Libs
@@ -155,7 +169,7 @@ public:
Libs(std::function<void(void)> f = std::function<void(void)>()) Libs(std::function<void(void)> f = std::function<void(void)>())
{ {
progress_func = f; progress_func = f;
iMaxFuzzyDistance = MAX_FUZZY_DISTANCE; //need to read from cfg. iMaxFuzzyDistance = MAX_FUZZY_DISTANCE; // need to read from cfg.
} }
void setVerbose(bool verbose) { verbose_ = verbose; } void setVerbose(bool verbose) { verbose_ = verbose; }
void setFuzzy(bool fuzzy) { fuzzy_ = fuzzy; } void setFuzzy(bool fuzzy) { fuzzy_ = fuzzy; }
@@ -181,15 +195,12 @@ public:
return nullptr; return nullptr;
return oLib[iLib]->get_data(iIndex); return oLib[iLib]->get_data(iIndex);
} }
const gchar *poGetCurrentWord(glong *iCurrent); bool LookupWord(const gchar *sWord, std::set<glong> &iWordIndices, int iLib)
const gchar *poGetNextWord(const gchar *word, glong *iCurrent);
const gchar *poGetPreWord(glong *iCurrent);
bool LookupWord(const gchar *sWord, glong &iWordIndex, int iLib)
{ {
return oLib[iLib]->Lookup(sWord, iWordIndex); return oLib[iLib]->Lookup(sWord, iWordIndices);
} }
bool LookupSimilarWord(const gchar *sWord, glong &iWordIndex, int iLib); bool LookupSimilarWord(const gchar *sWord, std::set<glong> &iWordIndices, int iLib);
bool SimpleLookupWord(const gchar *sWord, glong &iWordIndex, int iLib); bool SimpleLookupWord(const gchar *sWord, std::set<glong> &iWordIndices, int iLib);
bool LookupWithFuzzy(const gchar *sWord, gchar *reslist[], gint reslist_size); bool LookupWithFuzzy(const gchar *sWord, gchar *reslist[], gint reslist_size);
gint LookupWithRule(const gchar *sWord, gchar *reslist[]); gint LookupWithRule(const gchar *sWord, gchar *reslist[]);

View File

@@ -68,7 +68,7 @@ namespace glib
{ {
typedef ResourceWrapper<gchar, void, g_free> CharStr; typedef ResourceWrapper<gchar, void, g_free> CharStr;
typedef ResourceWrapper<GError, GError, g_error_free> Error; typedef ResourceWrapper<GError, GError, g_error_free> Error;
} } // namespace glib
extern std::string utf8_to_locale_ign_err(const std::string &utf8_str); extern std::string utf8_to_locale_ign_err(const std::string &utf8_str);

View File

@@ -0,0 +1,9 @@
StarDict's dict ifo file
version=3.0.0
bookname=Russian-English Dictionary (ru-en)
wordcount=415144
idxfilesize=12344255
sametypesequence=h
synwordcount=1277580
author=Vuizur
description=

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
StarDict's dict ifo file
version=3.0.0
bookname=Test multiple results
wordcount=246
idxfilesize=5977
synwordcount=124
description=

Binary file not shown.

Binary file not shown.

View File

@@ -6,7 +6,7 @@ unset SDCV_PAGER
have=`"$PATH_TO_SDCV" --data-dir /tmp/bugagaga -l | wc -l` have=`"$PATH_TO_SDCV" --data-dir /tmp/bugagaga -l | wc -l`
#do not count header #do not count header
have=$(($have-1)) have=$(($have-1))
ndicts=`find "${HOME}"/.stardict/dic -name "*.ifo" -print | wc -l` ndicts=`find "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic -name "*.ifo" -print | wc -l`
#ndicts=$(($ndicts+1)) #ndicts=$(($ndicts+1))
if [ $have -ne $ndicts ]; then if [ $have -ne $ndicts ]; then
ndicts=$(($ndicts-1)) ndicts=$(($ndicts-1))

View File

@@ -9,17 +9,24 @@ unset SDCV_PAGER
unset STARDICT_DATA_DIR unset STARDICT_DATA_DIR
test_json() { test_json() {
PARAMS="$1" EXPECTED=$(echo "$1" | jq 'sort')
EXPECTED=$(echo "$2" | jq 'sort') shift
RESULT=$($SDCV $PARAMS | jq 'sort') RESULT=$($SDCV "$@" | jq 'sort')
if [ "$EXPECTED" != "$RESULT"]; then if [ "$EXPECTED" != "$RESULT" ]; then
echo "expected $EXPECTED but got $RESULT" echo "expected $EXPECTED but got $RESULT"
exit 1 exit 1
fi fi
} }
test_json "-x -j -l -n --data-dir \"$TEST_DIR\"" "[{\"name\": \"Test synonyms\", \"wordcount\": \"1\"},{\"name\": \"Sample 1 test dictionary\", \"wordcount\": \"1\"},{\"name\": \"test_dict\", \"wordcount\": \"1\"}]" test_json '[{"name": "Russian-English Dictionary (ru-en)", "wordcount": "415144"},
test_json "-x -j -n --data-dir \"$TEST_DIR\" foo" "[{\"dict\": \"Test synonyms\",\"word\":\"test\",\"definition\":\"\nresult of test\"}]" {"name": "Test synonyms", "wordcount": "2"},
test_json "-x -j -n --data-dir \"$TEST_DIR\" foobarbaaz" "[]" {"name": "Test multiple results", "wordcount": "246"},
{"name": "Sample 1 test dictionary", "wordcount": "1"},
{"name": "test_dict", "wordcount": "1"}]' -x -j -l -n --data-dir "$TEST_DIR"
test_json '[{"dict": "Test synonyms","word":"test","definition":"\u000aresult of test"}]' -x -j -n --data-dir "$TEST_DIR" foo
test_json '[]' -x -j -n --data-dir "$TEST_DIR" foobarbaaz
# Test multiple searches, with the first failing.
test_json '[][{"dict": "Test synonyms","word":"test","definition":"\u000aresult of test"}]' -x -j -n --data-dir "$TEST_DIR" foobarbaaz foo
exit 0 exit 0

View File

@@ -4,7 +4,7 @@ PATH_TO_SDCV="$1"
ndicts=`"$PATH_TO_SDCV" -l | wc -l` ndicts=`"$PATH_TO_SDCV" -l | wc -l`
ndicts=$(($ndicts-1)) ndicts=$(($ndicts-1))
ncom=`find /usr/share/stardict/dic -name "*.ifo" | wc -l` ncom=`find /usr/share/stardict/dic -name "*.ifo" | wc -l`
nspe=`find "${HOME}"/.stardict/dic -name "*.ifo" | wc -l` nspe=`find "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic -name "*.ifo" | wc -l`
nmy=$(($ncom+$nspe)) nmy=$(($ncom+$nspe))
if [ $nmy -ne $ndicts ]; then if [ $nmy -ne $ndicts ]; then

67
tests/t_multiple_results Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/sh
set -e
SDCV="$1"
TEST_DIR="$2"
unset SDCV_PAGER
unset STARDICT_DATA_DIR
test_json() {
word="$1"
jq_cmp="$2"
result="$("$SDCV" --data-dir "$TEST_DIR" -exjn "$word" | sed 's|\\n|\\u000a|g')"
cmp_result="$(echo "$result" | jq "$jq_cmp")"
if [ "$cmp_result" != "true" ]; then
echo "expected '$jq_cmp' to return true, but $result didn't"
exit 1
fi
}
# Basic two-result search for the same headword.
test_json bark \
'. == [
{"dict":"Test multiple results","word":"bark","definition":"\u000aThe harsh sound made by a dog."},
{"dict":"Test multiple results","word":"bark","definition":"\u000aThe tough outer covering of trees and other woody plants."}
]'
# Multi-result search where one word exists as both a synyonym and a separate
# headword. This ensures that if there is a matching synyonym we don't skip the
# regular search.
test_json cat \
'. == [
{"dict":"Test multiple results","word":"cat","definition":"\u000aA cute animal which (rarely) barks."},
{"dict":"Test multiple results","word":"lion","definition":"\u000aA larger cat which might bite your head off."},
{"dict":"Test multiple results","word":"panther","definition":"\u000aI know very little about panthers, sorry."}
]'
# Many-result search for a word that matches 120 distinct headwords.
test_json many_headwords 'length == 120'
test_json many_headwords 'all(.word == "many_headwords")'
test_json many_headwords \
'to_entries | map(.value.definition == "\u000aDefinition for [many_headwords] entry #\(.key+1) (same headword).") | all'
# Many-result search for 120 words that have the same synonym.
test_json many_synonyms 'length == 120'
test_json many_synonyms \
'to_entries | map(.value.word == "many_synonyms-\(.key+101)") | all'
test_json many_synonyms \
'to_entries | map(.value.definition == "\u000aDefinition for [many_synonyms-\(.key+101)] (same synonym).") | all'
# Ensure that we don't return more than one result even if a word can be
# resolved in more than one way.
#
# Most well-formed dictionaries don't have entries like this (it basically
# requires you to have a dictionary where there is a synonym that is identical
# to a word's headword or multiple identical synyonym entries).
#
# This entry was created by creating extra synonyms with different names then
# modifying the .syn file manually.
test_json many_resolution_paths \
'. == [
{"dict":"Test multiple results","word":"many_resolution_paths",
"definition":"\u000aDefinition for [many_resolution_paths] headword (same word, multiple synonym entries)."}
]'
exit 0

18
tests/t_newlines_in_ifo Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -e
PATH_TO_SDCV="$1"
TEST_DIR="$2"
unset SDCV_PAGER
unset STARDICT_DATA_DIR
RES=$("$PATH_TO_SDCV" -n -x --data-dir="$TEST_DIR/not-unix-newlines-ifo" -l | tail -n 1)
if [ "$RES" = "Russian-English Dictionary (ru-en) 415144" ]; then
exit 0
else
echo "test failed, unexpected result: $RES" >&2
exit 1
fi

22
tests/t_return_code Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
SDCV="$1"
TEST_DIR="$2"
unset SDCV_PAGER
test_return_code() {
WORD=$1
EXPECTED=$2
$SDCV -e -n --data-dir "$TEST_DIR" -u "Test synonyms" $WORD > /dev/null
RC=$?
if [ $RC -ne $EXPECTED ]; then
echo "Return code for $WORD should be '$EXPECTED' but was '$RC'"
exit 1
fi
}
test_return_code testawordy 0
test_return_code testawordies 2
exit 0

View File

@@ -5,8 +5,8 @@ set -e
PATH_TO_SDCV="$1" PATH_TO_SDCV="$1"
TESTS_DIR="$2" TESTS_DIR="$2"
mkdir -p "${HOME}"/.stardict/dic mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic
cp -R "${TESTS_DIR}/stardict-test_dict-2.4.2" "${HOME}"/.stardict/dic cp -R "${TESTS_DIR}/stardict-test_dict-2.4.2" "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic
unset SDCV_PAGER unset SDCV_PAGER
RES=`"$PATH_TO_SDCV" -n -u test_dict test | grep "test passed"` RES=`"$PATH_TO_SDCV" -n -u test_dict test | grep "test passed"`
@@ -15,6 +15,6 @@ if [ -z "$RES" ]; then
exit 1 exit 1
fi fi
rm -fr "${HOME}"/.stardict/dic/stardict-test_dict-2.4.2 rm -fr "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic/stardict-test_dict-2.4.2
exit 0 exit 0

View File

@@ -4,9 +4,8 @@ set -e
PATH_TO_SDCV="$1" PATH_TO_SDCV="$1"
TESTS_DIR="$2" TESTS_DIR="$2"
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic
mkdir -p "${HOME}"/.stardict/dic cp -R "${TESTS_DIR}/rus-eng-stardict-2.4.2" "${XDG_DATA_HOME:-$HOME/.local/share}"/stardict/dic/
cp -R "${TESTS_DIR}/rus-eng-stardict-2.4.2" "${HOME}"/.stardict/dic/
unset SDCV_PAGER unset SDCV_PAGER
export LANG=ru_RU.KOI8-R export LANG=ru_RU.KOI8-R