|
8 | 8 | import MoonIcon from '@components/icons/moon-icon.svelte';
|
9 | 9 | import { onMount } from 'svelte';
|
10 | 10 |
|
| 11 | + import { getI18n } from '@i18n/index'; |
| 12 | +
|
11 | 13 | let current = '';
|
12 | 14 | let scrollY = 0;
|
13 | 15 | let darkThemeName = 'dark-theme'; // nombre de la clase para el tema oscuro
|
14 | 16 | let isDarkTheme = false; // indicador del estado del tema
|
| 17 | + let home, about, skills, portfolio, contact; |
| 18 | + let theme = { |
| 19 | + dark: 'dark-theme', |
| 20 | + light: 'light-theme', |
| 21 | + }; |
15 | 22 |
|
16 | 23 | onMount(() => {
|
17 | 24 | isDarkTheme = document.body.classList.contains(darkThemeName);
|
| 25 | + let language = document.documentElement.lang; |
| 26 | + const i18n = getI18n({ currentLocale: language }); |
| 27 | + home = i18n.HERO_SECTION.TITLE_NAV; |
| 28 | + about = i18n.ABOUT_SECTION.TITLE; |
| 29 | + skills = i18n.SKILLS_SECTION.TITLE; |
| 30 | + portfolio = i18n.PORTFOLIO_SECTION.TITLE; |
| 31 | + contact = i18n.CONTACT_SECTION.TITLE; |
| 32 | + theme = { |
| 33 | + dark: i18n.THEME.DARK_THEME, |
| 34 | + light: i18n.THEME.LIGHT_THEME, |
| 35 | + }; |
18 | 36 | window.addEventListener('scroll', handleScroll);
|
19 | 37 | return () => {
|
20 | 38 | window.removeEventListener('scroll', handleScroll);
|
|
54 | 72 | <li class="home active">
|
55 | 73 | <a href="#home" aria-label="Home section">
|
56 | 74 | <HomeIcon />
|
57 |
| - <span class="title">Home</span> |
| 75 | + <span class="title"> {home} </span> |
58 | 76 | </a>
|
59 | 77 | </li>
|
60 | 78 | <li class="about">
|
61 | 79 | <a href="#about" aria-label="About section">
|
62 | 80 | <UserIcon />
|
63 |
| - <span class="title">About me</span> |
| 81 | + <span class="title">{about}</span> |
64 | 82 | </a>
|
65 | 83 | </li>
|
66 | 84 | <li class="skills">
|
67 | 85 | <a href="#skills" aria-label="Skills section">
|
68 | 86 | <WrenchIcon />
|
69 |
| - <span class="title">My skills</span> |
| 87 | + <span class="title">{skills}</span> |
70 | 88 | </a>
|
71 | 89 | </li>
|
72 | 90 | <li class="portfolio">
|
73 | 91 | <a href="#portfolio" aria-label="Portfolio section">
|
74 | 92 | <BriefcaseIcon />
|
75 |
| - <span class="title">My portfolio</span> |
| 93 | + <span class="title">{portfolio}</span> |
76 | 94 | </a>
|
77 | 95 | </li>
|
78 | 96 | <li class="contact">
|
79 | 97 | <a href="#contact" aria-label="Contact section">
|
80 | 98 | <EnvelopeIcon />
|
81 |
| - <span class="title">Contact me</span> |
| 99 | + <span class="title">{contact}</span> |
82 | 100 | </a>
|
83 | 101 | </li>
|
84 | 102 | <li class="divisor">
|
|
89 | 107 | <a on:click={setTheme} aria-label="Change theme">
|
90 | 108 | {#if isDarkTheme}
|
91 | 109 | <SunIcon />
|
92 |
| - <span class="title">Light theme</span> |
| 110 | + <span class="title">{theme.light}</span> |
93 | 111 | {:else}
|
94 | 112 | <MoonIcon />
|
95 |
| - <span class="title">Dark theme</span> |
| 113 | + <span class="title">{theme.dark}</span> |
96 | 114 | {/if}
|
97 | 115 | </a>
|
98 | 116 | </li>
|
|
112 | 130 | transform: translate(-50%, -50%);
|
113 | 131 | }
|
114 | 132 |
|
115 |
| - nav ul.nav li a fa-icon { |
116 |
| - font-size: 12px; |
117 |
| - } |
118 |
| -
|
119 | 133 | nav ul.nav {
|
120 | 134 | padding: 0.6rem;
|
121 | 135 | display: flex;
|
|
0 commit comments