Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add i18n support #311

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
12b71c9
Add initial i18n support
smolBlackCat Jun 13, 2024
4e37857
add mention overlay to folders in classic
ouwou May 25, 2024
caa598c
add disconnect button to voice window as Per Special Request
ouwou Jun 1, 2024
93d9751
bump voice window height as Per Special Request
ouwou Jun 1, 2024
2c41072
fix linking curl maybe somehow i guess
ouwou Jun 3, 2024
3c5b960
Correct default setting for hideconsole in README (#303)
5xp Jun 1, 2024
a5ae338
Refactoring: changed user flag enum to enum class (#299)
Skeevert Jun 3, 2024
432dc84
ignore unread state from undisplayed channel types
ouwou Jun 5, 2024
de55603
add new dll (fixes #307)
ouwou Jun 7, 2024
42c99af
build number shenanigans
ouwou Jun 13, 2024
78246f3
Merge branch 'add-i18n-support'
smolBlackCat Jun 13, 2024
e0ef0c8
Add locale folder resolution
smolBlackCat Jun 15, 2024
4a21278
Merge branch 'uowuo:master' into master
smolBlackCat Jun 16, 2024
75e6404
Enhance i18n support
smolBlackCat Jun 16, 2024
7eb61b3
Fix build error and rendering issues on Windows
smolBlackCat Jun 17, 2024
c36df5e
More enhancements to i18n support
smolBlackCat Jun 17, 2024
3fdc523
Fix formatting typos
smolBlackCat Jun 17, 2024
b28d086
Add Brazilian Portuguese Translation
smolBlackCat Jun 17, 2024
b9f167e
Merge branch 'master' into master
smolBlackCat Jun 17, 2024
41f9d91
Update i18n support
smolBlackCat Jun 17, 2024
5ca7f7f
Mark permissions.cpp strings for translation
smolBlackCat Jun 17, 2024
d6710e7
Include locale directory
smolBlackCat Jun 17, 2024
48a8f6a
Include missing dependency on "linux" build job (silly me)
smolBlackCat Jun 24, 2024
d949a9e
Add Mac build workaround
smolBlackCat Jun 24, 2024
32afc62
Merge branch 'master' into master
smolBlackCat Jun 25, 2024
ce84870
guildsettings: Fix formattable error
smolBlackCat Jun 26, 2024
84d82fa
po: Add translation instructions
smolBlackCat Jun 26, 2024
522c254
Fix platform.cpp compile error on MacOS (silly me)
smolBlackCat Jun 26, 2024
01a0879
ci: Add gettext dependency to MacOS build
smolBlackCat Jun 26, 2024
7bbc89c
MacOS failure to load libintl fix
smolBlackCat Jun 26, 2024
612de7a
Revert "ci: Add gettext dependency to MacOS build"
smolBlackCat Jun 26, 2024
069f75d
Update i18n patch
smolBlackCat Jul 10, 2024
f624b02
Merge branch 'master' of https://github.com/smolBlackCat/abaddon
smolBlackCat Jul 10, 2024
52bb66f
Update i18n patch
smolBlackCat Jul 11, 2024
5133095
Merge branch 'uowuo:master' into master
smolBlackCat Sep 22, 2024
564d3e1
remove duplicate submodule
ouwou Sep 1, 2024
d411028
Merge branch 'uowuo:master' into i18n-mac-fix
smolBlackCat Sep 22, 2024
71a72ec
(chore): Utilise actions/upload@v4 due to deprecation
smolBlackCat Sep 22, 2024
3f68804
fix build error due to const qualifier discarding
smolBlackCat Sep 22, 2024
47ffd82
(i18n): Link gettext with absolute path in APPLE systems
smolBlackCat Sep 22, 2024
b7f9e14
(i18n): Use Intl Cmake variables correctly
smolBlackCat Sep 22, 2024
8b9edb0
Merge branch 'i18n-mac-fix'
smolBlackCat Sep 22, 2024
6b62812
(i18n): Replace fmt::format calls with Glib::ustring::compose
smolBlackCat Sep 27, 2024
43fba7f
(i18n): Replace more calls to fmt::format with Glib::ustring::compose
smolBlackCat Sep 27, 2024
9bc6bb0
(i18n): Replace calls to fmt::format with Glib::ustring::compose
smolBlackCat Oct 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Abaddon CI

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
msys2:
name: msys2-mingw64
runs-on: windows-latest
strategy:
matrix:
buildtype: [ Debug, RelWithDebInfo, MinSizeRel ]
mindeps: [ false ]
buildtype: [Debug, RelWithDebInfo, MinSizeRel]
mindeps: [false]
include:
- buildtype: RelWithDebInfo
mindeps: true
Expand Down Expand Up @@ -84,6 +84,7 @@ jobs:
mkdir -p ${artifact_dir}/bin ${artifact_dir}/etc/ssl/certs ${artifact_dir}/lib ${artifact_dir}/share/glib-2.0/schemas
cd build
cp *.exe ../${artifact_dir}/bin
cp -r ./locale/ ../${artifact_dir}/bin
cd ..
cp /mingw64/etc/ssl/certs/ca-bundle.crt ${artifact_dir}/etc/ssl/certs
cp -r /mingw64/lib/gdk-pixbuf-2.0 ${artifact_dir}/lib
Expand Down Expand Up @@ -122,7 +123,7 @@ jobs:
if_false: "${{ matrix.buildtype }}"

- name: Upload build (2)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-windows-msys2-${{ steps.buildname.outputs.value }}
path: build/artifactdir
Expand All @@ -132,7 +133,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
buildtype: [ Debug, RelWithDebInfo ]
buildtype: [Debug, RelWithDebInfo]
steps:
- uses: actions/checkout@v1
with:
Expand Down Expand Up @@ -167,7 +168,7 @@ jobs:
cp -r "${{ github.workspace }}/res/res" "${artifact_dir}/res"

- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-macos-${{ matrix.buildtype }}
path: build/artifactdir
Expand All @@ -177,7 +178,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
buildtype: [ Debug, RelWithDebInfo, MinSizeRel ]
buildtype: [Debug, RelWithDebInfo, MinSizeRel]
steps:
- uses: actions/checkout@v1
with:
Expand All @@ -199,6 +200,7 @@ jobs:
cmake ..
make
sudo make install
sudo apt-get install gettext
sudo apt-get install libgtkmm-3.0-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libopus-dev
Expand All @@ -221,11 +223,12 @@ jobs:
artifact_dir=${{ runner.workspace }}/artifactdir/abaddon-${{ matrix.buildtype }}-${GITHUB_SHA::7}
mkdir -p "${artifact_dir}"
cp "${{runner.workspace}}/build/abaddon" "${artifact_dir}/abaddon"
cp -r "${{runner.workspace}}/build/locale" "${artifact_dir}/locale"
cp -r "${{ github.workspace }}/res/css" "${artifact_dir}/css"
cp -r "${{ github.workspace }}/res/res" "${artifact_dir}/res"

- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-linux-${{ matrix.buildtype }}
path: ${{ runner.workspace }}/artifactdir
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ find_package(CURL)
find_package(ZLIB REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(gtkmm REQUIRED)
find_package(Intl REQUIRED)

set(USE_TLS TRUE)
set(USE_OPEN_SSL TRUE)
Expand Down Expand Up @@ -56,6 +57,9 @@ target_include_directories(abaddon PUBLIC ${GTKMM_INCLUDE_DIRS})
target_include_directories(abaddon PUBLIC ${ZLIB_INCLUDE_DIRS})
target_include_directories(abaddon PUBLIC ${SQLite3_INCLUDE_DIRS})
target_include_directories(abaddon PUBLIC ${NLOHMANN_JSON_INCLUDE_DIRS})
target_include_directories(abaddon PUBLIC ${Intl_INCLUDE_DIRS})

add_subdirectory(po)

if (ENABLE_QRCODE_LOGIN)
add_library(qrcodegen subprojects/qrcodegen/cpp/qrcodegen.hpp subprojects/qrcodegen/cpp/qrcodegen.cpp)
Expand Down Expand Up @@ -119,6 +123,10 @@ target_link_libraries(abaddon ${ZLIB_LIBRARY})
target_link_libraries(abaddon ${NLOHMANN_JSON_LIBRARIES})
target_link_libraries(abaddon ${CMAKE_DL_LIBS})

if (MINGW OR APPLE)
target_link_libraries(abaddon ${Intl_LIBRARIES})
endif()

target_link_libraries(abaddon CURL::libcurl)

include(CheckAtomic)
Expand Down
37 changes: 37 additions & 0 deletions po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
find_program(MSGMERGE msgmerge REQUIRED)
find_program(MSGFMT msgfmt REQUIRED)

set(POT_FILENAME ${CMAKE_CURRENT_SOURCE_DIR}/abaddon.pot)
set(MO_FILENAME abaddon.mo)
set(LOCALE_DIRECTORY ${PROJECT_BINARY_DIR}/locale)

list(APPEND PO_NAMES pt_BR)

foreach(PO_NAME IN LISTS PO_NAMES)
list(APPEND PO_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/${PO_NAME}.po)
endforeach()

# Updates all the translation
foreach(PO_SOURCE PO_NAME IN ZIP_LISTS PO_SOURCES PO_NAMES)
add_custom_target("update-${PO_NAME}" DEPENDS ${PO_SOURCE})
add_custom_command(
TARGET "update-${PO_NAME}" PRE_BUILD
COMMAND ${MSGMERGE} -U -N ${PO_SOURCE} ${POT_FILENAME}
DEPENDS ${POT_FILENAME}
)
add_dependencies(abaddon "update-${PO_NAME}")
endforeach()

# Compiles all the translation files onto locales directory
foreach(PO_SOURCE PO_NAME IN ZIP_LISTS PO_SOURCES PO_NAMES)
file(MAKE_DIRECTORY ${LOCALE_DIRECTORY}/${PO_NAME}/LC_MESSAGES/)
add_custom_command(
OUTPUT ${LOCALE_DIRECTORY}/${PO_NAME}/LC_MESSAGES/${MO_FILENAME}
COMMAND ${MSGFMT} --output-file=${LOCALE_DIRECTORY}/${PO_NAME}/LC_MESSAGES/${MO_FILENAME}
${PO_SOURCE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${PO_SOURCE}
)
add_custom_target("compile-${PO_NAME}" DEPENDS ${LOCALE_DIRECTORY}/${PO_NAME}/LC_MESSAGES/${MO_FILENAME})
add_dependencies(abaddon "compile-${PO_NAME}")
endforeach()
34 changes: 34 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
src/abaddon.cpp
src/startup.cpp
src/discord/permissions.cpp
src/dialogs/confirm.cpp
src/dialogs/friendpicker.cpp
src/dialogs/setstatus.cpp
src/dialogs/textinput.cpp
src/dialogs/token.cpp
src/dialogs/verificationgate.cpp
src/components/chatinput.cpp
src/components/chatinputindicator.cpp
src/components/chatlist.cpp
src/components/chatmessage.cpp
src/components/chatwindow.cpp
src/components/friendslist.cpp
src/components/ratelimitindicator.cpp
src/components/voiceinfobox.cpp
src/components/channellist/channellisttree.cpp
src/windows/guildsettingswindow.cpp
src/windows/mainwindow.cpp
src/windows/pinnedwindow.cpp
src/windows/profilewindow.cpp
src/windows/threadswindow.cpp
src/windows/voicesettingswindow.cpp
src/windows/profile/mutualguildspane.cpp
src/windows/profile/userinfopane.cpp
src/windows/guildsettings/auditlogpane.cpp
src/windows/guildsettings/banspane.cpp
src/windows/guildsettings/emojispane.cpp
src/windows/guildsettings/infopane.cpp
src/windows/guildsettings/invitespane.cpp
src/windows/guildsettings/memberspane.cpp
src/windows/guildsettings/rolespane.cpp
src/windows/voice/voicewindow.cpp
46 changes: 46 additions & 0 deletions po/TRANSLATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Working with translations

Translators must first ensure that the tools coming with the gettext package are
installed. If that's not the case install it using your package manager.

```sh
# On Debian/Ubuntu systems. Use your package manager
sudo apt install gettext
```

## Adding new translation files

Adding new translation files is as easy as issuing a command. In the command
below, replace `LL_CC` for the country code you are translating the project to
and set an appropriate encoding to the country code.

```sh
msginit -i po/abaddon.pot -o po/LL_CC.po --locale LL_CC[.ENCODING]
```

After that, you'll have to append the country code to `PO_NAMES` variable in
[CMakeLists.txt](CMakeLists.txt), build file responsible for compiling and
updating the translations.

```cmake
# Insert the country code in alphabetical order.
# Replace LL_CC for the country code
list(APPEND PO_NAMES pt_BR LL_CC)
```

Then, compile the translation file by simply issuing the build command within
the build directory. Doing this won't only compile but it'll also update the .po
file in case there is any modification made to abaddon.pot.

```sh
cmake --build build-dir/
```

To ensure that everything is in place, run the program with `LANGUAGE`
environment variable set to the country code you are providing a translation
for:

```sh
# This snippet assumes that the current directory is the build directory
LANGUAGE=pt_BR ./abaddon
```
Loading