我的主要目的是向不同国家(语言)的人展示不同的页面.我认为它应该基于用户区域/国家,我想可以从IP地址获取?
例如:*对于EN国家的人,他们会看到这一点.www.example.com
*对于日本人,他们会派遣这个.www.example.com/jp
另外我看到有些人说完成这些目的,最好的方法是基于网页浏览器语言,可以从http标头获取.我不知道哪个更好,常见的方式是什么,为什么......?
谢谢你的建议!
我正在使用Flex和Java.
有没有办法检查用户的国家/地区?"Locale"不够好,因为有很多英语语言环境,但它们遍布全世界.
也许以某种方式与IMEI或......?
所以实际上我需要找出SIM卡所属的国家/地区?
编辑:不允许使用 GPS或互联网.
尝试用于<?php echo $current_user->billing_country; ?>
显示WooCommerce用户结算国家/地区.例如,如果客户具有澳大利亚帐单地址,则回显为AU.但是,我想用全名取代国家代码.
这同样适用于billing_state.而不是南澳大利亚州,我得到了SA.已经通过functions.php进行了工作,但是只有我添加每个州和国家.这显然是将世界各州映射到州代码的一项伟大任务.
我相信我之前已经以一种非常简单的方式做到了这一点,但无论出于何种原因,此刻都无法弄明白.
正在使用禁用输入字段中的国家/地区和州作为值
<input type="text" class="form-control" value="<?php echo $current_user->billing_country; ?>" disabled="">
Run Code Online (Sandbox Code Playgroud)
我们目前得到的图像
我们想要的形象
我运行的是 Windows 10。当我从开始菜单中打开“区域和语言设置”时,我可以选择“国家或地区”。我正在尝试在 C# 程序中获取该值。
我在丹麦。我尝试将我的国家/地区更改为德国(参见屏幕截图),但我无法获取返回德国的代码。重新启动计算机没有帮助。
我受此线程启发编写了一些代码。
我的代码如下所示(同时尝试各种事情,获取我能想到的所有地区/文化事物):
private static void Main(string[] args)
{
Thread.CurrentThread.CurrentCulture.ClearCachedData();
Thread.CurrentThread.CurrentUICulture.ClearCachedData();
var thread = new Thread(() => ((Action) (() =>
{
Console.WriteLine("Current culture: {0}", Thread.CurrentThread.CurrentCulture.Name);
Console.WriteLine("Current UI culture: {0}", Thread.CurrentThread.CurrentUICulture.Name);
Console.WriteLine("Installed UI culture: {0}", CultureInfo.InstalledUICulture.Name);
Console.WriteLine("Current region: {0}", RegionInfo.CurrentRegion.ThreeLetterISORegionName);
Console.WriteLine("System default LCID: {0}", GetSystemDefaultLCID());
}))());
thread.Start();
thread.Join();
Console.ReadKey();
}
[DllImport("kernel32.dll")]
private static extern uint GetSystemDefaultLCID();
Run Code Online (Sandbox Code Playgroud)
它输出:
Current culture: en-DK
Current UI culture: en-US
Installed UI culture: en-US
Current region: DNK
System default …
Run Code Online (Sandbox Code Playgroud) 所以我有一个国家/地区下拉列表和一个状态下拉列表,它根据所选国家/地区动态填充.当我单击国家/地区时,状态下拉列表会很好地填充,但是当我从另一个下拉列表中单击值(状态)时出现问题,列表而不是保留所选项目将返回到列表的第一项而没有选择值显示.
<td><asp:DropDownList ID="ddlState" runat="server"
DataSourceId="dsStateList"
DataTextField="state_nm"
DataValueField="state_cd"
OnSelectedIndexChanged="ddlState_SelectedIndexChanged"
AutoPostBack="true"
AppendDataBoundItems="true"
Width="160px" OnDataBound="ddlState_OnDataBound">
</asp:DropDownList>
</td>
<asp:DropDownList ID="ddlCountry" runat="server"
DataSourceId="dsCountryList"
DataTextField="COUNTRY_NAME"
DataValueField="COUNTRY_CIA_ID"
OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"
OnDataBound="ddlCountry_OnDataBound"
AutoPostBack="true"
AppendDataBoundItems="true"
Width="160px">
</asp:DropDownList>
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
string comboStateCODE = ddlState.SelectedValue;
dsCompanyListParam.Text = comboStateCODE;
ddlCountry.DataBind();
ddlState.DataBind();
}
protected void ddlState_OnDataBound(object sender, EventArgs e)
{
ddlState.Items.Insert(0, "Please Select a State");
}
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
ddlState.Items.Clear();
dsStateList.SelectParameters["iCountryID"].DefaultValue = ddlCountry.SelectedValue;
dsCompanyListParam.Text = ddlCountry.SelectedValue;
Trace.Warn("ddlCountry_SelectedIndexChanged");
ddlCountry.DataBind();
ddlState.DataBind();
}
protected void ddlCountry_OnDataBound(object sender, EventArgs e) …
Run Code Online (Sandbox Code Playgroud) 我想对国家边界(边界)进行着色(填充和/或描边),假设您有一张世界地图并且用户选择了意大利,则意大利的边界将被描边,并且意大利的区域将被填充颜色。
如果用户可以缩放和移动全球地图,那就太好了,但不是必须的。我正在寻找一些干净、动态、iOS5 友好且易于集成的东西,可以基于或不基于mapKit。
我知道这可以通过 KML 文件来完成,但我相当确定已经有一个库 - 所以我不需要再次重新发明火。
我正在使用 formattastic,并且我有一个野外国家/地区。当我尝试显示屏幕时,我收到此错误。
要使用 :country 输入,请安装 Country_select 插件,如下所示:https: //github.com/jamesds/country-select
现在。我不想使用任何插件..它是自由文本,我想保持这种状态。
有人知道如何取消这个要求吗?应该很容易……但如果我能看到如何做,我会很烦恼。
= semantic_form_for @store, {:html => { :class => "form-horizontal" }} do |f|
= f.input :default_country
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Django-oscar 中编写一种基于国家/地区和重量基础的运输方法。看来默认的运输方式也必须有这些
from oscar.apps.shipping.methods import Free, FixedPrice, NoShippingRequired
Run Code Online (Sandbox Code Playgroud)
我不需要上述任何一项,只会通过折扣提供运费折扣。
我如何通过repository.py编写,这样我就不会应用任何这些oscar.apps.shipping.methods import Free,FixedPrice,NoShippingRequired
所以我可以编写我的类存储库(CoreRepository):
不写
methods += [NoShippingRequired()]
methods += [FixedPrice()]
methods += [Free()]
Run Code Online (Sandbox Code Playgroud)
我编写的方法不是基于代码的,而是通过仪表板中的运输菜单实现的。我按照以下步骤设置了运费。
https://groups.google.com/forum/#!topic/django-oscar/H4tf20ujm8k
测试时,在“运输菜单”页面上,“手工交付”和我的基于重量的按国家/地区运输方法按钮都会显示给客户。这意味着即使客户来自国外,客户也可以单击手工交付按钮。我希望禁用“送货方式”页面上的“手工送货”按钮,因此客户根本无法选择它。
另一种选择是在此按钮上附加一条消息,让客户清楚地知道,单击该按钮意味着安排在预订后 1 周内从仓库取货。
如何向客户显示该消息?客户未进入付款页面。并且发送电子邮件以便可以在 7 天内领取物品?与 argos 类似,预订、购买、购物、付款和提货。所以我可以将“HandDelivery”的描述更改为预订。然后客户不付款,而是在取货时付款。但如何呢?
我刚刚开始在 C# .net 5.0 中使用 Bogus。我设法在沙盒应用程序中返回非常有用的数据,但我想将数据限制为基于美国。有没有办法做到这一点?(这是我的沙箱应用程序的一部分)
using Bogus;
namespace FrankenPeople
{
public class GetBogus
{
public enum Gender
{
Male,
Female
}
private static int userId = 1;
private static readonly Faker<Person> fakeData = new Faker<Person>()
.RuleFor(p => p.Id, f => userId++)
.RuleFor(p => p.Gender, f => f.PickRandom<Gender>().ToString())
.RuleFor(p => p.Title, f => f.Name.Prefix(f.Person.Gender))
.RuleFor(p => p.FirstName, f => f.Name.FirstName(f.Person.Gender))
.RuleFor(p => p.MiddleName, f => f.Name.FirstName(f.Person.Gender))
.RuleFor(p => p.LastName, f => f.Name.LastName(f.Person.Gender))
.RuleFor(p => p.StreetAddress, f => f.Address.StreetAddress())
.RuleFor(p => …
Run Code Online (Sandbox Code Playgroud) country ×10
c# ×3
.net ×2
php ×2
woocommerce ×2
android ×1
bogus ×1
checkout ×1
culture ×1
dictionary ×1
django ×1
django-oscar ×1
formtastic ×1
geolocation ×1
ipad ×1
iphone ×1
locale ×1
objective-c ×1
readonly ×1
region ×1
sim-card ×1
state ×1
wordpress ×1