Closed jbrooksuk closed 5 months ago
What are you're thoughts on using https://crowdin.com/ to manage translations?
Really excited this project is back btw. Happy to help contribute.
Yep, we previously used CrowdIn and I think we'll continue to do so.
We'll also want to make sure the frontend is translated in the dashboard too.
For my own memory, I wrote this quick Python script to pull all strings within __
and print them out in a JSON object:
import re
import os
import json
def find_translation_strings(directories, file_extensions):
translation_strings = {}
regex_pattern = re.compile(r"__\('(.+?)'\)")
for directory in directories:
for root, dirs, files in os.walk(directory):
for file in files:
if any(file.endswith(ext) for ext in file_extensions):
with open(os.path.join(root, file), 'r') as f:
content = f.read()
matches = regex_pattern.findall(content)
for match in matches:
translation_strings[match] = match
sorted_translation_strings = dict(sorted(translation_strings.items()))
return json.dumps(sorted_translation_strings, indent=4)
directories = ['src', 'resources/views']
file_extensions = ['.php', '.blade.php']
translation_strings = find_translation_strings(directories, file_extensions)
print(translation_strings)
We need to provide any static strings as a translation file.
I'm quite keen on the idea of this package only containing the English US translations, then having other packages which can be installed to provide additional languages. Are there any objections to this?