Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Ability to specify path in configuration file #70

Closed
KwiqAndre opened this issue Nov 17, 2016 · 13 comments
Closed

Feature: Ability to specify path in configuration file #70

KwiqAndre opened this issue Nov 17, 2016 · 13 comments
Milestone

Comments

@KwiqAndre
Copy link

Sometime the language files can get very big. I usually create language files for each page. To avoid that all other language strings (from other pages) get loaded it would be cool, if I could specify via elixir by parameter which language files should be pulled, so that i can create a language js file for each page. The loading overhead can be reduced that way.

@antonkomarev
Copy link
Collaborator

antonkomarev commented Nov 17, 2016

@KwiqAndre #49 Is this what you need? Or you want to dynamically load translations files on page loading?

@KwiqAndre
Copy link
Author

Yes, thats what I need, only with include.

@rmariuzzo
Copy link
Owner

All good then @KwiqAndre ?

@kwiqadmin
Copy link

this is not in your current version, or am I wrong?
I have to fork it?

@antonkomarev
Copy link
Collaborator

@kwiqadmin it's in current version. See #47 #48

@kwiqadmin
Copy link

artisan lang:js -e auth

[Symfony\Component\Console\Exception\RuntimeException]
The "-e" option does not exist.

@antonkomarev
Copy link
Collaborator

antonkomarev commented Nov 17, 2016

Manual exclusion is not implemented. You can define what files should be included in config file. Look for messages array key in package config file published on install.
Read configuration section of README. Hope this helps.

@kwiqadmin
Copy link

I know that. but the config file is not enough. I need something, that I can create lang js files for individual pages. Right now I can have only one configuration. I want to use elixir to create several lang js files, each with another configuration.

@antonkomarev
Copy link
Collaborator

@kwiqadmin Feel free to make a PR for the elixir which will do the job. This isn't implemented.

@KwiqAndre
Copy link
Author

PR? I am pretty new to all that stuff (laravel, elexir ...)

@antonkomarev
Copy link
Collaborator

antonkomarev commented Nov 21, 2016

@KwiqAndre PR = Pull Request on GitHub.

What sizes of language files do you have that you decided to split them that way?

@rtheunissen
Copy link
Contributor

@a-komarev the size of the file isn't really relevant here - the fact that you are loading resources that you don't need is what's important. Let's say I have 2000 messages in 20 different languages. That's a lot of string data that I would only need at most 5% of in most cases.

A good solution for this is to not compile all the messages into a single javascript file. Instead, you should create a suffix for each locale, eg lang.en.js. That way you can use the current locale in a blade template and only source the language you need. Not sure how this works for fallbacks though.

@rtheunissen
Copy link
Contributor

Actually, why not in config have a locale filter? Eg

<?php

return [
    'locales' => [
        'en_us',
        'en_uk',
    ],
];

@rmariuzzo rmariuzzo modified the milestones: 1.3.6, 1.4.0 Jan 7, 2017
@rmariuzzo rmariuzzo changed the title Additional flexibility Feature: Ability to specify path in configuration file Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants