GithubHelp home page GithubHelp logo

androsoftweb / getx_google_sheets_translation_code_generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from delay/getx_google_sheets_translation_code_generator

0.0 0.0 0.0 64 KB

Kotlin 0.53% Swift 1.31% Objective-C 0.12% Dart 98.04%

getx_google_sheets_translation_code_generator's Introduction

GetX Google Sheets Translation Code Generator

When handling localization for my app I was using the excellent https://pub.dev/packages/flutter_sheet_localization package. I have also been using the GetX package. GetX now has their own translation code options so I wanted the benefits of storing my translations in google sheets but also wanted the ability to have the code I would need for GetX generated automatically since you must write a lot of tedious code to translate your app.

I created a code generator that will do this.

So let me explain how it works. You need to create a translation for your app in google sheets.

You can copy my sheet as a starting point for your own app. The cool thing about using a google sheet is you can have google translate a field with a simple google formula: =GOOGLETRANSLATE(B4,en,fr) This says translate the phrase in field B4 from english to french. Next you can edit the main.dart file in the project I listed earlier and edit these two lines.

//the document id for your google sheet  
String documentId = "1oS7iJ6ocrZBA53SxRfKF0CG9HAaXeKtzvsTBhgG4Zzk";  //the sheet id of your google sheet  
String sheetId = "0";

The next step is to go to the command line and change to the lib/ directory. Then type:

dart main.dart

This will create a localization.g.dart file with your generated code that looks like this.

You can then use these translations in your own project with something like this.

Text('settings.updateProfile'.tr)

You can find out more about how to use getX translations here.

Anyway I hope you will find this useful for your own projects. If you would like to see how I used this in a project you can take a look at my getX flutter starter project

getx_google_sheets_translation_code_generator's People

Contributors

delay avatar

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.