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

We need more templates #2041

Open
zoumingzhe opened this issue Apr 16, 2024 · 3 comments
Open

We need more templates #2041

zoumingzhe opened this issue Apr 16, 2024 · 3 comments

Comments

@zoumingzhe
Copy link
Contributor

I am working on making Gollum support Chinese, but I have found that some pages do not have templates, so these pages are temporarily unable to support multiple languages.

image
image

@benjaminwil
Copy link
Member

benjaminwil commented Apr 16, 2024

Hi there! This is true, and I will add that not all templates have been prepared for localization yet. You will encounter other pages that are missing calls to {{t.example_translation_key}} and instead have hard-coded English.

I have (very) slowly been working on this. If you feel up to helping with this, here is an example of a commit that prepares one of the view templates for localization: 2c32bb8

Edit: Oops! I see you have already done this in your pull request. Thank you!!! 😄

@benjaminwil
Copy link
Member

but I have found that some pages do not have templates

The modal windows that you have taken screenshots of ("Create New Page", "Rename to") are built in JavaScript.

Because the JavaScript file is an ERB template (lib/gollum/public/gollum/javascript/gollum.js.erb) we should be able to access the translation strings via the Precious::Views::LocaleHelpers#tt method:

      $.GollumDialog.init({
-       title: 'Create New Page',
+       title: '<%= tt["insert"]["the"]["correct"]["nested"]["translation_key"] %>',
        fields: [
          {
            id:   'name',
-           name: 'Page Name',
+           name: '<%= tt["another"]["translation"]["key"] %>',
            type: 'text',
            defaultValue: '',
            context: context_blurb
          }
        ],

I haven't manually tested this change--it's possible that #tt is not available from this file and we will have to reference it in its namespace or require LocaleHelpers module explicitly.

@zoumingzhe
Copy link
Contributor Author

Because the JavaScript file is an ERB template (lib/gollum/public/gollum/javascript/gollum.js.erb) we should be able to access the translation strings via the Precious::Views::LocaleHelpers#tt method:

To be honest, I don't know much about JavaScript. But I think if the text in the page is uniformly defined, we can make localized replacements.

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

No branches or pull requests

2 participants