Fixed translations
This commit is contained in:
parent
8eaed92a75
commit
5c51f86a44
3
.env
3
.env
@ -1 +1,2 @@
|
||||
PWD="~/Developer/repos/blanco-lorenzo/bl-frontend"
|
||||
OUT_DIR="/Users/franklinblanco/developer/repos/blanco-lorenzo/bl-frontend"
|
||||
CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true
|
287
Cargo.lock
generated
287
Cargo.lock
generated
@ -2,6 +2,15 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.1"
|
||||
@ -20,12 +29,38 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
||||
|
||||
[[package]]
|
||||
name = "anymap2"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
@ -47,14 +82,21 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bl-frontend"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"js-sys",
|
||||
"locales",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rust-i18n",
|
||||
"stdweb",
|
||||
"stylist",
|
||||
"thousands",
|
||||
@ -72,6 +114,16 @@ version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.12.1"
|
||||
@ -105,6 +157,21 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"strsim",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.11.1"
|
||||
@ -196,6 +263,12 @@ dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.1.0"
|
||||
@ -288,6 +361,19 @@ version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
|
||||
dependencies = [
|
||||
"aho-corasick 0.7.20",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo"
|
||||
version = "0.8.0"
|
||||
@ -462,6 +548,15 @@ version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.2.6"
|
||||
@ -495,6 +590,23 @@ dependencies = [
|
||||
"cxx-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ignore"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
|
||||
dependencies = [
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex",
|
||||
"same-file",
|
||||
"thread_local",
|
||||
"walkdir",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "implicit-clone"
|
||||
version = "0.3.5"
|
||||
@ -571,6 +683,12 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
version = "0.3.0"
|
||||
@ -580,20 +698,6 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "locales"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dcd3cb0fc27c404aba0192047de8b9e65078d3e8bbbde6fd35722af14b2b76b"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"lazy_static",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
@ -650,7 +754,7 @@ version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"hermit-abi 0.2.6",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@ -784,7 +888,7 @@ version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"aho-corasick 1.0.1",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
@ -801,6 +905,75 @@ version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746"
|
||||
|
||||
[[package]]
|
||||
name = "rust-i18n"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3dcb86b090a450cb642b6a465f0e9a3d4be26bdb9d8795a2a49fb02601b370f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
"glob",
|
||||
"itertools",
|
||||
"once_cell",
|
||||
"quote",
|
||||
"regex",
|
||||
"rust-i18n-extract",
|
||||
"rust-i18n-macro",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-i18n-extract"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec44568e2cdf4bfb7a62381bbc6fcdf0a27c60cd503dfa12c59e6c17cf3177fa"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ignore",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rust-i18n-support",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-i18n-macro"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e7e3e8f27d472822c5cf092a22631ebc667d9f8dc89dfc50ef4e87f4ebdf92f"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rust-i18n-support",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rust-i18n-support"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e6bbf2d058c3558bef952564ceb9afcb19631cde22b47dc44f436e62ecfb916"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
@ -822,6 +995,15 @@ version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scratch"
|
||||
version = "1.0.5"
|
||||
@ -897,6 +1079,18 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.8.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"ryu",
|
||||
"serde",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.6.1"
|
||||
@ -972,6 +1166,12 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "stylist"
|
||||
version = "0.12.0"
|
||||
@ -1049,6 +1249,15 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.40"
|
||||
@ -1075,6 +1284,16 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.45"
|
||||
@ -1108,6 +1327,15 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.38"
|
||||
@ -1151,12 +1379,28 @@ version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
@ -1356,6 +1600,15 @@ version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
|
||||
dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yew"
|
||||
version = "0.20.0"
|
||||
|
@ -23,4 +23,5 @@ js-sys = "0.3"
|
||||
thousands = "0.2.0"
|
||||
chrono = "0.4.23"
|
||||
log = "0.4"
|
||||
locales = "0.1.0"
|
||||
once_cell = "1.10.0"
|
||||
rust-i18n = "1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
.language-picker-container {
|
||||
position: fixed;
|
||||
left: 0px;
|
||||
top: 10vh;
|
||||
top: 100px;
|
||||
|
||||
background-color: #d8d6d6;
|
||||
border: 0.5px solid #9D9D9D;
|
||||
@ -28,4 +28,9 @@
|
||||
}
|
||||
.language-picker-selected-language-display:hover {
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
.language-picker-selected-language-display::selection {
|
||||
user-select: none;
|
||||
|
||||
}
|
20
locales/en.yml
Normal file
20
locales/en.yml
Normal file
@ -0,0 +1,20 @@
|
||||
navbar:
|
||||
item:
|
||||
home: Home
|
||||
services: Services
|
||||
about-us: About
|
||||
contact-us: Let's work together
|
||||
services-section:
|
||||
title: Our digital marketing expertise
|
||||
start:
|
||||
left-column:
|
||||
title-first-line: Make your business
|
||||
title-second-line: more powerful
|
||||
title-third-line: with us
|
||||
left-column-description: Our experienced team will create a tailored solution to maximize your business potential.
|
||||
left-column-button-text: Get Started >
|
||||
right-column-subject-1-title: >
|
||||
Web Design &
|
||||
Development
|
||||
right-column-subject-2-title: Marketing & Ads
|
||||
|
19
locales/es.yml
Normal file
19
locales/es.yml
Normal file
@ -0,0 +1,19 @@
|
||||
navbar:
|
||||
item:
|
||||
home: Inicio
|
||||
services: Servicios
|
||||
about-us: Sobre Nosotros
|
||||
contact-us: Trabajemos Juntos
|
||||
services-section:
|
||||
title: Nuestro expertise en marketing digital
|
||||
start:
|
||||
left-column:
|
||||
title-first-line: Haz tu negocio
|
||||
title-second-line: mas fuerte
|
||||
title-third-line: con nosotros
|
||||
left-column-description: Desbloquea el poder de tu negocio y alcanza el éxito con nuestros servicios.
|
||||
left-column-button-text: Comencemos >
|
||||
right-column-subject-1-title: >
|
||||
Desarrollo Web &
|
||||
Sistemas
|
||||
right-column-subject-2-title: Mercadeo & Publicidad
|
@ -1,19 +0,0 @@
|
||||
{
|
||||
"navbar.item.home": {
|
||||
"en": "Home",
|
||||
"es": "Inicio"
|
||||
},
|
||||
"navbar.item.services": {
|
||||
"en": "Services",
|
||||
"es": "Servicios"
|
||||
},
|
||||
"navbar.item.about-us": {
|
||||
"en": "About",
|
||||
"es": "Sobre Nosotros"
|
||||
},
|
||||
"navbar.item.contact-us": {
|
||||
"en": "Let's work together",
|
||||
"es": "Trabajemos Juntos"
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"services-section.title" : {
|
||||
"en": "Our digital marketing expertise",
|
||||
"es": "Nuestro expertise en marketing digital"
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"start.left-column.title-first-line": {
|
||||
"en": "Make your business",
|
||||
"es": "Haz tu negocio"
|
||||
},
|
||||
"start.left-column.title-second-line": {
|
||||
"en": "more powerful",
|
||||
"es": "mas fuerte"
|
||||
},
|
||||
"start.left-column.title-third-line": {
|
||||
"en": "with us",
|
||||
"es": "con nosotros"
|
||||
},
|
||||
"start.left-column-description": {
|
||||
"en": "Our experienced team will create a tailored solution to maximize your business potential.",
|
||||
"es": "Desbloquea el poder de tu negocio y alcanza el éxito con nuestros servicios."
|
||||
},
|
||||
"start.left-column-button-text": {
|
||||
"en": "Get Started >",
|
||||
"es": "Comencemos >"
|
||||
},
|
||||
"start.right-column-subject-1-title": {
|
||||
"en": "Web Design &\nDevelopment",
|
||||
"es": "Desarrollo Web & Sistemas"
|
||||
},
|
||||
"start.right-column-subject-2-title": {
|
||||
"en": "Marketing & Ads",
|
||||
"es": "Mercadeo & Publicidad"
|
||||
}
|
||||
}
|
@ -1,19 +1,45 @@
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::language::{ toggle_lang};
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Default, Clone)]
|
||||
pub enum Language {
|
||||
#[default]
|
||||
EnUs,
|
||||
EsDo
|
||||
}
|
||||
impl Language {
|
||||
pub fn locale(&self) -> &'static str {
|
||||
match self {
|
||||
Language::EnUs => "en",
|
||||
Language::EsDo => "es",
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(PartialEq, Properties)]
|
||||
pub struct LanguagePickerProps {
|
||||
pub language: UseStateHandle<Language>
|
||||
}
|
||||
#[function_component(LanguagePicker)]
|
||||
pub fn language_picker() -> Html {
|
||||
pub fn language_picker(props: &LanguagePickerProps) -> Html {
|
||||
let language_handle = props.language.clone();
|
||||
let onclick = {
|
||||
Callback::from(|_|{
|
||||
toggle_lang();
|
||||
let language_handle = language_handle.clone();
|
||||
Callback::from(move |_: MouseEvent|{
|
||||
let new_lang = match (*language_handle).clone() {
|
||||
Language::EnUs => Language::EsDo,
|
||||
Language::EsDo => Language::EnUs,
|
||||
};
|
||||
language_handle.set(new_lang);
|
||||
})
|
||||
};
|
||||
html! {
|
||||
<div class={"language-picker-container"}>
|
||||
<div onclick={onclick} class={"language-picker-selected-language-display"}>
|
||||
{"🇪🇸"}
|
||||
//{"🇺🇸"}
|
||||
{
|
||||
match *language_handle {
|
||||
Language::EnUs => "🇺🇸",
|
||||
Language::EsDo => "🇪🇸",
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
use locales::t;
|
||||
use rust_i18n::t;
|
||||
use stdweb::web::{IEventTarget, event::ResizeEvent};
|
||||
use yew::prelude::*;
|
||||
use yew_router::prelude::{use_navigator, use_route};
|
||||
|
||||
use crate::{routes::main_router::{Route}, language::{current_lang, Language}};
|
||||
use crate::{routes::main_router::{Route}};
|
||||
|
||||
use super::language_picker::Language;
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct NavigationBarProps {
|
||||
@ -12,6 +14,7 @@ pub struct NavigationBarProps {
|
||||
|
||||
#[function_component(NavigationBar)]
|
||||
pub fn navigation_bar(props: &NavigationBarProps) -> Html {
|
||||
let language = &props.language;
|
||||
let current_route: Option<Route> = use_route();
|
||||
let navigator = use_navigator().unwrap();
|
||||
let cloned_navigator_1 = navigator.clone();
|
||||
@ -54,25 +57,25 @@ pub fn navigation_bar(props: &NavigationBarProps) -> Html {
|
||||
<div onclick={move |_| cloned_navigator_1.push(&Route::MainPage)} class={
|
||||
if current_route.is_some() && matches!(current_route.clone().unwrap(), Route::MainPage) {"navbar-item-selected"} else {"navbar-item"}
|
||||
}>
|
||||
{t!("navbar.item.home", props.language)}
|
||||
{t!("navbar.item.home", locale = language.locale())}
|
||||
</div>
|
||||
|
||||
<div onclick={move |_| cloned_navigator_2.push(&Route::Services)} class={
|
||||
if current_route.is_some() && matches!(current_route.clone().unwrap(), Route::Services) {"navbar-item-selected"} else {"navbar-item"}
|
||||
}>
|
||||
{t!("navbar.item.services", current_lang())}
|
||||
{t!("navbar.item.services", locale = language.locale())}
|
||||
</div>
|
||||
|
||||
<div onclick={move |_| cloned_navigator_3.push(&Route::About)} class={
|
||||
if current_route.is_some() && matches!(current_route.unwrap(), Route::About) {"navbar-item-selected"} else {"navbar-item"}
|
||||
}>
|
||||
{t!("navbar.item.about-us", current_lang())}
|
||||
{t!("navbar.item.about-us", locale = language.locale())}
|
||||
</div>
|
||||
{
|
||||
if (*window_device_handle) == WindowDevice::Mobile {
|
||||
html! {
|
||||
<div onclick={move |_| cloned_navigator_4.push(&Route::Contact)} class={"navbar-item"}>
|
||||
{t!("navbar.item.contact-us", current_lang())}
|
||||
{t!("navbar.item.contact-us", locale = language.locale())}
|
||||
</div>
|
||||
}
|
||||
} else { html! {} }
|
||||
@ -106,7 +109,7 @@ pub fn navigation_bar(props: &NavigationBarProps) -> Html {
|
||||
} else {
|
||||
html! {
|
||||
<div onclick={move |_| cloned_navigator_5.push(&Route::Contact)} class={"navbar-item-contact-us"}>
|
||||
{t!("navbar.item.contact-us", current_lang())}
|
||||
{t!("navbar.item.contact-us", locale = language.locale())}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
use std::sync::Mutex;
|
||||
|
||||
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum Language {
|
||||
/// English United States
|
||||
EnUs,
|
||||
/// Dominican Republic Spanish
|
||||
EsDo,
|
||||
}
|
||||
impl Language {
|
||||
pub fn key<'a, 'b>(&'a self) -> &'b str {
|
||||
match self {
|
||||
Language::EnUs => "en",
|
||||
Language::EsDo => "es",
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
pub fn current_lang<'a>() -> &'a str {
|
||||
let lock = LANGUAGE.lock().expect("ERROR LOCKING LANGUAGE MUTEX. FATAL.");
|
||||
lock.key()
|
||||
}
|
||||
|
||||
pub fn change_lang(lang: Language) {
|
||||
let mut lock = LANGUAGE.lock().expect("ERROR LOCKING LANGUAGE MUTEX. FATAL.");
|
||||
*lock = lang
|
||||
}
|
||||
pub fn toggle_lang() {
|
||||
let mut lock = LANGUAGE.lock().expect("ERROR LOCKING LANGUAGE MUTEX. FATAL.");
|
||||
let new_lang = match *lock {
|
||||
Language::EnUs => Language::EsDo,
|
||||
Language::EsDo => Language::EnUs,
|
||||
};
|
||||
*lock = new_lang;
|
||||
}*/
|
@ -1,13 +1,15 @@
|
||||
pub mod routes;
|
||||
pub mod components;
|
||||
pub mod pages;
|
||||
pub mod language;
|
||||
|
||||
use rust_i18n::i18n;
|
||||
use yew::prelude::*;
|
||||
use yew_router::{BrowserRouter, Switch};
|
||||
|
||||
use crate::routes::main_router::{switch, Route};
|
||||
|
||||
i18n!("locales");
|
||||
|
||||
#[function_component]
|
||||
fn App() -> Html {
|
||||
html! {
|
||||
@ -19,6 +21,7 @@ fn App() -> Html {
|
||||
fn main() {
|
||||
wasm_logger::init(wasm_logger::Config::default());
|
||||
stdweb::initialize();
|
||||
log::info!("{:?}", available_locales());
|
||||
yew::Renderer::<App>::new().render();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::{components::{nav_bar::NavigationBar, footer::PageFooter, language_picker::LanguagePicker}, pages::{start::StartPage, services::ServicesPage, about::AboutPage, call_to_action::CallToActionPage}, language::Language};
|
||||
use crate::{components::{nav_bar::NavigationBar, footer::PageFooter, language_picker::{LanguagePicker, Language}}, pages::{start::StartPage, services::ServicesPage, about::AboutPage, call_to_action::CallToActionPage}};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum Section {
|
||||
@ -17,14 +17,14 @@ pub struct MainPageProps {
|
||||
/// Will happen with scrolling.
|
||||
#[function_component(MainPage)]
|
||||
pub fn main_page() -> Html {
|
||||
let language = use_state_eq(|| Language::EnUs);
|
||||
let language = use_state_eq(|| Language::default());
|
||||
html! {
|
||||
<>
|
||||
<NavigationBar/>
|
||||
<LanguagePicker/>
|
||||
<NavigationBar language={(*language).clone()}/>
|
||||
<LanguagePicker language={language.clone()}/>
|
||||
<div class={"page-container"}>
|
||||
<StartPage/>
|
||||
<ServicesPage/>
|
||||
<StartPage language={(*language).clone()}/>
|
||||
<ServicesPage language={(*language).clone()}/>
|
||||
<AboutPage/>
|
||||
<CallToActionPage/>
|
||||
</div>
|
||||
|
@ -1,12 +1,14 @@
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::components::{nav_bar::NavigationBar, footer::PageFooter};
|
||||
use crate::components::{nav_bar::NavigationBar, footer::PageFooter, language_picker::{Language, LanguagePicker}};
|
||||
|
||||
#[function_component(NotFoundPage)]
|
||||
pub fn not_found_page() -> Html {
|
||||
let language = use_state_eq(|| Language::default());
|
||||
html! {
|
||||
<>
|
||||
<NavigationBar/>
|
||||
<NavigationBar language={(*language).clone()}/>
|
||||
<LanguagePicker language={language}/>
|
||||
<div class={"page-container"} style={"margin-bottom: 72.5vh"}>
|
||||
{"Not found page"}
|
||||
</div>
|
||||
|
@ -1,14 +1,18 @@
|
||||
use locales::t;
|
||||
use rust_i18n::t;
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::{language::current_lang, components::service_card::ServiceCard};
|
||||
use crate::{components::{service_card::ServiceCard, language_picker::Language}};
|
||||
|
||||
#[derive(PartialEq, Clone, Properties)]
|
||||
pub struct ServicesPageProps {
|
||||
pub language: Language
|
||||
}
|
||||
#[function_component(ServicesPage)]
|
||||
pub fn services_page() -> Html {
|
||||
|
||||
pub fn services_page(props: &ServicesPageProps) -> Html {
|
||||
let language = &props.language;
|
||||
html! {
|
||||
<div class={"services-section-container"}>
|
||||
<div class={"services-section-title"}>{t!("services-section.title", current_lang())}</div>
|
||||
<div class={"services-section-title"}>{t!("services-section.title", locale = language.locale())}</div>
|
||||
<div class={"services-section-services-container"}>
|
||||
<ServiceCard/>
|
||||
</div>
|
||||
|
@ -1,38 +1,43 @@
|
||||
use locales::t;
|
||||
use rust_i18n::t;
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::language::current_lang;
|
||||
use crate::components::language_picker::Language;
|
||||
|
||||
#[derive(PartialEq, Properties)]
|
||||
pub struct StartPageProps {
|
||||
pub language: Language,
|
||||
}
|
||||
|
||||
#[function_component(StartPage)]
|
||||
pub fn start_page() -> Html {
|
||||
|
||||
pub fn start_page(props: &StartPageProps) -> Html {
|
||||
let language = &props.language;
|
||||
html! {
|
||||
<div class={"start-section-container"}>
|
||||
<div class={"start-section-left-column"}>
|
||||
<div class={"start-section-left-column-title-nocolor"}>
|
||||
{t!("start.left-column.title-first-line", current_lang())}
|
||||
{t!("start.left-column.title-first-line", locale = language.locale())}
|
||||
</div>
|
||||
<div class={"start-section-left-column-title-colored"}>
|
||||
{t!("start.left-column.title-second-line", current_lang())}
|
||||
{t!("start.left-column.title-second-line", locale = language.locale())}
|
||||
</div>
|
||||
<div class={"start-section-left-column-title-nocolor"}>
|
||||
{t!("start.left-column.title-third-line", current_lang())}
|
||||
{t!("start.left-column.title-third-line", locale = language.locale())}
|
||||
</div>
|
||||
<div class={"start-section-left-column-description"}>
|
||||
{t!("start.left-column-description", current_lang())}
|
||||
{t!("start.left-column-description", locale = language.locale())}
|
||||
</div>
|
||||
<div class={"start-section-left-column-button"}>
|
||||
{t!("start.left-column-button-text", current_lang())}
|
||||
{t!("start.left-column-button-text", locale = language.locale())}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class={"start-section-right-column"}>
|
||||
<div class={"start-section-right-column-canvas"}>
|
||||
<div class={"start-section-right-column-art-top-left-pill"}>
|
||||
<div class={"start-section-right-column-subject-1-title"}>{t!("start.right-column-subject-1-title", current_lang())}</div>
|
||||
<div class={"start-section-right-column-subject-1-title"}>{t!("start.right-column-subject-1-title", locale = language.locale())}</div>
|
||||
</div>
|
||||
<div class={"start-section-right-column-art-bottom-right-pill"}>
|
||||
<div class={"start-section-right-column-subject-2-title"}>{t!("start.right-column-subject-2-title", current_lang())}</div>
|
||||
<div class={"start-section-right-column-subject-2-title"}>{t!("start.right-column-subject-2-title", locale = language.locale())}</div>
|
||||
</div>
|
||||
<div class={"start-section-right-column-art-bottom-left-pill"}>
|
||||
<img class={"start-section-right-column-subject-2-photo"} src={"images/subject-2-picture.png"}/>
|
||||
|
Loading…
Reference in New Issue
Block a user