npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mirrorrim

v1.2.1

Published

Tool for generating localization files for iOS and Android

Downloads

20

Readme

mirrorrim

Webp net-resizeimage

This is a node app for generating iOS/Android localization files from local CSV or Google Sheet. You can consider this as a solution for maintainning multiple languages in iOS/Android platform btween developers and whoever updates the wordings.

Install

Local(recommended): yarn add mirrorrim --dev Global: yarn global add mirrorrim or npm install mirrorrim --global

Usage

Manually

mirrorrim --output-dir './outputs' --input-path './resources/test.csv'

Quick Test or Wordings are not sensitive

Make sure you have your Google Sheet file shared as public read-only so mirrorrim can pull from Google.

mirrorrim --output-dir './outputs' --googleFileId 1Ik0mRByqVFldbAjDvrwGFx_CrM6-fsEKN0IzZnAr7rI

or add a mirrorrim section in your package.json and run mirrorrim at your root folder

"mirrorrim": {
    "googleFileId": "1Ik0mRByqVFldbAjDvrwGFx_CrM6-fsEKN0IzZnAr7rI",
    "outputDir": "./PATH_TO_YOUR_DEST",
    "platforms": ["ios", "android"]
  },

Configured(recommended)

add a mirrorrim section in your package.json and run yarn mirrorrim at your root folder

"mirrorrim": {
    "googleCredential": "./google-credential.json",
    "googleFileId": "1Ik0mRByqVFldbAjDvrwGFx_CrM6-fsEKN0IzZnAr7rI",
    "outputDir": "./PATH_TO_YOUR_DEST",
    "platforms": ["ios", "android"]
  },

The output looks like

If you see a 404 error, follow the setup here.

List of options:

--output-dir <string>      | default: ./output
--platforms <string>       | default: ['ios', 'android']
--input-path <file>        | path to local csv
--google-file-id <string>  | google file id, should be sheet file
--google-credential <file> | path to google credentials.json

The tool currently onlys supports en and zh-Hans. Will support more in later phase. Please make sure you have the same column title as below for the sheet.

Example

Let's say your wordings are kept at https://docs.google.com/spreadsheets/d/1Ik0mRByqVFldbAjDvrwGFx_CrM6-fsEKN0IzZnAr7rI/edit?usp=sharing

Follow the setup here to get the google-credential.json file

iOS

Before you run this script, make sure you already have the Localizable file created and corresponding language enabled, otherwise you'll have to switch around manually.

After install at your project root folder, add following section to your package.json

"mirrorrim": {
    "googleCredential": "./google-credential.json",
    "googleFileId": "1Ik0mRByqVFldbAjDvrwGFx_CrM6-fsEKN0IzZnAr7rI",
    "outputDir": "./PATH_TO_YOUR_DEST",
    "platforms": ["ios"]
  },

And run mirrorrim at your project root folder. You can add the localization files from Xcode now.

What's More For iOS?

You can combine it with R.swift, then use R.string.localizable.alert_ok() for localized string.

Wait... R.swift currently doesn't support in-app language switch well, but with this extension https://gist.github.com/jhonny-me/dd2edb43fb167d1f55f79021718507b7

you can do: R.string.localizable.alert_ok.localized()

What about params? I got you covered: R.string.localizable.count_number.localized().withInputs(2, 'piggets')

When you want to change language simply call StringResource.language = "zh-Hans"

Android

After install at your project root folder, add following section to your package.json

"mirrorrim": {
    "googleCredential": "./google-credential.json",
    "googleFileId": "1Ik0mRByqVFldbAjDvrwGFx_CrM6-fsEKN0IzZnAr7rI",
    "outputDir": "./PATH_TO_YOUR_DEST",
    "platforms": ["android"]
  },

And run mirrorrim at your project root folder. You can add the localization files from your IDE now.

How to setup Google Account

create project and enable drive api

  1. Go to the Google Developers Console
  2. Select your project or create a new one (and then select it)
  3. Enable the Drive API for your project
  4. In the sidebar on the left, select APIs & Services > Library
  5. Search for "drive"
  6. Click on "Google Drive API"
  7. click the blue "Enable" button

create service account and download the json credential

  1. In the sidebar on the left, select APIs & Services > Credentials
  2. Click blue "+ CREATE CREDENTIALS" and select "Service account" option
  3. Enter name, description, click "CREATE"
  4. You can skip permissions, click "CONTINUE"
  5. Click "+ CREATE KEY" button
  6. Select the "JSON" key type option
  7. Click "Create" button
  8. your JSON key file is generated and downloaded to your machine (it is the only copy!)
  9. click "DONE"
  10. rename the downloaded json to google-credential.json
  11. add the generated bot user to your Google Sheet as a viewer, it can be found at the client_email at the downloaded json.

Be careful - never check your API keys / secrets into version control (git)