Easy Localization: Localization key [...] not found - android-studio

I am using easy_localization: ^2.3.3 in a flutter project with CSV loader. When I build it is not able to find keys and it gives "Easy Localization: Localization key [...] not found". Any ideas why is this happening?
runApp(EasyLocalization(
supportedLocales: [
Locale('en', ''),
Locale('it', ''),
Locale('es', ''),
Locale('de', ''),
Locale('fr', ''),
Locale('pt', ''),
],
path: 'resources/langs/langs.csv',
fallbackLocale: Locale('en', ''),
saveLocale: false,
useOnlyLangCode: true,
assetLoader: CsvAssetLoader(),
child: MyApp(status),
));
}

Also this error can be happen for not setting the material app; I mean, I got same error for forgeting the add these lines to my material app;
MaterialApp(
locale: context.locale,
supportedLocales: context.supportedLocales,
localizationsDelegates: context.localizationDelegates,
),
and my problem solved !

You need to import import 'package:easy_localization/easy_localization.dart';
And add in your MaterialApp :
locale: context.locale,
supportedLocales: context.supportedLocales,
localizationsDelegates: context.localizationDelegates,

I found a solution looking at this bug: https://github.com/aissat/easy_localization/issues/190#
I added the following:
dependencies:
easy_localization_loader:
git:
url: git://github.com/aissat/easy_localization_loader.git
ref: overman-dev
then I did a
flutter pub upgrade
and also changed the code into this
runApp(EasyLocalization(
supportedLocales: [
Locale('en'),
Locale('it'),
Locale('es'),
Locale('de'),
Locale('fr'),
Locale('pt'),
],
path: 'resources/langs/langs.csv',
fallbackLocale: Locale('en'),
saveLocale: false,
useOnlyLangCode: true,
assetLoader: CsvAssetLoader(),
child: MyApp(status),
));
It worked.

Related

right-to-left (RTL) in flutter

I was using Flutter more than a week, and wanted to create an Arabic (right-to-left) app.
I was reading Internationalizing Flutter Apps, but it didn't mention how to set the layout direction.
So, how to show right-to-left (RTL) layout in Flutter?
you have two choices :
1. force a locale ( and direction ) on all devices
-- method 1: with localization
add flutter_localizations package to your pubspec.yml
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
then
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
MaterialApp(
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
Locale("fa", "IR"), // OR Locale('ar', 'AE') OR Other RTL locales
],
locale: Locale("fa", "IR") // OR Locale('ar', 'AE') OR Other RTL locales,
.
.
.
);
-- method 2: without localization
MaterialApp(
.
.
.
builder: (context, child) {
return Directionality(
textDirection: TextDirection.rtl,
child: child,
);
},
.
.
.
);
2. set layout direction according to device locale
( if user phone locale is a RTL language and exist in supportedLocales, your app run in RTL mode, otherwise your app is LTR )
add flutter_localizations package to your pubspec.yml
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
then
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
MaterialApp(
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
Locale("en", "US"),
Locale("fa", "IR"), // OR Locale('ar', 'AE') OR Other RTL locales
],
.
.
.
);
note : rtl languages in flutter are:
[
'ar', // Arabic
'fa', // Farsi
'he', // Hebrew
'ps', // Pashto
'ur', // Urdu
];
The best and shortest way to set RTL configuration for the entire app.
void main() {
runApp(
MaterialApp(
home: Directionality( // add this
textDirection: TextDirection.rtl, // set this property
child: HomePage(),
),
),
);
}
You need to create a Builder and pass it the layout direction using TextDirection.rtl
new MaterialApp(
title: 'Flutter RTL',
color: Colors.grey,
builder: (BuildContext context, Widget child) {
return new Directionality(
textDirection: TextDirection.rtl,
child: new Builder(
builder: (BuildContext context) {
return new MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 1.0,
),
child: child,
);
},
),
);
},
.
.
.
);
If you need to display text in reverse direction then just set it's textdirection property to TextDirection.rtl.
Example code for TextField widget,
TextField(
textDirection: TextDirection.rtl,
decoration: InputDecoration(
labelText: "Enter Pashto Name",
),
),
Example code for Text widget,
Text(
"This text is in the other direction!"
textDirection: TextDirection.rtl,
),
Just append this to your material app:
builder: (BuildContext context, Widget child) {
return new Directionality(
textDirection: TextDirection.rtl,
child: new Builder(
builder: (BuildContext context) {
return new MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 1.0,
),
child: child,
);
},
),
);
},
if you use flutter_localizations:
sdk: flutter
add these line to change your app direction
supportedLocales: [
Locale("fa", "IR"),
Locale("en", 'US'),
],
locale: Locale("fa", "IR") // this is important line if not add this Apps will not change direction
GetMaterialApp( textDirection: TextDirection.rtl, home: SignUpScreen() // const HomeExpert() );

Codeanywhere Environment

I'm Using CodeAnywhere as my IDE and I wanted to use testing Environment not development.
how can I do that?
when I try Console.Log(process.env)
this comes out
{ MANPATH: '/home/cabox/.nvm/versions/node/v4.4.0/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man',
TERM: 'xterm-256color',
SHELL: '/bin/bash',
SSH_CLIENT: '(Confidential)',
NVM_PATH: '/home/cabox/.nvm/versions/node/v4.4.0/lib/node',
OLDPWD: '/home/cabox/workspace',
SSH_TTY: '/dev/pts/0',
NVM_DIR: '/home/cabox/.nvm',
USER: 'cabox',
LS_COLORS: 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:o
w=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;3
1:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.ja
r=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.g
if=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*
.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;
35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01
;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;
36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00
;36:*.spx=00;36:*.xspf=00;36:',
MAIL: '/var/mail/cabox',
PATH: '/home/cabox/.nvm/versions/node/v4.4.0/bin:/home/cabox/.npm-packages/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
usr/games',
NVM_NODEJS_ORG_MIRROR: 'https://nodejs.org/dist',
PWD: '/home/cabox/workspace/login-app',
SHLVL: '1',
HOME: '/home/cabox',
LOGNAME: 'cabox',
SSH_CONNECTION: '(Confidential)',
NVM_BIN: '/home/cabox/.nvm/versions/node/v4.4.0/bin',
LESSOPEN: '| /usr/bin/lesspipe %s',
NVM_IOJS_ORG_MIRROR: 'https://iojs.org/dist',
LESSCLOSE: '/usr/bin/lesspipe %s %s',
_: '/home/cabox/.nvm/versions/node/v4.4.0/bin/node' }
I if I can add some variables into this environment, then how can I do that?
if I want to create another Environment, then how can I do that?

CKEditor change default format

i try to change the default selected format in ckeditor
i added it in the styles.js
CKEDITOR.stylesSet.add('mystyles', [
{name: 'My styly style', element: 'p', styles: {'color': 'blue'}},
]);
and when my instance of ck loads i would lije to select by default the format when i click in the editor to change the texte .
Anyone has the answer
thanks
Try to add this line in your config.js:
config.format_p = { element: 'p', attributes: { 'class': 'color_blue' } };
** Do not forget to add (in your css)
.color_blue{
color:blue;
}

Can't Get Require Optimizer to mangle output

I'm using the Require Optimizer to combine all of our source files in to a single file. That works great, but when I try to set optimize: 'uglify' or optimze: 'uglify2' I don't get mangled output: everything is combined in to a single line of a single file, but that line is filled with the original variable names.
I've tried setting various uglifyer options like:
uglify: {no_mangle: false}
or:
uglify2: {mangle: true}
but they don't work. Can anyone explain how I can get the optimizer to mangle its output?
EDIT
Here's my build.js file:
({
baseUrl: ".",
paths: {
template: 'ext/require/hbs',
text: 'ext/require/text'
},
name: "main",
optimize: "uglify",
out: "../built/main-built.js",
uglify: {
beautify: false,
space_colon: true,
no_mangle: false,
}
})
I wound up fixing this by updating our copy of Require.

RequireJS optimize !text Dynamic load not allowed

I use the plugin !text, and want that after optimization by r.js, user to edit their own templates. But after optimization I get an error: Dynamic load not allowed.
build.js
{
baseUrl: "f/app",
appDir: "..",
dir: "dist",
modules: [
{
name: "catalog"
}
],
stubModules: ['text'],
optimizeAllPluginResources: false,
inlineText: false,
paths: {
app: '../libs',
jquery: 'empty:',
underscore: 'empty:',
backbone: 'empty:',
marionette: 'empty:',
JSON: 'empty:',
// Plugins
text: '../libs/rjs-text',
},
exclude: ["jquery","underscore","backbone","marionette", 'JSON', 'text']
}
This is generally how it is possible to implement?
Without any example code this is virtually impossible to answer (as I said in my comment). However, just to take a shot in the dark, perhaps your problem is that you're using variables for your require imports, and that is annoying the require optimizer. Using literal arrays should solve that; in other words don't do:
var myDependencies = ['foo', 'bar'];
define(myDependencies, function(...
do:
define(['foo', 'bar'], function(...
See this link on the Require site for more info:
http://requirejs.org/docs/optimization.html

Resources