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

internationalization (i18n) / multiple language support #338

Open
meichthys opened this issue Aug 13, 2024 Discussed in #240 · 5 comments
Open

internationalization (i18n) / multiple language support #338

meichthys opened this issue Aug 13, 2024 Discussed in #240 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@meichthys
Copy link

Discussed in https://github.com/orgs/TriliumNext/discussions/240

Originally posted by eliandoran July 18, 2024
One of the core aspects of Trilium that is missing is the fact that it is an English-only software.

There are solutions such as @Nriver 's repo which work by replacing the hard-coded messages within the application via regular expressions.

Speaking of which, @Nriver , would you be willing to help us with setting up Chinese for the application?

On my side I would prefer a different method which involves adding multilanguage support directly in the application instead of doing it at build time, however your existing expertise plus translations would go a long way.

What do you think?

@meichthys meichthys added the enhancement New feature or request label Aug 13, 2024
@meichthys meichthys mentioned this issue Aug 13, 2024
@JYC333
Copy link

JYC333 commented Aug 13, 2024

Language switcher is merged actually. #330
And there is already one PR merged regarding Chinese translation, not sure whether all messages are translated. #264

@Nriver
Copy link
Member

Nriver commented Aug 14, 2024

About 60% has been translated.

@hasecilu
Copy link

On #349 I made an initial step to have Spanish translation, I'll be happy to test next beta release and find potential fixes on strings.

@hasecilu
Copy link

hasecilu commented Aug 16, 2024

To help on the translation for new languages I made a small script to use trans command from translate-shell package.
Now most of the work is to review translations are good and fix bad translations.

Edit: the previous version perfomed substitutions, even in the tags which caused some problems 😰 . This new version instead of making string substitution it recreates the line using the translation.

#!/usr/bin/env bash

INPUT_FILE=en.json
OUTPUT_FILE=es.json

while IFS= read -r line; do
	# Extract the string between ': "' and '"'
	extracted_string=$(echo "$line" | awk -F'": "' '{split($2, a, "\""); print a[1]}')
	# Extract the tag (string before ':')
	tag="${line%%:*}"

	if [ -z "$extracted_string" ]; then
		output_line="$line"
	else
		translated_string=$(trans :es --brief "$extracted_string")
		# NOTE: you need to remove extra commas on some lines
		output_line="${tag}: \"${translated_string}\","
	fi
	echo "$output_line" >>"$OUTPUT_FILE"
done <"$INPUT_FILE"

@hasecilu
Copy link

tracking: #342 #426 #448 #449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants