Commit graph

31 commits

Author SHA1 Message Date
Anders Jenbo
3b229a8275 Check for translation in the same place as they are loaded from 2021-10-24 16:03:26 +02:00
Gleb Mazovetskiy
3448eab2d3 Translations: Restore support for ".mo" files
Note that they now need to go into the "assets/" subdirectory of the
build directory.
2021-10-23 20:04:34 +02:00
Gleb Mazovetskiy
5e675dcd6a Handle translations like other assets
Load translations from the MPQ or the assets directory, same as we do
with other DevilutionX assets.
2021-10-23 20:04:34 +02:00
Anders Jenbo
f77d0b3665 Close translation-file handler 2021-10-20 21:52:59 +02:00
Anders Jenbo
d88a8f401f Fix parsing of translation file header 2021-10-17 05:50:24 +02:00
Anders Jenbo
dd5ec18ca7 Remove dead code from translation parser 2021-10-17 05:50:24 +02:00
Anders Jenbo
af046864de Properly handle plural forms for Czech and Polish 2021-10-16 17:53:43 +02:00
Anders Jenbo
704a04ae4d Add support for Unicode fonts 2021-09-24 03:03:58 +02:00
Anders Jenbo
671fdbd125 Implement contextural translation (pgettext)
Fixes #2369
Fixes #2790
2021-09-20 04:18:35 +02:00
Anders Jenbo
370e573209 Prefer test versions of translations 2021-08-08 21:58:05 +02:00
Ivan Epifanov
cf5ab583d5 Open translations as read-only 2021-08-08 16:17:27 +02:00
Anders Jenbo
d523fc1e81 Cleanups 2021-08-02 10:12:40 +02:00
Anders Jenbo
01f66d7f73 [android] Implement loading translations from assets 2021-08-01 12:35:24 +02:00
Anders Jenbo
5c2a559487 Get default langauge 2021-08-01 12:35:24 +02:00
Anders Jenbo
372b1dcba2 Clang-tidy: readability-identifier-naming.MemberCase: camelBack 2021-07-03 17:26:29 -07:00
Gleb Mazovetskiy
6a27b37d62 Windows: Handle Unicode paths in language.cpp 2021-05-10 12:35:37 +02:00
Anders Jenbo
3f891a4333 🌐 Correctly handle two more plural translation 2021-05-02 23:33:50 +02:00
Gleb Mazovetskiy
f33f7ae7eb 💨 Do not zero-initalize arrays we write to
`std::make_unique<T[]>(size)` always zero-initalizes the array.

C++20 has `std::make_unique_for_overwrite` to avoid that, while
older C++ versions can use the approach applied here.
2021-05-02 05:52:11 +02:00
Anders Jenbo
b177f77d21 🎨 Cleanup language.cpp 2021-05-02 05:22:42 +02:00
Anders Jenbo
18f3a0c5ea Support for plural forms in translations
The implementation isn't robust, dynamic or pretty, but works for now.
2021-05-01 19:27:55 +02:00
Anders Jenbo
34eecd6dac 🐛 Fix handeling of mo-file header 2021-04-30 21:20:58 +02:00
Gleb Mazovetskiy
979bedb8c2 🐞 Fix memory leaks in utils/language.{h,cpp}
This is a minimal refactoring to fix the memory leaks which have made
reading debug output impossible.
2021-04-30 14:16:13 +02:00
Gleb Mazovetskiy
c025bf6050 🎨 Fix line endings in utils/language.{h,cpp} 2021-04-30 14:16:13 +02:00
Anders Jenbo
e3526a5ff6 🌐 Convert all src to UTF8 2021-04-28 01:58:00 +02:00
Jmgr
d4f62870b8 Remove globals from paths.h
Fix for Vita

Update to use free functions

Use std::optional to allow setting empty paths

Change header inclusion order

Co-authored-by: Gleb Mazovetskiy <glex.spb@gmail.com>

Use std::optional to allow setting empty paths

Apply clang-format

Temporary commit
2021-04-25 22:26:37 +02:00
John Törnblom
102ee9ead1 convert utf8 language strings to latin1 2021-04-25 12:42:00 +02:00
John Törnblom
30db9e7dd0 trim strings from language metadata 2021-04-25 12:42:00 +02:00
John Törnblom
9c61baea9f parse translation metadata 2021-04-25 12:42:00 +02:00
John Törnblom
0be36898b9 ensure translations are null-terminated 2021-04-25 12:42:00 +02:00
Anders Jenbo
32117dc73b 🔧 Create translation template and update translations 2021-04-25 04:56:15 +02:00
John Törnblom
51e7a169a6 add initial language support using a simple MO parser 2021-04-25 03:40:45 +02:00