BlinkTagInc / gtfs-to-html

Build human readable transit timetables as HTML or PDF from GTFS.
https://gtfstohtml.com
MIT License
180 stars 57 forks source link

[Suggestion] Multi-language support #140

Open brodyFlannigan opened 2 years ago

brodyFlannigan commented 2 years ago

It would be really great if GTFS-to-HTML could generate timetables in many languages. (I.e. 1 HTML/PDF/CSV file per language) using a combination of the translations.txt file in GTFS and some sort of translation mechanism for the static strings in the templates using a JSON file containing the strings for each language or something like that. One would probably have to create a field in timetables.txt to specify the default language for the timetable.

brendannee commented 2 years ago

Great idea.

Do you have a GTFS file as an example which has translations.txt which supports more than one additional language?

One way to make this work would be to add a parameter to config.json locale which would be the language code to use use. If someone wanted to generate multiple versions in different languages, you could use multiple config.json files (since you might want different date formats)

Additionally, the text inserted by GTFS-to-HTML would need translations which can be done in a similar way to how we've handled it in the transit arrivals widget library: https://github.com/BlinkTagInc/transit-arrivals-widget/tree/master/locales (using .json files with all of the strings translated).

brodyFlannigan commented 2 years ago

I'll take a look at translations in the transit arrivals widget. It sounds like how I was envisioning a translation mechanism.

The GTFS file I am using is the Transcollines file, with only one extra language (github.com/transcollines/GTFS).

Thanks

On Tue, Apr 12, 2022 at 4:42 PM Brendan Nee @.***> wrote:

Great idea.

Do you have a GTFS file as an example which has translations.txt which supports more than one additional language?

One way to make this work would be to add a parameter to config.json locale which would be the language code to use use. If someone wanted to generate multiple versions in different languages, you could use multiple config.json files (since you might want different date formats)

Additionally, the text inserted by GTFS-to-HTML would need translations which can be done in a similar way to how we've handled it in the transit arrivals widget library: https://github.com/BlinkTagInc/transit-arrivals-widget/tree/master/locales (using .json files with all of the strings translated).

— Reply to this email directly, view it on GitHub https://github.com/BlinkTagInc/gtfs-to-html/issues/140#issuecomment-1097197461, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDT5V4HAWCMQWKDH7CTOKTVEXN35ANCNFSM5S67ZRLA . You are receiving this because you authored the thread.Message ID: @.***>

brendannee commented 2 years ago

When using GTFS-to-HTML with transcollines, are you using the default template or have you created a custom template?

brodyFlannigan commented 2 years ago

I currently have a custom template that is based on the default template. However, we are in the process of a website renewal which will involve me creating a new template from the default template. The current custom template is quite messy.

On Tue, Apr 12, 2022 at 5:02 PM Brendan Nee @.***> wrote:

When using GTFS-to-HTML with transcollines, are you using the default template or have you created a custom template?

— Reply to this email directly, view it on GitHub https://github.com/BlinkTagInc/gtfs-to-html/issues/140#issuecomment-1097213368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDT5V3DM6WWELAXNZGRPDTVEXQEZANCNFSM5S67ZRLA . You are receiving this because you authored the thread.Message ID: @.***>

brendannee commented 2 years ago

That sounds like a good test case for implementing translations. If you use a custom template, then you'd also need custom locale .json files to match all of the text used across your custom template if it differs at all from the default template.

If I work on implementing locale json files for the default template, can you provide quality French translations for it? That would be a good start in implementing multilingual support.

brodyFlannigan commented 2 years ago

I would be more than happy to provide translations.

On Wed, Apr 13, 2022 at 14:20 Brendan Nee @.***> wrote:

That sounds like a good test case for implementing translations. If you use a custom template, then you'd also need custom locale .json files to match all of the text used across your custom template if it differs at all from the default template.

If I work on implementing locale json files for the default template, can you provide quality French translations for it? That would be a good start in implementing multilingual support.

— Reply to this email directly, view it on GitHub https://github.com/BlinkTagInc/gtfs-to-html/issues/140#issuecomment-1098349251, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDT5VZUK4PF22PX6LEK36LVE4F43ANCNFSM5S67ZRLA . You are receiving this because you authored the thread.Message ID: @.***>