question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support fetch remote i18n file ?

See original GitHub issue

Is your feature related to a specific framework or general for this extension

General

Is your feature request related to a problem? Please describe.

my i18n file only storage in aws s3 not locate

Describe the solution you’d like

can i18n-ally.localesPaths support fetch url

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
antfucommented, Aug 11, 2021

This could add much complexity and limitations to the extension for a relevant niche case (requesting, error handling, caching, reevaluating, and the extension could only work in readonly mode). So currently, we don’t think this is worth to implement at this stage. The solution we could offer for now is to write a simple script to pull down the files to local fs and upload when you are done with the editing. This way you could also leverage the full functionality of i18n Ally.

For the integrations with only services, that something we would consider to implement later. Thanks.

1reaction
diabloevagtocommented, Sep 2, 2021

@kubanac95 like this, simple nodejs script, download and rewrite

const fs = require("fs");
const fetch = require("node-fetch");

const downloadFile = async (url, fileName) => {
  const resp = await fetch(url);
  const json = await resp.json();

  fs.writeFile(`./src/i18n/locales/${fileName}`, JSON.stringify(json, null, 2), (err) => {
    if (err) {
      console.error(err);
      return;
    }
  });
};

const files = [
  { Key: "en-US.json" },
  { Key: "zh-TW.json" },
];

files.forEach((v) => {
  downloadFile(
    `https://${process.env.S3_BUCKET}.s3.${process.env.S3_REGION}.amazonaws.com/${v.Key}`,
    v.Key
  );
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetch translations files from S3 #336 - i18next/next ... - GitHub
It's working fine, but we have to change source to public S3. We try to implement backend section in config. Code looks like:...
Read more >
Add i18n support—ArcGIS Web AppBuilder
To support specific languages, create folders under the nls folder, named by the language code (for example, en, fr, ru). Copy the strings.js...
Read more >
Add or Load Translations - i18next documentation
There are a few options to load translations to your application instrumented by i18next. The most common approach to this adding a so...
Read more >
Configure internationalization (i18n) rewrites | Firebase Hosting
To set up i18n rewrites for your Hosting site, you need to create an "i18n content" directory for all your localized content, then...
Read more >
Rails Internationalization (I18n) API - Ruby on Rails Guides
There are a few steps to get up and running with I18n support for a Rails application. 2.1 Configure the I18n Module. Following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found