GithubHelp home page GithubHelp logo

lsaudon / l10nization Goto Github PK

View Code? Open in Web Editor NEW
17.0 1.0 3.0 2.28 MB

L10nization is a tool for extracting text to arb files for l10n or r13n in a Flutter application.

Home Page: https://marketplace.visualstudio.com/items?itemName=lsaudon.l10nization

License: MIT License

TypeScript 93.76% Dart 4.21% JavaScript 1.53% Kotlin 0.50%
dart flutter l10n extension visual-studio-code vscode vscode-extension arb r13n hacktoberfest

l10nization's Introduction

@lsaudon's Holopin board

l10nization's People

Contributors

dependabot[bot] avatar lsaudon avatar robertodrowaz avatar schindler-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

l10nization's Issues

No arb files found

Getting "No arb files found" message in vs-code while extracting string.

Directory structure
Screenshot 2023-04-20 at 2 57 22 PM

l10n.yaml file
Screenshot 2023-04-20 at 2 57 40 PM

and local file
Screenshot 2023-04-20 at 2 58 04 PM

Extracting a string to arb does not auto generate localisation

I don't remember if this was the behaviour before as well. But should it not auto-generate the localizations of whatever string we extracted to Arb files?

After extracting it gives me:
The getter 'setBtnText' isn't defined for the type 'AppLocalizations'.
and I have to run flutter gen-l10n to update localizations.

If this was always the behaviour, then would it be possible to do auto-generation whenever a value is extracted?

Add to arb files is changing the apps arbs, and a separate subprojects arbs

It should only add to arbs on the first location that it finds, not all locations found.

I have a folder called "extension" at the root level of my app.

I decided to give it it's own l10n.yaml and arb/l10n folders since it's only like 20 strings.

But adding to arb files in main app, also modifies the arbs in the 'extension' folder.

Your extension must be scanning for all arb files. I thought I could temporarily rename 'extension/l10n.yaml' to some nonsense hoping it would not modify those arb files, but it modifies them anyway.

Setting to disable description prompt

I believe a lot of people (me included) don't feel the need to provide description for terms. Especially since this tool is used to edit arbs directly and thus probably is used mostly by technical people who can look up necessary context in the code. Having an option to disable the description prompt would be nice.

I will implement it and pull request when I have some time

Option to add messages only to template ARB file

Option to add new messages only to template file would be great. Currently new messages are added to all ARB files which makes it hard to tell that they still require translation. This is especially a problem when using arb_translate for automatic translation.

I can make a PR with this feature when I have some free time.

No arb files found in the project

image

My settings
image

My project structure:
l10n.yaml in the root
arb-dir: ./lib/l10n template-arb-file: app_en.arb output-localization-file: app_localizations.dart nullable-getter: false untranslated-messages-file: to_be_translated.json

flutter 'gen-l10n'" terminated with exit code: 1

I'm getting this error, but running $ flutter gen-l10n in the terminal works fine.

I do have an unusual setup. I have a sub package that has the localization code.

In my main app I have a l10n.yaml file with

arb-dir: localizations/lib/arb       // localizations is my sub package
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
nullable-getter: false
synthetic-package: false
output-dir: localizations/lib/l10n    // localizations is my sub package

In the sub package, I have this:

arb-dir: lib/arb
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
nullable-getter: false
synthetic-package: false
output-dir: lib/l10n

I have the generate true in both the main app and the sub package

  • Executing task: /home/steve/development/flutter/bin/flutter gen-l10n

Attempted to generate localizations code without having the flutter: generate flag turned on.
Check pubspec.yaml and ensure that flutter: generate: true has been added and rebuild the project. Otherwise, the localizations source code will not be importable.

  • The terminal process "/home/steve/development/flutter/bin/flutter 'gen-l10n'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

[Idea] Support for adding metadata of the message

When we extract a string into an arb file, it asks for what ID we want to give to the string. Can you also add another input for adding metadata where we can add a description for it to give its context?

Error: Undefined name 'l10n'

Hello, I get this error. I think I miss some configuration. How can I correct it? Thank you

Undefined name 'l10n'.
Try correcting the name to one that is defined, or defining the name.

Handle single quotes better.

I use single quotes, so I have some strings like 'This is John\'s stuff'

Converting that to double quotes makes it better, but it would be nice if your code worked better.

'This is John\'s stuff'  => "This is John\\'s stuff"

but using double quotes in my code:

"This is John's stuff" => "This is John's stuff"

Also in the app_localizations.dart files you get

'This is John\\\'s stuff'

It would be good if you could not do the \ and just use the ' with double quotes

Small thing, but it looks much cleaner, and I don't want to have to convert to double quotes to get the cleaner version.

Autogenerated code replacing the selected string after "Excract value to arb file" doesnt include "AppLocalizations.of(context)"

l10nization version: 3.0.1
VSCode version: 1.84.1 Mac

i10n.yaml file:

arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
nullable-getter: false

I start with code

final str = "Hello $i";

I select "Hello $i" then click "Excract value to arb file", I complete the form and the string gets replaced with:

final a = l10n.hello(i);

I expected it to be

final a = AppLocalizations.of(context).helloI(i);

Handle Multilined strings better

final x = 'This is a double line string'
' with info.';

I select both lines and get this:

"thisIsADoubleLineStringWithInfo": "This is a double line string'\n ' with info.",

I'm using this to localize my app and it's great! Thanks for making it.

not working with .arb file JSON Error

I am getting the following errors

Expected ',' or '}' after property value in JSON at position 1080

Expected double-quoted property name in JSON at position 11066

I only have 369 lines in my .arb file.

yaml file not found

Thanks for this extension, however I can't use it.

When I want to use the extension on a text in my code I always get the error: The l10n.yaml file was not found. However my yaml file is called l10n.yaml and is at the root of my flutter project (see screenshot). I didn't change any parameter of the extension.

PS : I am on Mac (I don't know if the paths are different)

Thanks in advance for the answer.
Screenshot 2022-12-01 at 1 48 10 PM

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.