Skip to content

Unifying locale into single json file #2

Closed
@hakasapl

Description

@hakasapl

Currently, the website's locale is spread out throughout the site in the form of a central en.php, or hardcoded on various pages of the site. We should combine all of these strings into the json file resources/locale/en.json. The format of the json file should be as follows:

{
    "<section>": {
        "string_name": "This is a string",
        "custom_string_name": "This is a string which has ${VAR} as parameter"
    }
}

Then, this file must be read by php using the json_decode function (be sure to pass true on the second argument for associative array). We can then access the strings like config::locale["section"]["string_name"], and we can use str_replace to fill in any mid-string parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions