Setting up localization in Kohana 3.0 framework with set_locale - localization

In a tutorial on setting up internationalization and localization, "Kohana 2.4 I18N (internationalization and localization) Library" the author says:
I'd put it in a Base Controller so that all Controllers inherit it.
This is the code:
I18n::set_locale('tl_PH');
I tried placing it in all the controller and places I could but is not working.
Where is the exact place in Kohana 3.0.4.2 that I should place it?

Put this line in bootstrap.php:
I18n::lang('tl-PH');
The I18n::set_locale function doesn't exist in Kohana 3. See I18n class docs.

Not sure who wrote that article, but locale should be set using the config locale.php config file. You may have to copy it from system/config/locale.php into your application/config/locale.php and set the proper values.
Calling I18n::set_locale() should only happen if you need to change from the default (set in locale.php) to something different (like Dutch, English, etc...).
P.S I'm a Kohana 2.4 core dev...

If you want to set the PHP locale, you will change this is in application/bootstrap.php, there is a setlocale(LC_ALL, 'en_US.utf-8') line there already which you can change to the correct language.
To set Kohana's internal language for translation, add a call to I18n::lang('en-us') (replace "en-us" with your language) after the Kohana::init() call, before Route::set().

Related

ASP.NET MVC add translation in multiplanguage from screen/UI dynamically

In my website -- Add screen/UI from which user can add translation dynamically
for example:
I want to add translation for "Hello World!" in multiple language and want to fetch according to language selection
Key :
strHelloWorld
Value:
Hello World!
Language:
en (it can be anything english,spanish,german etc)
This above 3 field data we can add/enter from Scree/UI by superadmin and
store/save in whatever form is good it can be in database or in json file
Please suggest way to add translation from screen
Asp.Net has a special file called resource files (.resx) to define the default locale (English) and other language texts.
For that please follow the steps:
step 1: You need to create .resx(resource file) into Resource(new
folder). create the file for the default language and second file with other lang.
step 2: set access modifier to public otherwise the
variable value will not appear on the view side
step 3: enter the variable name in the same in both files but make value different related to language.
step 4: once you declare the same variable name in both languages resource file, you can use that variable name where ever you want to declare in .cshtml file.
ex. Resources.Global.APP_NAME
For reference :
http://www.codedigest.com/posts/53/create-multi-language-website-in-aspnet-mvc---localization
Please use below nuget package
It is really awesome thanks to nuget and their author
https://github.com/RickStrahl/Westwind.Globalization
Please note that In this solution they have provided solution for all .net framwork/platform like asp.net 4.5 also aspnet core
Thanks again

Not apply .po files for module in Orchard CMS

I install Orchard CMS 1.10 and take russian translate from https://crowdin.com/project/orchard-cms and unpack to Orchard.Web. When i added and enabled ru-Ru localization all work good for razor views. But for module isn't. For example i try change validate message for required fields in Orchard.DynamicForms, but nothing happened when displayed validation message, they still english. Also translate not applied for module list in admin panel.
Search for the english message in source code, add breakpoint and step into the T() call, then check the value of the scope parameter. This is the value that should be used in the msgctext line.

composite C1 form Renderer localization

I have created a global data type, and use form renderer in a page to let user fill in the data and submit to website.
The default English is working fine.
now when I try to support the second language I run into issues. According to the composite documentation:
1.Add your empty localization file at ~/Frontend/CompositeForms/Renderer/Localization/, for example: Composite.FormsRenderer.de-de.xml
2.Copy the contents of the default Composite.FormsRenderer.en-us.xml to your localization file.
3.Translate the strings.
4.In ~/App_Data/Composite/Composite.config, under the section locate Composite.Plugins.FormsRenderer's add section and register your localization file
but ~/Frontend/CompositeForms/Renderer/Localization does not exist, and neither does Composite.FormsRendereren-us.xml exists.
is the documentation outdated? does anyone had experience with localizing form renderer on user defined data type?
thanks
The documentation IS outdated at the moment (and will be updated soon - thanks for pointing it out).
Do it in the following way on 4.0 or later:
Make a copy of ~/Composite/InstalledPackages/localization/Composite.Forms.Renderer.en-us.xml, changing the language/culture code from 'en-us' to your language's (e.g. Composite.Forms.Renderer.de-de.xml).
Translate the strings.
No need to change anything in ~/App_Data/Composite/Composite.config any more.

Grails internationalization for the views

In Grails views, I need to change the language for labels, buttons, etc., depending on the language that the user picked. How can that be achieved?
i found a soultion to my problem .
A great thing of the scaffolding is that internationalizing the elements on the screen is a breeze! Default translations for Home and Create have already been provided for a dozen or so languages in the i18n folder. The name of the entity itself (“Product”) and its properties can be defined by following a convention: [entity name].label and [entity name].[property name].label – see your Grails installation /src/grails/templates/scaffolding folder.
Take a look at how we would translate a few things into Dutch, by adding a few keys to messages_nl.properties:
product.label=Product
product.name.label=Naam
product.status.label=Status
here is the link (http://tedvinke.wordpress.com/2012/08/22/grails-scaffolding-enums-and-i18n/)

Where and How to define Constant in Symfony?

I have a few of my own constants in symfony, and I need to make them available throughout the application, where to best define them?
I tried, in the directory myapps\config\config.php, define my constant in this way:
sfConfig::set('aaa', 'mya');
But when I tried to access the constant in myapps\apps\frontend\modules\login\actions\actions.class.php, using this comand
sfConfig::get('aaa')
I simply get a null, indicating that it hasn't been defined.
How and where to define symfony constant so that it is accessible throughout the whole project?
This is how I solved the problem:
Put the following into my myapp/apps/frontend/config/app.yml:
all:
.app_set:
bpobackend: me
bpoRedirectScreen: allow
Then in action module, call the var_dump to check the value
var_dump(sfConfig::get('app_bpobackend'));
looks like you are trying to use symfony 1.0 style configuration with symfony 1.1 or 1.2. all config.php files have been removed in 1.1. see Overview of the Configuration Files for what to use instead. and always be sure to look at the documentation for the proper version (1_2 (or whatever version you are using) in the url).
I have tried to add constant in the config.php in Symfony 1.0..
So If you want to add constant variables in config.php then
sfConfig::add(array('SF_DEFAULT_DATEFORMAT' => 'dd-MM-yyyy'));
This is the code where I have define the date format with name 'SF_DEFAULT_DATEFORMAT'...
So You can Tried with this One ...

Resources