Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Problems: Some strings set in external js and CSS file, therefore we *couldn't* directly use lang() methods inside
- * Troubleshoot proposal: see below
- */
- // Proposal for strings in JS:
- <html>
- ...
- // jQuery
- <script type="text/javascript" defer="defer" src="https://yukbisnis.com/applications/assets/js/jquery.js"></script>
- // Define currently set language with php methods "get_language()", then use the variable to dynamically load
- // javascript function inside the external js file
- <script>var used_lang = '<?php get_language(); ?>'</script>
- // All JavaScripts
- <script>...</script>
- <script>...</script>
- <script>...</script>
- ...
- </html>
- // =====================================================================================================================
- // Proposal for strings in CSS (option 1):
- // * internal CSS
- <html>
- <head>
- ...
- <style>
- #the_id::after {
- content: "<?= lang('STRING_KEYWORD'); ?>" ;
- }
- </style>
- </head>
- <body>
- ...
- </body>
- </html>
- // Proposal for strings in CSS (option 2, may be not good idea):
- // using php methods to dynamically load which stylesheet file to be loaded. i.e:
- // <link media="all" rel="stylesheet" type="text/css" href="https://yukbisnis.com/.../<?php echo (get_lang() === 'en') ? 'en_style.css' : 'id_style.css'; ?>" />
Advertisement
Add Comment
Please, Sign In to add comment