Code Monkey home page Code Monkey logo

Comments (2)

ueman avatar ueman commented on June 16, 2024

I don't speak Spanish, so I'm leaving this for someone who does.

from feedback.

TijnvandenEijnde avatar TijnvandenEijnde commented on June 16, 2024

You can create a custom class, this way you can add any language you want. This is the class I am using in my application. I am using easy_localization for the translations.

import 'package:easy_localization/easy_localization.dart';
import 'package:feedback/feedback.dart';
import 'package:flutter/material.dart';

class CustomFeedbackLocalizations implements FeedbackLocalizations {
  @override
  String get draw => tr('feedBackPage.draw');

  @override
  String get feedbackDescriptionText => tr('feedBackPage.description');

  @override
  String get navigate => tr('feedBackPage.navigate');

  @override
  String get submitButtonText => tr('feedBackPage.submit');
}

class CustomFeedbackLocalizationsDelegate
    extends GlobalFeedbackLocalizationsDelegate {
  @override
  // ignore: overridden_fields
  final supportedLocales = <Locale, FeedbackLocalizations>{
    const Locale('de'): CustomFeedbackLocalizations(),
    const Locale('en'): CustomFeedbackLocalizations(),
    const Locale('es'): CustomFeedbackLocalizations(),
    const Locale('fr'): CustomFeedbackLocalizations(),
    const Locale('nl'): CustomFeedbackLocalizations(),
    const Locale('pt'): CustomFeedbackLocalizations(),
    const Locale('ru'): CustomFeedbackLocalizations(),
    const Locale('uk'): CustomFeedbackLocalizations(),
  };
}

In your BetterFeedback widget you can use the class like so:

return BetterFeedback(
  localizationsDelegates: [
    ...context.localizationDelegates,
    CustomFeedbackLocalizationsDelegate(),
  ],
  localeOverride: context.locale,
  child: MaterialApp(
    locale: context.locale,
    localizationsDelegates: context.localizationDelegates,
    supportedLocales: context.supportedLocales,
  ),
),

It could be possible that I have forgotten something, please let me know if you need some help @as-stefit .

from feedback.

Related Issues (20)

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.