Class: PolyglotFlutter::Serializer::Localization::LocalizationDelegate
- Defined in:
- lib/flutter_polyglot_cli/serializers/localizations/localization_delegate_serializer.rb
Constant Summary
Constants included from Helper::General
Helper::General::ESCAPE_KEYWORDS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods included from Helper::General
#clean_enum_name, #clean_variable_name, #config, #escape_keyword_if_needed, #escape_with_underscore_if_needed, #extract_translations, #generate_locales, #generate_localization_keys, #indent, #mandatory_language, #programming_language, #project_configs, #token, #use_old_naming
Constructor Details
This class inherits a constructor from PolyglotFlutter::Serializer::Localization::Base
Instance Method Details
#save(sources_path) ⇒ Object
7 8 9 10 11 |
# File 'lib/flutter_polyglot_cli/serializers/localizations/localization_delegate_serializer.rb', line 7 def save(sources_path) FileUtils.mkdir_p sources_path unless File.exist? sources_path output_path = File.join(sources_path, 'localization_delegate.dart') File.write(output_path, render) end |
#template ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/flutter_polyglot_cli/serializers/localizations/localization_delegate_serializer.rb', line 13 def template() <<-TEMPLATE import 'dart:async'; import 'dart:ui'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'localization.dart'; // AUTO GENERATED FILE. DO NOT CHANGE. class LocalizationDelegate extends LocalizationsDelegate<Localization> { const LocalizationDelegate(); @override bool isSupported(Locale locale) => <String><%= generate_locales(languages) %>.contains(locale.languageCode); @override Future<Localization> load(Locale locale) { Localization.load(locale); return SynchronousFuture<Localization>(Localization(locale.languageCode)); } @override bool shouldReload(LocalizationDelegate old) => false; } TEMPLATE end |