Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.

Make the "Run query" button translatable#59

Merged
Ladsgroup merged 2 commits into
masterfrom
i18n
Nov 18, 2020
Merged

Make the "Run query" button translatable#59
Ladsgroup merged 2 commits into
masterfrom
i18n

Conversation

@Ladsgroup
Copy link
Copy Markdown
Contributor

This lays the groundwork for i18n using vue-banana-i18n

Basically, having the i18n files exposed as public files and downloading
them when building the application and showing the results once it's
there.

Bug: T267730

@micgro42
Copy link
Copy Markdown
Collaborator

Looks like a good approach in principle. It needs some more polishing (using async/await, missing newlines at the end of file, etc.).

I think the biggest draw-back is the missing fallback for incomplete translations, but we can implement that when it is requested, which is likely to be soon.

Also, but probably at a later date, this will need some extra config for when we are not running at the root of a domain but at www.example.org/query-builder/...

Comment thread src/App.vue
Comment thread src/App.vue
Comment thread public/i18n/en.json Outdated
Copy link
Copy Markdown
Contributor

@bereket-WMDE bereket-WMDE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the spirit of moving things along, I'd approve this PR.
just fix up the missing "no new line at the end of file" warnings.
we should keep @micgro42 suggestions in mind, though.

Comment thread public/i18n/qqq.json Outdated
@@ -0,0 +1,3 @@
{
"query-builder-run-query": "Text on the button that runs the query"
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing new-line at the end of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread public/i18n/en.json Outdated
@@ -0,0 +1,3 @@
{
"query-builder-run-query": "Run query"
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing new-line at the end of file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread src/App.vue Outdated
},
beforeCreate(): void {
fetch( 'i18n/en.json' )
.then( function ( response ) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should use async/await instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread src/App.vue Outdated
messages,
} );
// TODO: Fix the typing warning
( this as any ).isi18nLoaded = true;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This typing problem might already go away when we use async/await 🤞

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't :(

This lays the groundwork for i18n using vue-banana-i18n

Basically, having the i18n files exposed as public files and downloading
them when building the application and showing the results once it's
there.

Bug: T267730
Copy link
Copy Markdown
Collaborator

@micgro42 micgro42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! We'll figure they types out later

@Ladsgroup Ladsgroup merged commit cab8233 into master Nov 18, 2020
@Ladsgroup Ladsgroup deleted the i18n branch November 18, 2020 16:11
@Ladsgroup
Copy link
Copy Markdown
Contributor Author

Thanks! We'll figure they types out later

This seems to happen a lot (google says so, one way to fix it is that you need set the return type of all methods but we did that already). Here's an example: vuejs/vetur#2131

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants