I haven’t done translations before, however - my understanding is that…
All translations are supplied via https://www.transifex.com/discourse/discourse-org/
This at some point then is migrated into client and server files in the Discourse repo where the English versions are these:
discourse/config/locales/client.en.yml at main · discourse/discourse · GitHub
discourse/config/locales/server.en.yml at main · discourse/discourse · GitHub
This topic covers this in more detail:
So you’d like to help us translate Discourse into other languages? Great! Let’s get started.
Translating
Translators do all their work in the Crowdin workspace . Create an account at Crowdin and start translating one or more languages. You’ll be notified when there are new strings that need to be translated, and get emails when there are announcements.
After contributing translations to the Crowdin projects, there’s nothing more to do. The translations will automatically be pulled into various…
Note that there is a whole dates section in each of these files which comes from Transiflex:
long_with_year: "MMM D, YYYY h:mm a"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
long_with_year_no_time: "MMM D, YYYY"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
full_with_year_no_time: "MMMM Do, YYYY"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
long_date_with_year: "MMM D, YYYY LT"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
long_date_without_year: "MMM D, LT"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
long_date_with_year_without_time: "MMM D, YYYY"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
long_date_without_year_with_linebreak: "MMM D <br/>LT"
# Use Moment.js format string: https://momentjs.com/docs/#/displaying/format/
long_date_with_year_with_linebreak: "MMM D, YYYY <br/>LT"
wrap_ago: "%{date} ago"
wrap_on: "on %{date}"
tiny:
This file has been truncated. show original
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
long: "%B %-d, %Y, %l:%M%P"
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
no_day: "%B %Y"
# Format directives: https://ruby-doc.org/core/Time.html#method-i-strftime
calendar_ics: "%Y%m%dT%H%M%SZ"
date:
# Do not remove the brackets and commas and do not translate the first month name. It should be "null".
month_names:
[
~,
January,
February,
March,
April,
May,
June,
July,
August,
September,
This file has been truncated. show original
Again hopefully someone with more knowledge will correct me if wrong…
As I see it you should submit the "jYYYY etc translations to https://www.transifex.com/discourse/discourse-org/
Moment.js will then be called with the right “jYYYY” etc instead of “YYYY”
Then you need to submit two extra code patches / Pull Requests to Discourse to add and call the extra libraries as needed:
One Pull Request to add and load moment-jalaali if, an only if “jYYYY” etc are used.
2nd Pull Request for handling any dates etc which are handled via Ruby.
Following the translation and then first pull request should get you most of the way there.
One of the Discourse team will read this at some point (they read everything here) and may comment on if this is acceptable or if they have a better idea for a way forward.
6 Likes