i18n text per dynamically included javascript file
Posted: Wed Feb 13, 2008 10:35 am
hi.
ok, so i have i18n text in the database. each php file fetches its own text to use from the db just fine. and initially i used to list all javascript files i would use at the top of the php so that php could also fetch the i18n text for those files from the db, and write it as javascript to be available for the javascript files to use. lovely.
except of course, i am now allowing javscript files to include their own supporting javascript files on the fly. works a treat for building but now php does not know ahead of time which files to fetch i18n text for. boo hoo.
so i am guessing that i can use some XHR in each javascript file to fetch its own i18n. or, can i also configure the server to run the javascript files thru php which can, as before, get the i18n text from the db as each file is requested from the server?
anyone think that either of those is good/better? or what is the 'real' way i should be doing it? (without changing what seems like an otherwise lovely i18n db setup).
any tips would be greatly appreciated ....
ok, so i have i18n text in the database. each php file fetches its own text to use from the db just fine. and initially i used to list all javascript files i would use at the top of the php so that php could also fetch the i18n text for those files from the db, and write it as javascript to be available for the javascript files to use. lovely.
except of course, i am now allowing javscript files to include their own supporting javascript files on the fly. works a treat for building but now php does not know ahead of time which files to fetch i18n text for. boo hoo.
so i am guessing that i can use some XHR in each javascript file to fetch its own i18n. or, can i also configure the server to run the javascript files thru php which can, as before, get the i18n text from the db as each file is requested from the server?
anyone think that either of those is good/better? or what is the 'real' way i should be doing it? (without changing what seems like an otherwise lovely i18n db setup).
any tips would be greatly appreciated ....