Giter VIP home page Giter VIP logo

riw's People

Contributors

avaragado avatar jdcrensh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jdcrensh

riw's Issues

TypeScript support via a transpile hook?

I just added riw to a project I'm contributing to. (@avaragado - awesome work, thank you for making this! ๐Ÿ‘) It's a TypeScript project, so right now there's a transpile-to-JS step that needs to happen before babel (invoked by riw) can extract the strings for localisation.

Since manually invoking the transpilation can easily be forgotten, I was wondering ... if there would be interest in a pre-babel hook implementation in riw that could be configured to run such transpile step automatically? If so I could contribute that in the near future.

Something in the following direction:

/* package.json */
{
  "riw": {
      "transpileCommand": "tsc -p . --target ES6 --module esnext --jsx preserve --outDir tmp/transpiled",
      "sourceDirs": [
        "tmp/transpiled/**/*.js",
        "tmp/transpiled/**/*.jsx"
      ]
   }
}

Support for babel-plugin-react-intl-auto

It would be great if this tool supported babel-plugin-react-intl-auto. It allows ids to be autogenerated based on the file's path.

I installed the plugin and added it to my .babelrc, but it doesn't look like riw is picking up the plugin.

.babelrc

{
  "presets": ["react-app"],
  "plugins": [
    ["react-intl-auto", {
      "removePrefix": "src/",
      "filebase": false
    }]
  ]
}

I dug in a little bit, and it looks like riw uses babel-plugin-react-intl explicitly:

plugins: [pluginReactIntl],

Would it be possible to include additional babel plugins, or am I missing something?

Support objects as message descriptor description values

react-intl recently added support for arbitrary objects, as well as strings, as the value of a message descriptor's optional description field.

riw currently supports only string values.

In riw, description strings are used as an object key in the translations database JSON file. To support description objects, riw needs some serialisation/deserialisation to/from strings.

Defer to local package dependency if found and if global

riw can be installed globally or as a package dependency.

If installed globally, and if the CWD is within a package, and if that package has a local riw dependency, then running the global riw should punt to the package dependency.

"--no-progress" option

We use this tool in CI (via module api, not cli). It would be nice if there was a way to disable the status bar output, since when not run in an interactive context, it floods the logs with filename output.

Use relative paths in TODO file

The file names in TODO-untranslated.json are output as an absolute path. It should use the relative path from the app's root so that the file can be shared among developers.

Upgrade babel

Can we upgrade riw's version of babel to v7? Our app uses CRA which is now using the @babel namespace. In order for our tooling to work properly, we have to override the babel-core version in our package.json:

  "resolutions": {
    "**/babel-core": "7.0.0-bridge.0"
  }

I believe this wouldn't be necessary if riw upgraded babel-core to @babel/core.

Of course, doing so will probably require a major version bump...

~ yep, still here using riw! makes my life so much easier.

Support autogenerated fake/pseudolocales

During i18n, before (complete) l10n, it's often useful to use pseudolocales to simulate common features of languages other than English. For example, German strings are ~30% longer than English, which might affect layout.

riw should ship with some magic pseudolocales that derive algorithmically from the default locale. Possible pseudolocales include:

  • reverse: makes it easier to spot text that hasn't been i18n'd
  • third-longer: simulates languages like German
  • half-length: simulates languages like Japanese

Some sequences in strings need special treatment, such as HTML tags and entities, and arguments in braces.

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.