Open julienkosinski opened 7 years ago
Wait, this would potentially scan through the entire codebase to determine the vars
? or how is this supposed to work ?
@adelowo Thanks for asking.
This is an idea. As you know localizing application is considerable effort, aah CLI is gonna help on that. So command creates i18n placeholder then aah user fills in the locale based values in it.
Let's move on to implementation part:
Command: `aah generate i18n --importpath github.com/user/app --locale "en-US, fr, de-DE"`
Alias:` aah g i -i <value> -l <value>`
--importpath is optional if run from app directory tree
--locale creates `messages.{provided-locale}` file, if not provided then only creates the `messages.keys`
Steps:
views
directory and its sub-directories view files, uses the config from section view { ... }
such as file extension, delimiter, etc.{{ i18n . "key" }}
- possible Regex would help us heremessages.keys
file into directory app-base-dir/i18n
Sample messages.keys
content:
# PLEASE DO NOT EDIT
# It will be overwritten on next run
page {
site {
title {
index = "page.site.title.index"
}
}
}
Please let me know your thoughts.
Understood.... I am just more worried about updates. Does this plan to support update operations like running the command again after making some changes to the views - even though it was previously generated ?
@adelowo That's a good question and concern.
Yes, user can run n
no. of times. messages.keys
file would be overwritten on every run, since its one way. However locale message file would be appended with new keys.
BTW, Currently aahframework.org/config.v0
doesn't have persistence support yet. So before this implementation we have to added file persistence support for config values.
Would you like to try on it?
aah generate i18n
I would take a stab at it next week if it has not been worked on
@adelowo I'm glad to hear that, No I'm not working on it. I have shared my idea with you today.
Currently I'm doing my homework on Websocket and Configurable roles/permissions for each route definition.
This depends on #231
Hello,
Besides
aah generate
which could be used for whole generation about MVC (model needs database layer) I would like to present a functionality that I thought about i18n. The idea is to be able to generate amessages
file like below in this example:For i18n, if I have
i18n . "page.site.title.index"
in a view (so that's for eachi18n
vars defined in view) , I will write in CLIaah generate i18n fr
, then it will generate amessages.fr
file with:We already talked about that @jeevatkm in gitter, that's why it's already in roadmap. This issue is intended to precise it :).
Thank you very much! :D