adobe / brackets.io

brackets.io website
111 stars 80 forks source link

Externalising couple of strings #213

Closed vickramdhawal closed 6 years ago

vickramdhawal commented 6 years ago

Externalising few of the strings that were hardcoded to english.

vickramdhawal commented 6 years ago

@nethip for review.

swmitra commented 6 years ago

@vickramdhawal We can split the string further and compose the content paragraph like this -

<p><span data-i18n="footer.project-info.motivation">Brackets was founded by Adobe as a community guided, open source project to push web development editors to the next level.</span><br><span data-i18n="footer.project-info.license">Brackets is released under the</span><a data-i18n="footer.project-info.licensetype" href="https://github.com/adobe/brackets/blob/master/LICENSE">MIT Licsence</a>.</p>

We can then avoid writing that content literal specific i18 logic. It somehow doesn't look maintainable IMO, but if we can write a generic loader to handle such template nesting, that would be scalable. In this particular case though, we don't need such custom externalisation logic.

vickramdhawal commented 6 years ago

We cannot do it this way as it assumes that the license name will come at the end in all locales. Hence the convoluted logic in javascript.

swmitra commented 6 years ago

@vickramdhawal I guess we can make use of variables in i18 value declarations and it does support namespaces as well. _namespace.varname_. So in the license entry value we could use _licensetype_ with and the i18 library would take care of replacing the type with the corresponding value for the variable from the string table. So if in a particular locale the license type is required at the the begining, then the license entry in that table would contain this variable at the begining.

vickramdhawal commented 6 years ago

I've used that however if i put an < a > in the string it does not work. I needed to wrap the separately and hence the JS.

vickramdhawal commented 6 years ago

@swmitra Anything I can do to expedite it. Did I miss something ?