Giter Site home page Giter Site logo

fusion-plugin-i18n's Introduction

Modern framework for fast, powerful React apps

Build status fusion-core Downloads

What is it?

fu·sionnoun

The process or result of joining two or more things together to form a single entity.

Fusion.js, Uber’s open source universal web framework, represents the fusion of the client and the server. It's geared for server-side rendering out of the box, and its plugin-driven architecture allows for complex frontend and backend logic to be encapsulated in a single plugin:

import App from 'fusion-react';
import Router from 'fusion-plugin-react-router';

export default () => {
  const app = new App(<div>...</div>);

  /*
  One line of code sets up everything you need for routing:
  - Server rendering
  - React Providers on both server and browser
  - Bundle splitting integration
  - Hot module reloading support
  */
  app.register(Router);

  return app;
}

We initially built Fusion.js to make our own websites easier to maintain, but were so impressed with the benefits that we decided to offer it to the community as an open source project!

Try it out

If you're interested in giving Fusion.js a shot, Overview and Core Concepts are great places to start.

Contributing

This is a monorepo of all open source Fusion.js packages maintained using Yarn v2. Take a look at CONTRIBUTING.md for info on how to develop in this repo.

License

MIT

fusion-plugin-i18n's People

Contributors

alexmsmithca avatar angus-c avatar chrisrauh avatar ganemone avatar kahwee avatar kevingrandon avatar ksheedlo avatar lhorie avatar marceloadsj avatar nadiia avatar rajeshsegu avatar ratson avatar renovate-bot avatar renovate[bot] avatar rtsao avatar uberopensourcebot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fusion-plugin-i18n's Issues

Error in newer versions of Flow

I believe this occurs for 0.80 and greater. I'm using 0.82.

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ node_modules/fusion-plugin-i18n/src/types.js:22:12

Cannot use function type as a type because function type is a value. To get the type of a value use typeof.

     19│ export type I18nDepsType = {
     20│   fetch?: typeof FetchToken.optional,
     21│   hydrationState?: typeof HydrationStateToken.optional,
     22│   loader?: I18nLoaderToken.optional,
     23│ };
     24│
     25│ export type I18nServiceType = {

Loader isn't loading non en-us translations

Type of issue

Bug

Description

Loader is trying to load en_au.json but the file is en-au.json

Current behavior

Translations aren't loaded

Expected behavior

Translations should be loaded

Steps to reproduce

  1. Use a non en-us locale

Your environment

  • fusion-plugin-i18n version: 1.0.2

  • Node.js version (node --version): 8.9.4

  • npm version (npm --version): 5.6.0

  • Operating System: OS X

Add Token dependencies to readme

Problem/Rationale

Documentation regarding Fusion API is out of date given recent changes to leverage new Dependency Injection architecture.

Solution/Change/Deliverable

Update documentation

Export the string interpolation function

Feature request

Export the string interpolation function for applications to use the same logic when interpolating strings externally.

We recently updated the interpolation logic to be able to pass interpolation variables through in order to interpolate externally. This is useful for interpolating dynamic values into translation strings. Because this use case happens mixed with internally interpolated translation strings, being able to use the exact same logic in both places would help guarantee consistency of outcomes.

Related, if the plugin architecture or performance considerations allow, it would be easier to maintain the code and internal consistency if we extract the translation function from browser and node implementation into its own file and re-use that.

Would like to hear any concerns, specially on the architectural or performance constraints to extract the translation function. Based on those, I am happy to contribute the update.

Middleware should add html lang attribute

Type of issue

Feature Request

Description

We should probably have the i18n plugin add the lang attribute to the opening html tag, as it is recommended for accessibility. We can do this using ctx.template.htmlAttrs

Don't interpolate if interpolation value is not present.

Currently, a call to translate() will attempt to interpolate variables even if no interpolation values are provided returning a string interpolated with "undefined".

This result is unexpected and it would be preferable to return a string with the variables in it. Such string is useful when you want to interpolate the values somewhere else in the application.

For example:

translations: {interpolated: 'hi ${adjective} ${noun}'},

translate('interpolated', {adjective: 'big', noun: 'world'}) 
// 'hi big world'

translate('interpolated', {noun: 'world'}) 
// 'hi ${adjective} world'

translate('interpolated')
// 'hi ${adjective} ${noun}'

Client-side locale switching

Currently there's no mechanism for client-side locale switching, which means a page refresh is required to change locales.

Perhaps there should be an API for doing this client-side.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Preset name not found within published preset config (monorepo:angularmaterial). Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.