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 🙏

© 2025 – Pkg Stats / Ryan Hefner

locize-xcstrings

v2.0.0

Published

xcstrings2locize and locize2xcstrings converter xcstrings utils

Downloads

21,683

Readme

CI npm

Download

The source is available for download from GitHub. Alternatively, you can install using npm:

npm install --save locize-xcstrings

You can then import or require() locize-xcstrings as normal:

import converter from 'locize-xcstrings'
// or
const converter = require('locize-xcstrings')

const locizeData = converter.xcstrings2locize(xcstrings)
const xcstrings = converter.locize2xcstrings(locizeData)

Or you can direclty import or require() its functions:

import xcstrings2locize from 'locize-xcstrings/xcstrings2locize'
import { xcstrings2locize, locize2xcstrings } from 'locize-xcstrings'
// or
const xcstrings2locize = require('locize-xcstrings/cjs/xcstrings2locize')

Usage

const xcstrings = `{
  "sourceLanguage" : "en",
  "strings" : {
    "empty" : {
    },
    "empty-str" : {
      "localizations" : {
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : ""
          }
        }
      }
    },
    "empty-trans" : {
      "localizations" : {
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "source with value"
          }
        }
      }
    },
    "empty-trans-str" : {
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : ""
          }
        },
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "source with value"
          }
        }
      }
    },
    "key1" : {
      "comment" : "some comment",
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Hallo"
          }
        },
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "Hello"
          }
        }
      }
    },
    "key2.nested" : {
      "comment" : "comment",
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "xcstrings Daten-Manager"
          }
        },
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "xcstrings Data Manager"
          }
        }
      }
    },
    "interpolation" : {
      "comment" : "some substitution",
      "localizations" : {
        "de" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "%d von %d verbleiben"
          }
        },
        "en" : {
          "stringUnit" : {
            "state" : "translated",
            "value" : "%d of %d remaining"
          }
        }
      }
    },
    "pluralized" : {
      "comment" : "Pluralized translation",
      "localizations" : {
        "de" : {
          "variations" : {
            "plural" : {
              "one" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "%lld Haus"
                }
              },
              "other" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "%lld Häuser"
                }
              }
            }
          }
        },
        "en" : {
          "variations" : {
            "plural" : {
              "one" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "%lld house"
                }
              },
              "other" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "%lld houses"
                }
              }
            }
          }
        }
      }
    },
    "vars" : {
      "localizations" : {
        "de" : {
          "variations" : {
            "device" : {
              "iphone" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "eine Übersetzung für das iPhone"
                }
              },
              "other" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "eine andere Übersetzung"
                }
              }
            }
          }
        },
        "en" : {
          "variations" : {
            "device" : {
              "iphone" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "a translation for the iPhone"
                }
              },
              "other" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "an other translation"
                }
              }
            }
          }
        }
      }
    },
    "vars-pluralized-dev" : {
      "comment" : "ctx1",
      "localizations" : {
        "de" : {
          "variations" : {
            "device" : {
              "appletv" : {
                "variations" : {
                  "plural" : {
                    "one" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "ein Apple TV"
                      }
                    },
                    "other" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "%lld Apple TVs"
                      }
                    }
                  }
                }
              },
              "iphone" : {
                "variations" : {
                  "plural" : {
                    "one" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "ein Iphone"
                      }
                    },
                    "other" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "%lld Iphones"
                      }
                    }
                  }
                }
              },
              "other" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "%lld Geräte"
                }
              }
            }
          }
        },
        "en" : {
          "variations" : {
            "device" : {
              "appletv" : {
                "variations" : {
                  "plural" : {
                    "one" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "one apple tv"
                      }
                    },
                    "other" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "%lld apple tvs"
                      }
                    }
                  }
                }
              },
              "iphone" : {
                "variations" : {
                  "plural" : {
                    "one" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "an iphone"
                      }
                    },
                    "other" : {
                      "stringUnit" : {
                        "state" : "translated",
                        "value" : "%lld iphones"
                      }
                    }
                  }
                }
              },
              "other" : {
                "stringUnit" : {
                  "state" : "translated",
                  "value" : "%lld devices"
                }
              }
            }
          }
        }
      }
    }
  },
  "version" : "1.0"
}

const locizeData = {
  "sourceLng": "en",
  "resources": {
    "en": {
      "empty" : {},
      "empty-str" : {
        "value": ""
      },
      "empty-trans" : {
        "value" : "source with value"
      },
      "empty-trans-str" : {
        "value" : "source with value"
      },
      "key1": {
        "value": "Hello",
        "context": {
          "text": "some comment"
        }
      },
      "key2.nested": {
        "value": "xcstrings Data Manager",
        "context": {
          "text": "comment"
        }
      },
      "interpolation": {
        "value": "%d of %d remaining",
        "context": {
          "text": "some substitution"
        }
      },
      "pluralized[variations.plural.one]": {
        "value": "%lld house",
        "context": {
          "text": "Pluralized translation"
        }
      },
      "pluralized[variations.plural.other]": {
        "value": "%lld houses"
      },
      "vars[variations.device.iphone]": {
        "value": "a translation for the iPhone"
      },
      "vars[variations.device.other]": {
        "value": "an other translation"
      },
      "vars-pluralized-dev[variations.device.appletv[variations.plural.one]]": {
        "value": "one apple tv",
        "context": {
          "text": "ctx1"
        }
      },
      "vars-pluralized-dev[variations.device.appletv[variations.plural.other]]": {
        "value": "%lld apple tvs"
      },
      "vars-pluralized-dev[variations.device.iphone[variations.plural.one]]": {
        "value": "an iphone"
      },
      "vars-pluralized-dev[variations.device.iphone[variations.plural.other]]": {
        "value": "%lld iphones"
      },
      "vars-pluralized-dev[variations.device.other]": {
        "value": "%lld devices"
      }
    },
    "de": {
      "empty-trans-str" : {
        "value" : ""
      },
      "key1": {
        "value": "Hallo"
      },
      "key2.nested": {
        "value": "xcstrings Daten-Manager"
      },
      "interpolation": {
        "value": "%d von %d verbleiben"
      },
      "pluralized[variations.plural.one]": {
        "value": "%lld Haus"
      },
      "pluralized[variations.plural.other]": {
        "value": "%lld Häuser"
      },
      "vars[variations.device.iphone]": {
        "value": "eine Übersetzung für das iPhone"
      },
      "vars[variations.device.other]": {
        "value": "eine andere Übersetzung"
      },
      "vars-pluralized-dev[variations.device.appletv[variations.plural.one]]": {
        "value": "ein Apple TV"
      },
      "vars-pluralized-dev[variations.device.appletv[variations.plural.other]]": {
        "value": "%lld Apple TVs"
      },
      "vars-pluralized-dev[variations.device.iphone[variations.plural.one]]": {
        "value": "ein Iphone"
      },
      "vars-pluralized-dev[variations.device.iphone[variations.plural.other]]": {
        "value": "%lld Iphones"
      },
      "vars-pluralized-dev[variations.device.other]": {
        "value": "%lld Geräte"
      }
    }
  },
  "version": "1.0"
}`

import { xcstrings2locize, locize2xcstrings } from 'locize-xcstrings'

const res = xcstrings2locize(xcstrings)
// res is like locizeData

const res = locize2xcstrings(locizeData)
// res is like xcstrings