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

JSON Localization doesn't care about the main Language #26

Closed
ridaamirini opened this issue Dec 19, 2018 · 12 comments
Closed

JSON Localization doesn't care about the main Language #26

ridaamirini opened this issue Dec 19, 2018 · 12 comments
Labels
Improvement Improvement to the code

Comments

@ridaamirini
Copy link
Contributor

ridaamirini commented Dec 19, 2018

Hello @kg-bot :)

I saw that the JSON import feature is new #19.

I have noticed a problem now. Although the JSON are considered during the export but the English version is not, because we don't have a en.json because the english translation is the key.

@kg-bot
Copy link
Owner

kg-bot commented Dec 19, 2018

Hello @ridaamirini

Yup, and I don't have any idea how could we do that because not everyone's main language is English.

I would love to hear some suggestions if you have them 😄

@kg-bot kg-bot added the Improvement Improvement to the code label Dec 19, 2018
@ridaamirini
Copy link
Contributor Author

ridaamirini commented Dec 19, 2018

I have two ideas.

  1. We could make it as a value in the laravel-localization.php and the default value will the default language of laravel app

  2. We say the default language in laravel is the main language

@kg-bot
Copy link
Owner

kg-bot commented Dec 19, 2018

Yup, we could do it like that, but I don't think I'll have time for that today.

@ridaamirini
Copy link
Contributor Author

Ok i try to PR. I think we need to use the first solution but without any default value from the laravel app config because this is dynamic.

@ridaamirini
Copy link
Contributor Author

This line of code makes no sense to me.

if (array_key_exists($key, $results)) {
$results[$key] = $json_strings;
} else {
$results[$key] = $json_strings;
}

ridaamirini added a commit to ridaamirini/laravel-localization-to-vue that referenced this issue Dec 19, 2018
@ridaamirini
Copy link
Contributor Author

ridaamirini commented Dec 19, 2018

@kg-bot i added a PR (#27) for toFlat(). I don't know if we should change the other methods to

@ridaamirini
Copy link
Contributor Author

@kg-bot I just releazied what is about when we have no json.

Laravel is handling it returning the string back. But with our prefix we will have __JSON__ everytime printed out.

@kg-bot
Copy link
Owner

kg-bot commented Dec 20, 2018

When you're calling json translations you must do it with trans.get('__JSON__.Hello world'), it was designed like that.

@ridaamirini
Copy link
Contributor Author

@kg-bot yeah i understand it's a Lang.js "issue"

kg-bot added a commit that referenced this issue Dec 20, 2018
@kg-bot kg-bot closed this as completed Dec 20, 2018
@ludo237
Copy link
Contributor

ludo237 commented Jan 28, 2019

@kg-bot hijacking this issue to let you know that this feature should be documented because it's really a headache to find out by yourself 😆

@ridaamirini
Copy link
Contributor Author

Note that this issue can also solved on client side like this rmariuzzo/Lang.js#69 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Improvement to the code
Projects
None yet
Development

No branches or pull requests

4 participants
@ludo237 @kg-bot @ridaamirini and others