codeigniter load language add whitespace - codeigniter

I am developing a multilingual site and using sessions to change language, my issue is when I load a language it is adding a white space on top of page, I tried this ways:
In constructor:
function __construct(){
parent::__construct();
$this->lang->load('main', $this->session->userdata('language'));
}
top body it adds a white-space
When I check in "view source" it does not display any white space but in firebug i can see:
I also tried to load lang in controller and view but it has same effect.
Edit: I noticed it is only adding space to languages other then English. In English it works fine.
Thanks for any support.

It was adding a character at top of language file, This solved my issue http://studentguru.gr/b/solidus/archive/2009/12/30/lt-php-include-gt-strange-extra-white-space-at-the-beginning-of-page.aspx

Related

TYPO3 create links and respect language of target page (Fluid, typolink)

we have a webpage, where not all pages are translated. So many pages are only available in english and some special pages (country landing pages) are translated to various languages.
From these special translated pages I want to create links automatically converted to the default languages if the target page is not translated.
In menus (HMENU) "protectLvar = 1" works fine for me.
But how can I achieve this in normal typolinks or fluid "<f:link.page uid="..."> without manually dealing with the language ?
I'm on typo3 9.5.
Sample:
I have the following polish URL:
mydomain.com/pl/poland/
All the links from this page should go to "/en/subpage-xy/" because the above page is the only page translated to "pl". But actually all links go to "/pl/subpage-xy/" regardless if pages are translated to "pl".
The content-fallback mode leads to displaying english content under a /pl/-URL. I don`t want to change the fallback mode - I only want the links to be created to available language of the target page.
Is this possible ? Many thanks for any hints.
I think that you can't achieve what you want with default behavior.
I suggest you to wrote your own view helper based on <f:link.page> and in that view helper, you can check with a request in the DB if the page exist for the current language and switch to English if that's not the case.
I guess that you can also generate the link with typoscript with condition over page existence in current language but it's more tricky.
You have a sample here : check if current page is translated

Codeigniter Arabic language and rtl (right to left) stylesheet

I have a bilingual site, English and Arabic. Default language is Arabic and default loaded style.css is rtl. I switch the language with session and the translated text from language folder works correctly.
But for the second language (English) I have some issues:
When I am in About page and I switch language is goes to main page . How I can redirect to same page where I've been before switching language.
My function to switch language is:
public function change($type){
$this->session->set_userdata('lang', $type);
redirect(base_url());
}
After switching the language I need that also the stle.css for English language gets loaded.
In order to send the user to the same page between languages, you need to check which page the user is browsing, before invoking your function change($type)
You can get the current link like this:
$current_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
the redirect depends how your multi-language site is designed. It could be:
yoursite.com/ar
yoursite.com/en
or
en.yoursite.com
ar.yoursite.com
anyway basically you'll need to replace en with ar
the css change is easy to perform, just make use of the session you have created just before the redirect:
in the view file where you load the css, load the version depending on the session value of lang, make sure you use the default css, in case there is no session set (yet).

swapping rails3 layout on the fly

I have am trying to dig into twitter bootstrap and rails3 sites that actually look and function well (new to it all). I have this feature I want where I have a twitter bootstrap navigation (specified in what I guess is the default application layout) that calls a _navigation.erb.html etc. This works great, but on that navigation i want a "Se Habla Espanol" or what not, where when the user clicks there, the navigation text all changes to spanish. i thought easiest would be have another _navigationespanol.erb.html or something that changes the navigation words all around and also when click (toggling into spanish mode) it sets all the text in the pages to spanish by anytime there is a text render or whatever a variable flag was set and is interrogated on page index render show or what have you and it renders spanish or english words...
So ideally click on see it all in spanish, it loads a new layout (my main question) that has the spanish navigation and messages and other twitter bootstrap stuff and it also sets a global var i can look at in other renders to see if im rendering english or spanish.
More than swapping layouts, it seems that you need to implement Internationalization (I18n). In such case you'll have to create an directory config/locales that holds a .yaml file for each of the language you're trying to have translation for, for instance:
# on a file called en.yml
en:
hello: "Hello world"
For a complete guide on how to go about it: Rails Internationalization (I18n) API

How to put space in tab title in dojo?

i am using dojo toolkit with php codeigniter 2.1.0 and i want to put space in tab name wherever necessary.
Anyone has any solution??
My code is :
<div id="setupParty" data-dojo-type="dijit.MenuItem"
onclick="addPartyTab('AddParty');">Manage <u>P</u>arty</div
If i will directly write as :
<div id="setupParty" data-dojo-type="dijit.MenuItem"
onclick="addPartyTab('Add Party');">Manage <u>P</u>arty</div
then it throws error
I want my tab to be displayed with name as "Add Party"
can anyone suggest me solution for this???
Thanx in advance
What error does it throw?
how does the code in addPartyTab look like?
The following should work in any case:
onclick="addPartyTab('Add Party');">
However, this may not be an ideal solution. You need to look into your addPartyTab function to first, ensure the text with embedded space is coming through fine (and i dont see any reason why it shouldnt) and then examine the code in that function to ensure it is being processed correctly - i suspect somewhere in there you will find why it is breaking.
In general, you can set title on a dijit tab (which is typically a contentpane) directly even if the title contains spaces without any issue. Following is a typical way of doing it:
dijit.byId("myTabContentPane").set("title", "Add Party - Hurray!");
where myTabContentPane is the id of the contentpane that makes up that tab

Which file should I edit to change the breadcrumbs starting point?

I wanted to change the breadcrumbs starting point from Home to My title. I edited the file /magento/app/code/core/Mage/Catalog/Block/Breadcrumbs.php but it doesn't seem to be working. Is XML playing a role in that?
thanks
Your best option is to use Magento's translate feature. Notice how the text in Breadcrumbs.php is wrapped with ->__('text') which instructs Magento to see if there is a translation for text for the current module. If you turn on Translate Inline in System>Config>Admin>Developer, you will be able to edit the text on the page (after refreshing, click the red box then the little book icon). This will then be entered into the database in the core_translate table and replaced in future page renders.
As a general rule, you should never edit files in app/code/code as you will break future upgrades and patches.
turn on Translate Inline in System>Config>Admin>Developer, you will be able to edit the text on the page (after refreshing, click the red box then the little book icon)

Resources