denysvuika / preact-translate Goto Github PK
View Code? Open in Web Editor NEWMinimalistic translate (i18n) library for Preact
License: MIT License
Minimalistic translate (i18n) library for Preact
License: MIT License
In this demo, you can see duplicated requests to en.json
from the DevTool's Network panel.
en.json
should be fetch only once
en.json
is fetched twice
a) love the library's simplicity
b) ran into some hiccups:
All the translations flash from translation key -> translation on page load (while en.json is being fetched)
e.g. "footer.contact" is rendered onto the screen, quickly followed by the translation (e.g. "Contact Us")
SSR is not rendering the translation
e.g. in the page source code I literally see <a href="/contact">footer.contact</a>
if #2 could be fixed, then it would fix #1 for most cases.
any recommendations or thoughts on โ๏ธ ??
Configure unit testing.
Notes: for the time being there are some issues with PreactX RC and jest, needs investigation
I ran into this use case lately and didn't find any built-in way to achieve this.
What are your thoughts and do you accept PRs on this one ?
https://github.com/ai/size-limit ?
Size Limit will prevent mistakes: is somebody will send PR, Size Limit will check it on CI.
cc @ai
i18n
When using a nested route, the translation library looks for the JSON relative to the route rather than at the root of the project.
So when on a page that is generated by: <Route path="/trick/:id" component={Trick} />
, the url is something like:
http://localhost:3000/trick/3
but the translate library looks for the localization JSON in http://localhost:3000/trick/assets/en.json
rather than at the root http://localhost:3000/assets/en.json
and it 404s.
Any suggestions on how to use this library on custom routes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.