Skip to content

add banner for non-english versions#381

Merged
PeterPetrik merged 4 commits into
mainfrom
i18n
Nov 14, 2023
Merged

add banner for non-english versions#381
PeterPetrik merged 4 commits into
mainfrom
i18n

Conversation

@PeterPetrik
Copy link
Copy Markdown
Contributor

We want to try to use Weglot for machine translations of the docs, we place small text for language mutations (e.g. on de.merginmaps.com/docs

fix #133

Screenshot 2023-11-02 at 16 31 02

cc @janpaulovic1 @mostlyAtNight

@PeterPetrik PeterPetrik requested a review from MarcelGeo November 2, 2023 15:33
@PeterPetrik
Copy link
Copy Markdown
Contributor Author

@MarcelGeo yarn dev works, but yarn build fails, how it is possible to get hostname in this static context?

[38](https://github.com/MerginMaps/docs/actions/runs/6734785848/job/18306442015#step:5:39)
[Vue warn]: Error in data(): "ReferenceError: window is not defined"
PeterPetrik and others added 2 commits November 2, 2023 16:39
- getting window object after mount to browser
@MarcelGeo
Copy link
Copy Markdown
Contributor

I added targeting window object into mounted lifecycle method, which is called after append to DOM. Build is successfull on my machine . @PeterPetrik can you verify it?

@PeterPetrik
Copy link
Copy Markdown
Contributor Author

PeterPetrik commented Nov 3, 2023

@MarcelGeo it is good, I have created new Weglot project for docs, they said we should insert this code before <head> tag, do you know how to do it?

<script type="text/javascript" src="https://cdn.weglot.com/weglot.min.js"></script>
<script>
    Weglot.initialize({
        api_key: 'wg_793fda6a46586055f8d5df5cc9fa6a270',
        hide_switcher: true
    });
</script>
  • also we may want to add dev.merginmaps.com to the list of hostnames without banner

For general approach I suggest (at least for beginning until we verify the quality of AI translations)
1/ on marketing web merginmaps.com we will have in menu link to ENGLISH version of docs (from ALL languages)
2/ on merginmaps.com/docs ENGLISH version, we will not have language switcher at all
3/ on .merginmaps.com/docs we will have banner that this is machine translated with link to ENGLISH version of the docs.

@MarcelGeo
Copy link
Copy Markdown
Contributor

@MarcelGeo it is good, I have created new Weglot project for docs, they said we should insert this code before <head> tag, do you know how to do it?

<script type="text/javascript" src="https://cdn.weglot.com/weglot.min.js"></script>
<script>
    Weglot.initialize({
        api_key: 'wg_793fda6a46586055f8d5df5cc9fa6a270',
        hide_switcher: true
    });
</script>
* also we may want to add dev.merginmaps.com to the list of hostnames without banner

For general approach I suggest (at least for beginning until we verify the quality of AI translations) 1/ on marketing web merginmaps.com we will have in menu link to ENGLISH version of docs (from ALL languages) 2/ on merginmaps.com/docs ENGLISH version, we will not have language switcher at all 3/ on .merginmaps.com/docs we will have banner that this is machine translated with link to ENGLISH version of the docs.

Do we want to display switcher in dev mode? @PeterPetrik

@PeterPetrik
Copy link
Copy Markdown
Contributor Author

PeterPetrik commented Nov 14, 2023

Do we want to display switcher in dev mode? @PeterPetrik

@MarcelGeo no, I want to just show banner in sidebar on production and non-english version. I do not want to show switcher to other than English language anywhere.

- link to weglot in header
- logic for switching language
- allow translation for banner
@PeterPetrik
Copy link
Copy Markdown
Contributor Author

There is a problem on Weglot side - I have reverted this

@PeterPetrik PeterPetrik mentioned this pull request Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants